This is an automated email from the git hooks/post-receive script. gewo pushed a commit to branch master in repository aeskulap.
commit 8b222d9f5948ea162e0fb47336dc73edbefdb2fd Author: Gert Wollny <[email protected]> Date: Tue Jan 23 09:40:16 2018 +0100 d/p: add patch for gsettings configuration storage --- .../patches/GSettings-configuratio-storage.patch | 657 +++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 658 insertions(+) diff --git a/debian/patches/GSettings-configuratio-storage.patch b/debian/patches/GSettings-configuratio-storage.patch new file mode 100644 index 0000000..c768172 --- /dev/null +++ b/debian/patches/GSettings-configuratio-storage.patch @@ -0,0 +1,657 @@ +From ca07381d3779194c37ba7bc19978deabb8d0eb04 Mon Sep 17 00:00:00 2001 +From: Gert Wollny <[email protected]> +Date: Mon, 22 Jan 2018 17:01:45 +0100 +Subject: [PATCH] Implement GSettings configuration storage. + +This is required, since gconf is obsolete. +--- + configuration/Makefile.am | 18 +- + configuration/aconfiguration-gconf.cpp | 1 + + configuration/aconfiguration-gsettings.cpp | 369 +++++++++++++++++++++++++++++ + configuration/aconfiguration-win32.cpp | 1 + + configuration/aconfiguration.cpp | 16 +- + configuration/aconfiguration.h | 9 +- + configure.ac | 38 ++- + imagepool/poolinstance.h | 2 +- + src/Makefile.am | 10 + + src/org.gnu.aeskulap.gschema.xml | 76 ++++++ + 10 files changed, 512 insertions(+), 28 deletions(-) + create mode 100644 configuration/aconfiguration-gsettings.cpp + create mode 100644 src/org.gnu.aeskulap.gschema.xml + +--- a/configuration/Makefile.am ++++ b/configuration/Makefile.am +@@ -4,12 +4,19 @@ + lib_LTLIBRARIES = libconfiguration.la + endif + ++if USE_MINGW ++extra_SOURCES=aconfiguration-win32.cpp ++else ++extra_SOURCES=aconfiguration-gsettings.cpp ++endif ++ + libconfiguration_la_SOURCES = \ + awindowlevel.h \ + aconfiguration.h \ + aconfiguration.cpp \ + aconfigclient.h \ +- aconfigclient.cpp ++ aconfigclient.cpp \ ++ $(extra_SOURCES) + + libconfiguration_la_LIBADD = \ + $(GCONFMM_LIBS) \ +@@ -23,6 +30,5 @@ + $(GTKMM_CFLAGS) + + EXTRA_DIST = \ +- aconfiguration-gconf.cpp \ +- aconfiguration-win32.cpp +- ++ aconfiguration-gsettings.cpp \ ++ aconfiguration-gconf.cpp +--- a/configuration/aconfiguration-gconf.cpp ++++ b/configuration/aconfiguration-gconf.cpp +@@ -22,6 +22,7 @@ + #include <gconfmm.h> + #include <cstdio> + #include <iostream> ++#include "aconfiguration.h" + + namespace Aeskulap { + +--- /dev/null ++++ b/configuration/aconfiguration-gsettings.cpp +@@ -0,0 +1,369 @@ ++/* ++ Aeskulap Configuration - persistent configuration interface library ++ Copyright (C) 2005 Alexander Pipelka ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License as published by the Free Software Foundation; either ++ version 2 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public ++ License along with this library; if not, write to the Free ++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ ++ Alexander Pipelka ++*/ ++ ++#include <giomm.h> ++#include <glibmm.h> ++#include <cstdio> ++#include <iostream> ++#include "aconfiguration.h" ++ ++namespace Aeskulap { ++ ++using Gio::Settings; ++using PSettings = Glib::RefPtr<Settings>; ++ ++struct ConfigurationImpl { ++ ++ ConfigurationImpl(); ++ ++ PSettings settings_prefs; ++ PSettings settings_presets; ++ ++ bool has_modality(const Glib::ustring& modality); ++}; ++ ++ConfigurationImpl::ConfigurationImpl(): ++ settings_prefs(Settings::create("org.gnu.aeskulap")), ++ settings_presets(Settings::create("org.gnu.aeskulap.presets")) ++{ ++ ++} ++ ++bool ConfigurationImpl::has_modality(const Glib::ustring& modality) ++{ ++ auto children = settings_presets->list_children(); ++ bool has_modality = false; ++ for (auto c = children.begin(); !has_modality && c != children.end(); ++c) ++ has_modality = (*c == modality); ++ return has_modality; ++} ++ ++Configuration::Configuration() { ++ std::cout << "Gio::Settings init" << std::endl; ++ Gio::init(); ++ ++ impl = new ConfigurationImpl(); ++ ++ if (!impl->has_modality("CT")) ++ add_default_presets_ct(); ++} ++ ++std::string Configuration::get_local_aet() { ++ ++ Glib::ustring local_aet = impl->settings_prefs->get_string("local-aet"); ++ ++ if(local_aet.empty()) { ++ local_aet = "AESKULAP"; ++ set_local_aet(local_aet); ++ } ++ ++ return std::string(local_aet.c_str()); ++} ++ ++void Configuration::set_local_aet(const std::string& aet) { ++ impl->settings_prefs->set_string("local-aet", aet); ++} ++ ++unsigned int Configuration::get_local_port() { ++ ++ gint local_port = impl->settings_prefs->get_int("local-port"); ++ ++ if(local_port <= 0) { ++ local_port = 6000; ++ set_local_port(local_port); ++ } ++ ++ return (unsigned int)local_port; ++} ++ ++void Configuration::set_local_port(unsigned int port) { ++ if(port <= 0) { ++ port = 6000; ++ } ++ impl->settings_prefs->set_int("local-port", (gint)port); ++} ++ ++std::string Configuration::get_encoding() { ++ Glib::ustring charset = impl->settings_prefs->get_string("characterset"); ++ ++ if(charset.empty()) { ++ charset = "ISO_IR 100"; ++ set_encoding(charset); ++ } ++ ++ return charset.c_str(); ++} ++ ++void Configuration::set_encoding(const std::string& encoding) { ++ impl->settings_prefs->set_string("characterset", encoding); ++} ++ ++std::vector<int> convert_to_int_array(const std::vector<Glib::ustring>& in) { ++ std::vector<int> result(in.size()); ++ ++ transform(in.begin(), in.end(), result.begin(), [](const Glib::ustring& x) { ++ std::istringstream s(x.c_str()); ++ int o; ++ s >> o; ++ return o; ++ }); ++ return result; ++} ++ ++std::vector<bool> convert_to_bool_array(const std::vector<Glib::ustring>& in) { ++ std::vector<bool> result(in.size()); ++ ++ transform(in.begin(), in.end(), result.begin(), [](const Glib::ustring& x) { ++ return x == "true"; ++ }); ++ return result; ++} ++ ++ ++Configuration::ServerList* Configuration::get_serverlist() { ++ Configuration::ServerList* list = new Configuration::ServerList; ++ ++ std::vector<Glib::ustring> aet_list = impl->settings_prefs->get_string_array("server-aet"); ++ std::vector<int> port_list = convert_to_int_array(impl->settings_prefs->get_string_array("server-port")); ++ std::vector<Glib::ustring> hostname_list = impl->settings_prefs->get_string_array("server-hostname"); ++ std::vector<Glib::ustring> description_list = impl->settings_prefs->get_string_array("server-description"); ++ std::vector<Glib::ustring> group_list = impl->settings_prefs->get_string_array("server-group"); ++ std::vector<bool> lossy_list = convert_to_bool_array(impl->settings_prefs->get_string_array("server-lossy")); ++ std::vector<bool> relational_list = convert_to_bool_array(impl->settings_prefs->get_string_array("server-relational")); ++ ++ auto a = aet_list.begin(); ++ auto p = port_list.begin(); ++ auto h = hostname_list.begin(); ++ auto d = description_list.begin(); ++ auto g = group_list.begin(); ++ auto l = lossy_list.begin(); ++ auto r = relational_list.begin(); ++ ++ for(; h != hostname_list.end() && a != aet_list.end() && p != port_list.end(); a++, p++, h++) { ++ ++ std::string servername; ++ if(d != description_list.end()) { ++ servername = *d; ++ d++; ++ } ++ else { ++ char buffer[50]; ++ snprintf(buffer, sizeof(buffer), "Server%li", list->size()+1); ++ servername = buffer; ++ } ++ ++ ServerData& s = (*list)[servername]; ++ s.m_aet = *a; ++ s.m_port = *p; ++ s.m_hostname = *h; ++ s.m_name = servername; ++ s.m_lossy = false; ++ s.m_relational = false; ++ ++ if(g != group_list.end()) { ++ s.m_group = *g; ++ g++; ++ } ++ ++ if ( l != lossy_list.end()) { ++ s.m_lossy = *l; ++ ++l; ++ } ++ ++ if(r != relational_list.end()) { ++ s.m_relational = *r; ++ r++; ++ } ++ ++ } ++ ++ return list; ++} ++ ++void Configuration::set_serverlist(std::vector<ServerData>& list) { ++ ++ std::vector<Glib::ustring> aet_list; ++ std::vector<Glib::ustring> hostname_list; ++ std::vector<Glib::ustring> port_list; ++ std::vector<Glib::ustring> description_list; ++ std::vector<Glib::ustring> group_list; ++ std::vector<Glib::ustring> lossy_list; ++ std::vector<Glib::ustring> relational_list; ++ ++ std::vector<ServerData>::iterator i; ++ for(i = list.begin(); i != list.end(); i++) { ++ aet_list. push_back(i->m_aet); ++ hostname_list.push_back(i->m_hostname); ++ port_list.push_back( Glib::ustring::compose("%d", i->m_port)); ++ description_list.push_back(i->m_name); ++ group_list.push_back(i->m_group); ++ lossy_list.push_back(i->m_lossy ? "true": "false"); ++ relational_list.push_back(i->m_relational ? "true": "false"); ++ } ++ ++ impl->settings_prefs->set_string_array("server-aet", aet_list); ++ impl->settings_prefs->set_string_array("server-hostname", hostname_list); ++ impl->settings_prefs->set_string_array("server-port", port_list); ++ impl->settings_prefs->set_string_array("server-description", description_list); ++ impl->settings_prefs->set_string_array("server-group", group_list); ++ impl->settings_prefs->set_string_array("server-lossy", lossy_list); ++ impl->settings_prefs->set_string_array("server-relational", relational_list); ++} ++ ++bool Configuration::get_windowlevel(const Glib::ustring& modality, const Glib::ustring& desc, WindowLevel& w) { ++ ++ auto modality_settings = impl->settings_presets->get_child(modality); ++ if (!modality_settings) { ++ g_warning("Modality %s not found", modality.c_str()); ++ return false; ++ } ++ ++ auto tissue_settings = modality_settings->get_child(desc); ++ if (!tissue_settings) { ++ g_warning("tissue setting for %s not found in %s", desc.c_str(), modality.c_str()); ++ return false; ++ } ++ ++ w.modality = modality; ++ w.description = desc; ++ w.center = tissue_settings->get_int("center"); ++ w.width = tissue_settings->get_int("width"); ++ ++ return true; ++} ++ ++static PSettings get_child_tree(PSettings settings, const Glib::ustring& key, const Glib::ustring& scheme) ++{ ++ std::string pp = settings->property_path(); ++ pp.append(key).append("/"); ++ g_message("Get child tree at %s", pp.c_str()); ++ return Settings::create(scheme, pp); ++} ++ ++ ++bool Configuration::get_windowlevel_list(const Glib::ustring& modality, WindowLevelList& list) { ++ ++ if(modality.empty()) { ++ g_warning("No modality given"); ++ return false; ++ } ++ ++ std::vector<Glib::ustring> supported_modalities = impl->settings_presets->get_string_array("modalities"); ++ auto m = find(supported_modalities.begin(), supported_modalities.end(), modality); ++ if (m == supported_modalities.end()) { ++ g_warning("Modality %s not found in presets", modality.c_str()); ++ return false; ++ } ++ ++ auto modality_settings = get_child_tree(impl->settings_presets, modality, "org.gnu.aeskulap.presets.modality"); ++ ++ std::vector<Glib::ustring> supported_tissues = modality_settings->get_string_array("tissue-types"); ++ ++ for(const auto& tissue: supported_tissues) { ++ WindowLevel w; ++ w.modality = modality; ++ w.description = tissue; ++ ++ auto tissue_settings = get_child_tree(modality_settings, tissue, "org.gnu.aeskulap.presets.modality.tissue"); ++ ++ w.center = tissue_settings->get_int("center"); ++ w.width = tissue_settings->get_int("width"); ++ list[tissue] = w; ++ } ++ return true; ++} ++ ++bool Configuration::set_windowlevel(const WindowLevel& w) { ++ ++ std::vector<Glib::ustring> supported_modalities = impl->settings_presets->get_string_array("modalities"); ++ if (find(supported_modalities.begin(), supported_modalities.end(), w.modality) == supported_modalities.end()) { ++ supported_modalities.push_back(w.modality); ++ impl->settings_presets->set_string_array("modalities", supported_modalities); ++ } ++ ++ auto modality_settings = get_child_tree(impl->settings_presets, w.modality, "org.gnu.aeskulap.presets.modality"); ++ std::vector<Glib::ustring> tissues = modality_settings->get_string_array("tissue-types"); ++ ++ if (find(tissues.begin(), tissues.end(), w.description) == tissues.end()) { ++ tissues.push_back(w.description); ++ modality_settings->set_string_array("tissue-types", tissues); ++ } ++ ++ auto tissue_settings = get_child_tree(modality_settings, w.description, "org.gnu.aeskulap.presets.modality.tissue"); ++ ++ tissue_settings->set_int("center", w.center); ++ tissue_settings->set_int("width", w.width); ++ ++ return true; ++} ++ ++ ++ ++bool Configuration::set_windowlevel_list(const Glib::ustring& modality, WindowLevelList& list) { ++ ++ std::vector<Glib::ustring> supported_modalities = impl->settings_presets->get_string_array("modalities"); ++ if (find(supported_modalities.begin(), supported_modalities.end(), modality) == supported_modalities.end()) { ++ supported_modalities.push_back(modality); ++ impl->settings_presets->set_string_array("modalities", supported_modalities); ++ } ++ ++ ++ auto modality_settings = get_child_tree(impl->settings_presets, modality, "org.gnu.aeskulap.presets.modality"); ++ std::vector<Glib::ustring> tissues = modality_settings->get_string_array("tissue-types"); ++ ++ ++ for(auto i = list.begin(); i != list.end(); i++) { ++ auto& t = i->second.description; ++ if (find(tissues.begin(), tissues.end(), t) == tissues.end()) ++ tissues.push_back(t); ++ ++ i->second.modality = modality; ++ ++ auto tissue_settings = get_child_tree(modality_settings, t, "org.gnu.aeskulap.presets.modality.tissue"); ++ ++ tissue_settings->set_int("center", i->second.center); ++ tissue_settings->set_int("width", i->second.width); ++ } ++ modality_settings->set_string_array("tissue-types", tissues); ++ ++ return true; ++} ++ ++bool Configuration::unset_windowlevels(const Glib::ustring& modality) { ++ ++ std::vector<Glib::ustring> supported_modalities = impl->settings_presets->get_string_array("modalities"); ++ auto m = find(supported_modalities.begin(), supported_modalities.end(), modality); ++ if (m == supported_modalities.end()) ++ return true; ++ ++ auto modality_settings = get_child_tree(impl->settings_presets, modality, "org.gnu.aeskulap.presets.modality"); ++ std::vector<Glib::ustring> tissues = modality_settings->get_string_array("tissue-types"); ++ ++ for (auto& t: tissues) { ++ auto tissue_settings = get_child_tree(modality_settings, t, "org.gnu.aeskulap.presets.modality.tissue"); ++ tissue_settings->reset("center"); ++ tissue_settings->reset("width"); ++ } ++ ++ return true; ++} ++ ++} // namespace Aeskulap +--- a/configuration/aconfiguration-win32.cpp ++++ b/configuration/aconfiguration-win32.cpp +@@ -24,6 +24,7 @@ + #include <iostream> + #include <string> + #include <list> ++#include "aconfiguration.h" + + + namespace Aeskulap { +--- a/configuration/aconfiguration.cpp ++++ b/configuration/aconfiguration.cpp +@@ -21,6 +21,7 @@ + + #include "aconfiguration.h" + #include "gettext.h" ++#include <config.h> + + namespace Aeskulap { + +@@ -66,18 +67,3 @@ + + } // namespace Aeskulap + +- +-#ifdef WIN32 +- +-// WIN32 configuration backend +- +-#include "aconfiguration-win32.cpp" +- +-#else +- +-// gconf configuration backend +- +-#include "aconfiguration-gconf.cpp" +- +-#endif +- +--- a/configuration/aconfiguration.h ++++ b/configuration/aconfiguration.h +@@ -26,6 +26,7 @@ + #include <string> + #include <map> + #include <vector> ++#include <config.h> + + #include "awindowlevel.h" + +@@ -74,8 +75,6 @@ + + void set_encoding(const std::string& encoding); + +- bool get_windowlevel(const Glib::ustring& modality, const Glib::ustring& desc, WindowLevel& w); +- + bool get_windowlevel_list(const Glib::ustring& modality, WindowLevelList& list); + + bool set_windowlevel(const WindowLevel& w); +@@ -89,10 +88,16 @@ + Configuration(); + + private: ++ bool get_windowlevel(const Glib::ustring& modality, const Glib::ustring& desc, WindowLevel& w); ++ + + // internal helper (backend independend) functions + Glib::ustring get_name_from_path(const Glib::ustring& path); + ++#ifdef HAVE_GSETTINGS ++ struct ConfigurationImpl *impl; ++#endif ++ + }; + + } // namespace Aeskulap +--- a/configure.ac ++++ b/configure.ac +@@ -40,8 +40,6 @@ + AC_SUBST(GMSGFMT) + fi + +-AM_GCONF_SOURCE_2 +- + dnl + dnl gettext package + dnl +@@ -82,18 +80,19 @@ + AC_SUBST(GTHREAD_CFLAGS) + AC_SUBST(GTHREAD_LIBS) + ++ ++AM_CONDITIONAL(USE_MINGW, test "x$MINGW32" = "xyes") ++ + if test x"$MINGW32" = xno ; then + +-PKG_CHECK_MODULES(GCONFMM, gconfmm-2.6 >= 2.10.0) +-AC_SUBST(GCONFMM_CFLAGS) +-AC_SUBST(GCONFMM_LIBS) +- +-AC_PATH_PROG(GCONFTOOL, gconftool-2, no) +-if test x"$GCONFTOOL" = xno ; then +- AC_MSG_ERROR([gconftool2 executable not found in your path - should be +-installed with GConf]) +-fi ++GLIB_GSETTINGS ++HAVE_GSETTINGS=1 + ++AC_SUBST(HAVE_GSETTINGS) ++AC_DEFINE(HAVE_GSETTINGS, 1, [use gsettings configuration backend]) ++AM_CONDITIONAL(USE_GSETTINGS, test "x$with_gsettings" = "xyes") ++ ++dnl not WIN32 + fi + + +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -43,21 +43,13 @@ + $(GTKMM_LIBS) \ + $(GLADEMM_LIBS) \ + $(GTHREAD_LIBS) \ +- $(GCONFMM_LIBS) \ + $(DCMTK_LIBS) + +-if BUILD_NOT_MINGW32 ++# gsettings_SCHEMAS is a list of all the schemas you want to install ++gsettings_SCHEMAS = org.gnu.aeskulap.gschema.xml + +-schemadir = @GCONF_SCHEMA_FILE_DIR@ +-schema_DATA = aeskulap.schemas +- +-@INTLTOOL_SCHEMAS_RULE@ +- +-if GCONF_SCHEMAS_INSTALL +-install-data-local: +- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(schema_DATA) +-endif +-endif ++# include the appropriate makefile rules for schema handling ++@GSETTINGS_RULES@ + + AM_CPPFLAGS = \ + -DAESKULAP_DATADIR=\""$(datadir)"\" \ +--- /dev/null ++++ b/src/org.gnu.aeskulap.gschema.xml +@@ -0,0 +1,76 @@ ++<schemalist> ++ <schema id="org.gnu.aeskulap" path="/org/gnu/aeskulap/settings/"> ++ <key name="local-aet" type="s"> ++ <default>'AESKULAP'</default> ++ <summary>Local DICOM AET</summary> ++ <description>Defines the Application Entity Title of Aeskulap for network communication.</description> ++ </key> ++ <key name="local-port" type="i"> ++ <default>6000</default> ++ <summary>Local DICOM port</summary> ++ <description>Defines the TCP/IP port for network communication.</description> ++ </key> ++ <key name="characterset" type="s"> ++ <default>'ISO_IR 100'</default> ++ <summary>Specific CharacterSet</summary> ++ <description>Defines the DICOM character set to use</description> ++ </key> ++ <key name="server-aet" type="as"> ++ <default>[ 'ARCHIV' ]</default> ++ <summary>List of remote server AET's</summary> ++ <description>This is a list of all available remote DICOM server AET's.</description> ++ </key> ++ <key name="server-port" type="as"> ++ <default>[ '6100' ]</default> ++ <summary>List of remote server ports</summary> ++ <description>This is a list of all available remote DICOM server ports.</description> ++ </key> ++ <key name="server-hostname" type="as"> ++ <default>[ 'shuttle' ]</default> ++ <summary>List of remote server hostnames</summary> ++ <description>This is a list of all available remote DICOM server hostnames.</description> ++ </key> ++ <key name="server-description" type="as"> ++ <default>[ 'example server' ]</default> ++ <summary>Description of the server </summary> ++ <description>This is a list of the descriptions of the available remote DICOM servers.</description> ++ </key> ++ <key name="server-group" type="as"> ++ <default>[ 'example group' ]</default> ++ <summary>Server group</summary> ++ <description>Group this servers belongs to.</description> ++ </key> ++ <key name="server-lossy" type="as"> ++ <default>[ 'false' ]</default> ++ <summary>Prefer lossy jpeg</summary> ++ <description>Prefer lossy jpeg</description> ++ </key> ++ <key name="server-relational" type="as"> ++ <default>[ 'false' ]</default> ++ <summary>Support relational requests.</summary> ++ <description>Support relational requests</description> ++ </key> ++ </schema> ++ <schema id="org.gnu.aeskulap.presets" path="/org/gnu/aeskulap/presets/"> ++ <key name="modalities" type="as"> ++ <default>[]</default> ++ <summary>Modality names stored.</summary> ++ </key> ++ </schema> ++ <schema id="org.gnu.aeskulap.presets.modality"> ++ <key name="tissue-types" type="as"> ++ <default>[]</default> ++ <summary>Tissue types stored.</summary> ++ </key> ++ </schema> ++ <schema id="org.gnu.aeskulap.presets.modality.tissue"> ++ <key name="center" type="i"> ++ <default>128</default> ++ <summary>Tissue center intensity.</summary> ++ </key> ++ <key name="width" type="i"> ++ <default>128</default> ++ <summary>Tissue intensity width.</summary> ++ </key> ++ </schema> ++</schemalist> diff --git a/debian/patches/series b/debian/patches/series index ef4e039..2d0b6e6 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ po_makefile.patch desktop-file.patch remove-ignore-typedef.patch newDicomElement.patch +GSettings-configuratio-storage.patch -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/aeskulap.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
