[Digikam-devel] extragear/graphics/digikam/utilities/setup

Gilles Caulier caulier.gilles at free.fr
Thu Jun 22 21:24:37 BST 2006


SVN commit 553996 by cgilles:

digikam from trunk : Setup ICC support now by default all ICC color-space profiles files included in digiKam.
CCMAIL: digikam-devel at kde.org


 M  +51 -36    setupicc.cpp  
 M  +2 -0      setupicc.h  


--- trunk/extragear/graphics/digikam/utilities/setup/setupicc.cpp #553995:553996
@@ -36,7 +36,6 @@
 #include <qpixmap.h>
 #include <qpushbutton.h>
 #include <qstringlist.h>
-#include <qdir.h>
 #include <qmap.h>
 #include <qtooltip.h>
 
@@ -415,7 +414,6 @@
     if (!d->enableColorManagement->isChecked())
         return;
 
-    cmsHPROFILE tmpProfile=0;
     d->inProfilesKC->clear();
     d->monitorProfilesKC->clear();
     d->workProfilesKC->clear();
@@ -437,10 +435,57 @@
     }    
     d->mainDialog->enableButtonOK(true);
 
-    QDir profilesDir(QFile::encodeName(path), "*.icc;*.icm", QDir::Files);
-    const QFileInfoList* files = profilesDir.entryInfoList();
-    bool findIccFiles = false;    
+    // Look the ICC profile path repository set by user.
+    QDir userProfilesDir(QFile::encodeName(path), "*.icc;*.icm", QDir::Files);
+    const QFileInfoList* usersFiles = userProfilesDir.entryInfoList();
+    kdDebug() << "Scanning ICC profiles from user repository: " << path << endl;
 
+    if ( !parseProfilesfromDir(usersFiles) )
+    {
+        if (report)
+        {
+            QString message = i18n("<p>Sorry, there is no ICC profiles files in ");
+            message.append(path);
+            message.append(i18n("</p>"));
+            KMessageBox::sorry(this, message);
+        }
+        
+        kdDebug() << "No ICC profile files found!!!" << endl;
+        d->mainDialog->enableButtonOK(false);
+        return;
+    }
+
+    // Look the ICC color-space profile path include with digiKam dist.
+    KGlobal::dirs()->addResourceType("profiles", KGlobal::dirs()->kde_default("data") + "digikam/profiles");
+    QString digiKamProfilesPath = KGlobal::dirs()->findResourceDir("profiles", "srgb.icm");
+    QDir digiKamProfilesDir(QFile::encodeName(digiKamProfilesPath), "*.icc;*.icm", QDir::Files);
+    const QFileInfoList* digiKamFiles = digiKamProfilesDir.entryInfoList();
+    kdDebug() << "Scanning ICC profiles include with digiKam: " << digiKamProfilesPath << endl;
+    parseProfilesfromDir(digiKamFiles);
+
+    d->inProfilesKC->insertStringList(d->inICCPath.keys(), 0);
+    
+    d->monitorProfilesKC->insertStringList(d->monitorICCPath.keys(), 0);
+    if (d->monitorICCPath.keys().isEmpty())
+    {
+        d->managedView->setEnabled(false);
+        d->managedView->setChecked(false);
+    }
+    else
+    {
+        d->managedView->setEnabled(true);
+    }
+    
+    d->workProfilesKC->insertStringList(d->workICCPath.keys(), 0);
+    
+    d->proofProfilesKC->insertStringList(d->proofICCPath.keys(), 0);
+}
+
+bool SetupICC::parseProfilesfromDir(const QFileInfoList* files)
+{
+    cmsHPROFILE tmpProfile=0;
+    bool findIccFiles=false;
+
     if (files)
     {
         QFileInfoListIterator it(*files);
@@ -524,38 +569,8 @@
             ++it;
         }
     }
-
-    if (!findIccFiles)
-    {
-        if (report)
-        {
-            QString message = i18n("<p>Sorry, there is no ICC profiles files in ");
-            message.append(path);
-            message.append(i18n("</p>"));
-            KMessageBox::sorry(this, message);
-        }
-        
-        kdDebug() << "No ICC profile files found!!!" << endl;
-        d->mainDialog->enableButtonOK(false);
-        return;
-    }
-
-    d->inProfilesKC->insertStringList(d->inICCPath.keys(), 0);
     
-    d->monitorProfilesKC->insertStringList(d->monitorICCPath.keys(), 0);
-    if (d->monitorICCPath.keys().isEmpty())
-    {
-        d->managedView->setEnabled(false);
-        d->managedView->setChecked(false);
-    }
-    else
-    {
-        d->managedView->setEnabled(true);
-    }
-    
-    d->workProfilesKC->insertStringList(d->workICCPath.keys(), 0);
-    
-    d->proofProfilesKC->insertStringList(d->proofICCPath.keys(), 0);
+    return findIccFiles;
 }
 
 void SetupICC::slotToggledWidgets(bool t)
--- trunk/extragear/graphics/digikam/utilities/setup/setupicc.h #553995:553996
@@ -27,6 +27,7 @@
 
 #include <qwidget.h>
 #include <qmap.h>
+#include <qdir.h>
 
 class KDialogBase;
 
@@ -54,6 +55,7 @@
     void disableWidgets();
     void profileInfo(const QString&);
     void restoreSettings();
+    bool parseProfilesfromDir(const QFileInfoList* files);
 
 private slots:
 



More information about the Digikam-devel mailing list