[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kolor-manager/v2v4] /: support v2 and v4 profiles depending on actual CMM
From:       Kai-Uwe Behrmann <ku.b () gmx ! de>
Date:       2015-05-08 20:40:06
Message-ID: E1Yqp42-0000na-PU () scm ! kde ! org
[Download RAW message or body]

Git commit 0d24af71c00ce24f151bc288a7f1c503e45c3150 by Kai-Uwe Behrmann.
Committed on 16/07/2014 at 15:17.
Pushed by behrmann into branch 'v2v4'.

support v2 and v4 profiles depending on actual CMM

M  +11   -2    devices/kmdevices.cpp
M  +2    -0    devices/kmdevices.h
M  +13   -3    information/kminfo.cpp
M  +1    -0    information/kminfo.h
M  +12   -4    kolor-server/color-context.cpp
M  +1    -0    kolor-server/color-context.h
M  +9    -1    kolor-server/output.cpp
M  +1    -0    kolor-server/output.h
M  +10   -2    kolor-server/screen.cpp
M  +1    -0    kolor-server/screen.h
M  +14   -2    settings/kmsettings.cpp
M  +1    -0    settings/kmsettings.h

http://commits.kde.org/kolor-manager/0d24af71c00ce24f151bc288a7f1c503e45c3150

diff --git a/devices/kmdevices.cpp b/devices/kmdevices.cpp
index ccc9b05..b296633 100644
--- a/devices/kmdevices.cpp
+++ b/devices/kmdevices.cpp
@@ -49,6 +49,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <oyranos.h>
 #include <oyranos_icc.h>
 #include <oyranos_devices.h>
+#include <oyFilterNode_s.h>
 #include <oyProfiles_s.h>
 #include <oyObject_s.h>
 
@@ -83,7 +84,7 @@ kmdevices::kmdevices(QWidget *parent, const QVariantList &) :
     );
     about->addAuthor( ki18n("2008-2009 Joseph Simon III"), KLocalizedString(),
                      "j.simon.iii@astound.net" );
-    about->addAuthor( ki18n("2010-2013 Kai-Uwe Behrmann"), KLocalizedString(),
+    about->addAuthor( ki18n("2010-2014 Kai-Uwe Behrmann"), KLocalizedString(),
                       "ku.b@gmx.de"  );
     about->addAuthor( ki18n("2012 Jan Gruhlich"), KLocalizedString(),
                       "ku.b@gmx.de"  );
@@ -96,6 +97,14 @@ kmdevices::kmdevices(QWidget *parent, const QVariantList &) :
 
     listModified = false;       // avoid action on signals
 
+    /* select profiles matching actual capabilities */
+    char * pattern = oyGetCMMPattern( oyCMM_CONTEXT, 0, malloc );
+    oyFilterNode_s * node = oyFilterNode_NewWith( pattern, NULL, 0 );
+    const char * reg = oyFilterNode_GetRegistration( node );
+    icc_profile_flags = oyICCProfileSelectionFlagsFromRegistration( reg );
+    oyFilterNode_Release( &node );
+    free( pattern );
+
     setupUi(this);              // Load Gui.
 
     msgWidget->setCloseButtonVisible(false);
@@ -444,7 +453,7 @@ void \
                kmdevices::populateLocalProfileComboBox(icProfileClassSignature \
                deviceSigna
     profile = oyProfile_FromSignature( deviceSignature, oySIGNATURE_CLASS, 0 );
     oyProfiles_MoveIn( patterns, &profile, -1 );
 
-    iccs = oyProfiles_Create( patterns, 0 );
+    iccs = oyProfiles_Create( patterns, icc_profile_flags, 0 );
     oyProfiles_Release( &patterns );
 
     QString getProfileDescription;
diff --git a/devices/kmdevices.h b/devices/kmdevices.h
index 34aab08..f8be2be 100644
--- a/devices/kmdevices.h
+++ b/devices/kmdevices.h
@@ -152,6 +152,8 @@ private:
 
     bool listModified;                // Was the list changed by the user?
 
+    int icc_profile_flags;            // profile selection flags from oyProfile_s.h
+
     // Global string values for Oyranos device identification
     char * current_device_name;
     char * current_device_class;
diff --git a/information/kminfo.cpp b/information/kminfo.cpp
index d5c1e33..7ba50c5 100644
--- a/information/kminfo.cpp
+++ b/information/kminfo.cpp
@@ -51,6 +51,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <oyranos.h>
 #include <oyranos_config.h>
 #include <oyranos_devices.h>
+#include <oyFilterNode_s.h>
 
 // Code to provide KDE module functionality for color manager
 
@@ -130,12 +131,20 @@ kminfo::kminfo(QWidget *parent, const QVariantList &) :
     );
     about->addAuthor( ki18n("2008-2009 Joseph Simon III"), KLocalizedString(),
                      "j.simon.iii@astound.net" );
-    about->addAuthor( ki18n("2010-2013 Kai-Uwe Behrmann"), KLocalizedString(),
+    about->addAuthor( ki18n("2010-2014 Kai-Uwe Behrmann"), KLocalizedString(),
                       "ku.b@gmx.de"  );
 
     setAboutData( about );
     current_profile = 0;
 
+    /* select profiles matching actual capabilities */
+    char * pattern = oyGetCMMPattern( oyCMM_CONTEXT, 0, malloc );
+    oyFilterNode_s * node = oyFilterNode_NewWith( pattern, NULL, 0 );
+    const char * reg = oyFilterNode_GetRegistration( node );
+    icc_profile_flags = oyICCProfileSelectionFlagsFromRegistration( reg );
+    oyFilterNode_Release( &node );
+    free( pattern );
+
     setupUi(this);              // Load Gui.
 
     installedProfilesTree->setColumnWidth(0, 350);
@@ -351,6 +360,7 @@ void kminfo::populateDeviceProfiles( QTreeWidgetItem * \
deviceListTree )  error = oyOptions_SetFromText( &options,
                                        \
"//"OY_TYPE_STD"/config/icc_profile.x_color_region_target",  "yes", OY_CREATE_NEW );
+        oyOptions_SetFromInt( &options, "///icc_profile_flags", icc_profile_flags, \
0, OY_CREATE_NEW );  oyDeviceGetProfile( device, options, &p );
         oyOptions_Release( &options );
 
@@ -386,7 +396,7 @@ void kminfo::populateDeviceProfiles( QTreeWidgetItem * \
deviceListTree )  void kminfo::addProfileTreeItem( oyPROFILE_e profile_type, QString \
description,  QTreeWidgetItem * parent_item )
 {
-      oyProfile_s * profile = oyProfile_FromStd( profile_type, 0);
+      oyProfile_s * profile = oyProfile_FromStd( profile_type, icc_profile_flags, 0 \
                );
       const char * text = oyProfile_GetText( profile, oyNAME_DESCRIPTION );
 
       // Add new item.
@@ -447,7 +457,7 @@ void kminfo::populateDeviceProfileDescriptions(oyProfile_s * \
profile, bool valid  
         setDeviceClassTag(profile, deviceClassTagLabel);
 
-        QString profilePathName = oyProfile_GetFileName( profile, 0 );
+        QString profilePathName = oyProfile_GetFileName( profile, -1 );
         directoryListingTag->setText(profilePathName);
 
         oyProfile_Release( &current_profile );
diff --git a/information/kminfo.h b/information/kminfo.h
index 3f3e07d..d4b4d6f 100644
--- a/information/kminfo.h
+++ b/information/kminfo.h
@@ -123,6 +123,7 @@ private:
 
      QTemporaryFile m_tempFile;
 
+     int icc_profile_flags;              ///< profile selection flags from \
oyProfile_s.h  };
 
 #endif
diff --git a/kolor-server/color-context.cpp b/kolor-server/color-context.cpp
index a5ebd69..9e858dc 100644
--- a/kolor-server/color-context.cpp
+++ b/kolor-server/color-context.cpp
@@ -47,6 +47,14 @@ ColorContext::ColorContext()
     , m_dstProfile(NULL)
 {
     buildDummyClut(m_clut);
+    /* select profiles matching actual capabilities */
+    char * pattern = oyGetCMMPattern( oyCMM_CONTEXT, 0, malloc );
+    oyFilterNode_s * node = oyFilterNode_NewWith( pattern, NULL, 0 );
+    const char * reg = oyFilterNode_GetRegistration( node );
+    icc_profile_flags = oyICCProfileSelectionFlagsFromRegistration( reg );
+    oyFilterNode_Release( &node );
+    free( pattern );
+
 }
 
 ColorContext::~ColorContext()
@@ -92,7 +100,7 @@ void ColorContext::setupColorLookupTable(bool advanced)
     oyOptions_s *options = 0;
 
     if (!m_dstProfile)
-        m_dstProfile = dummyProfile = oyProfile_FromStd(oyASSUMED_WEB, 0);
+        m_dstProfile = dummyProfile = oyProfile_FromStd(oyASSUMED_WEB, \
icc_profile_flags, 0);  
     /* skip dummyProfile to dummyProfile conversion */
     if (!m_srcProfile && dummyProfile) {
@@ -102,7 +110,7 @@ void ColorContext::setupColorLookupTable(bool advanced)
     }
 
     if (!m_srcProfile) {
-        m_srcProfile = oyProfile_FromStd(oyASSUMED_WEB, 0);
+        m_srcProfile = oyProfile_FromStd(oyASSUMED_WEB, icc_profile_flags, 0);
         if (!m_srcProfile) {
             kError() << "Output" << m_outputName << ":" << "no assumed dummyProfile \
source profile";  kWarning() << "Output" << m_outputName << "using dummy clut";
@@ -224,7 +232,7 @@ void ColorContext::setup(const QString &name)
     if (!Display::getInstance()->colorDesktopActivated())
         return;
 
-    m_srcProfile = oyProfile_FromStd(oyASSUMED_WEB, 0);
+    m_srcProfile = oyProfile_FromStd(oyASSUMED_WEB, icc_profile_flags, 0);
     m_outputName = name;
     if (!m_srcProfile)
         kWarning() << "Output" << name << "no sRGB source profile";
@@ -249,7 +257,7 @@ bool ColorContext::getDeviceProfile(oyConfig_s *device)
     if (m_dstProfile) {
         /* check that no sRGB is delivered */
         if (error) {
-            oyProfile_s *dummyProfile = oyProfile_FromStd(oyASSUMED_WEB, 0);
+            oyProfile_s *dummyProfile = oyProfile_FromStd(oyASSUMED_WEB, \
icc_profile_flags, 0);  if (oyProfile_Equal(dummyProfile, m_dstProfile)) {
                 kWarning() << "Output" << m_outputName << "ignoring fallback, error" \
<< error;  oyProfile_Release(&m_dstProfile);
diff --git a/kolor-server/color-context.h b/kolor-server/color-context.h
index 8a8d991..486b299 100644
--- a/kolor-server/color-context.h
+++ b/kolor-server/color-context.h
@@ -114,6 +114,7 @@ private:
     oyProfile_s *m_srcProfile;          ///< the data profile or device link
     oyProfile_s *m_dstProfile;          ///< the monitor profile or none
     QString m_outputName;               ///< the intended output device
+    int icc_profile_flags;              ///< profile selection flags from \
oyProfile_s.h  
     /// Color lookup table (for color conversion)
     Clut m_clut;
diff --git a/kolor-server/output.cpp b/kolor-server/output.cpp
index 55d5cdc..b0bf4eb 100644
--- a/kolor-server/output.cpp
+++ b/kolor-server/output.cpp
@@ -34,6 +34,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "screen.h"
 
 #include <oyranos_devices.h>
+#include <oyFilterNode_s.h>
 #include <oyRectangle_s.h>
 
 namespace KolorServer
@@ -47,6 +48,13 @@ ColorOutput::ColorOutput(Screen *parent, int index)
     : m_parent(parent)
     , m_index(index)
 {
+    /* select profiles matching actual capabilities */
+    char * pattern = oyGetCMMPattern( oyCMM_CONTEXT, 0, malloc );
+    oyFilterNode_s * node = oyFilterNode_NewWith( pattern, NULL, 0 );
+    const char * reg = oyFilterNode_GetRegistration( node );
+    icc_profile_flags = oyICCProfileSelectionFlagsFromRegistration( reg );
+    oyFilterNode_Release( &node );
+    free( pattern );
 }
 
 ColorOutput::~ColorOutput()
@@ -251,7 +259,7 @@ void ColorOutput::moveProfileAtoms(bool init)
         if (init) {
             /* setup the OY_ICC_V0_3_TARGET_PROFILE_IN_X_BASE(_xxx) atom as document \
colour space */  size_t size = 0;
-            oyProfile_s *screenDocumentProfile = oyProfile_FromStd(oyASSUMED_WEB, \
0); +            oyProfile_s *screenDocumentProfile = \
oyProfile_FromStd(oyASSUMED_WEB, icc_profile_flags, 0);  
             if (screenDocumentProfile) {
                 // Make sure the profile is ignored
diff --git a/kolor-server/output.h b/kolor-server/output.h
index a93fbc7..6019284 100644
--- a/kolor-server/output.h
+++ b/kolor-server/output.h
@@ -145,6 +145,7 @@ private:
     QString m_name;
     ColorContext m_cc;
     QRect m_rect;
+    int icc_profile_flags;              ///< profile selection flags from \
oyProfile_s.h  };
 
 } // KolorServer namespace
diff --git a/kolor-server/screen.cpp b/kolor-server/screen.cpp
index 9a4bd52..1f0f0fb 100644
--- a/kolor-server/screen.cpp
+++ b/kolor-server/screen.cpp
@@ -36,7 +36,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "output.h"
 
 #include <oyranos_devices.h>
-
+#include <oyFilterNode_s.h>
 
 /**
  * Helper function to convert a MD5 into a readable string.
@@ -66,6 +66,14 @@ Screen::Screen(X11::Display *display, int number, Display *parent)
     , m_screen(number)
 {
     X11::setupXRandR(display, number);
+
+    /* select profiles matching actual capabilities */
+    char * pattern = oyGetCMMPattern( oyCMM_CONTEXT, 0, malloc );
+    oyFilterNode_s * node = oyFilterNode_NewWith( pattern, NULL, 0 );
+    const char * reg = oyFilterNode_GetRegistration( node );
+    icc_profile_flags = oyICCProfileSelectionFlagsFromRegistration( reg );
+    oyFilterNode_Release( &node );
+    free( pattern );
 }
 
 Screen::~Screen()
@@ -251,7 +259,7 @@ void Screen::updateProfileForAtom(const char *atomName, X11::Atom \
                atom)
         void *data = X11::fetchProperty(m_display, X11::rootWindow(m_display, 0), \
atom, XA_CARDINAL, &n, False);  if (data && n) {
             oyProfile_s *baseProfile = oyProfile_FromMem(n, data, 0,0);
-            oyProfile_s *dummyProfile = oyProfile_FromStd(oyASSUMED_WEB, 0); // sRGB
+            oyProfile_s *dummyProfile = oyProfile_FromStd(oyASSUMED_WEB, \
icc_profile_flags, 0); // sRGB  
             /* The distinction of sRGB profiles set by the server and ones
                 * coming from outside the colour server is rather fragile.
diff --git a/kolor-server/screen.h b/kolor-server/screen.h
index e1cca6f..1c5ed36 100644
--- a/kolor-server/screen.h
+++ b/kolor-server/screen.h
@@ -179,6 +179,7 @@ private:
     Display *m_parent;
     X11::Display *m_display;
     int m_screen;
+    int icc_profile_flags;              ///< profile selection flags from \
oyProfile_s.h  
     QList<ColorOutput*> m_outputs; // or contexts
 
diff --git a/settings/kmsettings.cpp b/settings/kmsettings.cpp
index 86c2dd7..21d20fd 100644
--- a/settings/kmsettings.cpp
+++ b/settings/kmsettings.cpp
@@ -50,6 +50,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <oyranos.h>
 #include <oyranos_config.h>
 #include <oyranos_devices.h>
+#include <oyFilterNode_s.h>
 #include <oyProfiles_s.h>
 #include <locale.h>
 
@@ -87,11 +88,19 @@ kmsettings::kmsettings(QWidget *parent, const QVariantList &) :
     );
     about->addAuthor( ki18n("2008-2009 Joseph Simon III"), KLocalizedString(),
                      "j.simon.iii@astound.net" );
-    about->addAuthor( ki18n("2010-2013 Kai-Uwe Behrmann"), KLocalizedString(),
+    about->addAuthor( ki18n("2010-2014 Kai-Uwe Behrmann"), KLocalizedString(),
                       "ku.b@gmx.de"  );
 
     setAboutData( about );
 
+    /* select profiles matching actual capabilities */
+    char * pattern = oyGetCMMPattern( oyCMM_CONTEXT, 0, malloc );
+    oyFilterNode_s * node = oyFilterNode_NewWith( pattern, NULL, 0 );
+    const char * reg = oyFilterNode_GetRegistration( node );
+    icc_profile_flags = oyICCProfileSelectionFlagsFromRegistration( reg );
+    oyFilterNode_Release( &node );
+    free( pattern );
+
    setupUi(this);              // Load Gui.
 
    removePolicyButton->setEnabled(false);
@@ -298,7 +307,7 @@ void kmsettings::fillProfileComboBoxes(oyPROFILE_e profile_type, \
QComboBox * pro  
     QString profile_text, profile_filename;
 
-    iccs = oyProfiles_ForStd( profile_type, &current, 0 );
+    iccs = oyProfiles_ForStd( profile_type, icc_profile_flags, &current, 0 );
 
     size = oyProfiles_Count(iccs);
     for( i = 0; i < size; ++i)
@@ -394,6 +403,9 @@ void kmsettings::selectPolicy(int rowIndex)
             changed(false);
      }
 
+     if(!selectedPolicyItem)
+       return;
+
      selected_policy = selectedPolicyItem->text();
 
      char * full_name = 0;
diff --git a/settings/kmsettings.h b/settings/kmsettings.h
index 029a926..e4a017c 100644
--- a/settings/kmsettings.h
+++ b/settings/kmsettings.h
@@ -142,6 +142,7 @@ private:
     // Variable to specify if current policy is a custom one.
     bool isCustom, settingsChanged;
 
+    int icc_profile_flags;              ///< profile selection flags from \
oyProfile_s.h  };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic