[Digikam-devel] extragear/graphics/digikam

Gilles Caulier caulier.gilles at free.fr
Thu Sep 7 08:50:13 BST 2006


SVN commit 581696 by cgilles:

digikam from trunk : ICC profiles repository at startup bugfix :

- Add new common static method on SetupIcc to perform icc repository validity check
- Showfoto have been forget to check icc repository at startup. Fixed.
- Fix to sync config to disk if icc management need to be disable.
- Using the setup() method available on digiKam/showfoto to start Setup instance in case of icc repository path is not valid.

CCMAIL: digikam-devel at kde.org

 M  +1 -1      digikam.kdevelop  
 M  +29 -17    digikam/digikamapp.cpp  
 M  +1 -0      digikam/digikamapp.h  
 M  +60 -16    showfoto/showfoto.cpp  
 M  +2 -1      showfoto/showfoto.h  
 M  +1 -1      utilities/imageeditor/editor/editorwindow.h  
 M  +3 -2      utilities/imageeditor/editor/imagewindow.cpp  
 M  +1 -1      utilities/imageeditor/editor/imagewindow.h  
 M  +21 -0     utilities/setup/setupicc.cpp  
 M  +2 -0      utilities/setup/setupicc.h  


--- trunk/extragear/graphics/digikam/digikam.kdevelop #581695:581696
@@ -112,7 +112,7 @@
     <run>
       <directoryradio>build</directoryradio>
       <customdirectory>/</customdirectory>
-      <mainprogram>digikam/showfoto/showfoto</mainprogram>
+      <mainprogram>digikam/digikam/digikam</mainprogram>
       <programargs></programargs>
       <terminal>false</terminal>
       <autocompile>false</autocompile>
--- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #581695:581696
@@ -75,6 +75,7 @@
 #include "setup.h"
 #include "setupplugins.h"
 #include "setupeditor.h"
+#include "setupicc.h"
 #include "setupimgplugins.h"
 #include "imagepluginloader.h"
 #include "imagewindow.h"
@@ -141,24 +142,19 @@
 
     applyMainWindowSettings(m_config);
 
-    // Check ICC profiles repository
+    // Check ICC profiles repository availability
+
     if(mSplash)
         mSplash->message(i18n("Checking ICC repository"), AlignLeft, white);
 
-    m_config->setGroup("Color Management");
-    QDir tmpPath(m_config->readPathEntry("DefaultPath", QString::null));
-    if (!tmpPath.exists())
-    {
-        mValidIccPath = false;
-    }
-    kdDebug() << "ICC profiles repository is: " << tmpPath.dirName() << endl;
+    mValidIccPath = SetupICC::iccRepositoryIsValid();
 
     // Check witch dcraw version available
 
     if(mSplash)
         mSplash->message(i18n("Checking dcraw version"), AlignLeft, white);
 
-    Digikam::DcrawBinary::instance()->checkSystem();
+    DcrawBinary::instance()->checkSystem();
 
     // Actual file scanning is done in main() - is this necessary here?
     mAlbumManager->setLibraryPath(mAlbumSettings->getAlbumLibraryPath());
@@ -219,6 +215,7 @@
 void DigikamApp::show()
 {
     // Remove Splashscreen.
+
     if(mSplash)
     {
         mSplash->finish(this);
@@ -226,31 +223,39 @@
         mSplash = 0;
     }
 
+    // Display application window.
+
     KMainWindow::show();
 
     // Report errors from ICC repository path.
+
     if(!mValidIccPath)
     {
         QString message = i18n("<qt><p>ICC profiles path seems to be invalid.</p>"
                                "<p>If you want to set it now, select \"Yes\", otherwise "
                                "select \"No\". In this case, \"Color Management\" feature "
                                "will be disabled until you solve this issue</p></qt>");
-        int answer = KMessageBox::warningYesNo(this, message);
-        if (answer == KMessageBox::Yes)
+
+        if (KMessageBox::warningYesNo(this, message) == KMessageBox::Yes)
         {
-            Setup setup(this, 0, Setup::IccProfiles);
-            if (setup.exec() != QDialog::Accepted)
-            return;
+            if (!setup(true))
+            {
+                m_config->setGroup("Color Management");
+                m_config->writeEntry("EnableCM", false);
+                m_config->sync();
+            }
         }
         else
         {
             m_config->setGroup("Color Management");
             m_config->writeEntry("EnableCM", false);
+            m_config->sync();
         }
     }
 
     // Report errors from dcraw detection.
-    Digikam::DcrawBinary::instance()->checkReport();  
+
+    DcrawBinary::instance()->checkReport();  
 }
 
 const QPtrList<KAction>& DigikamApp::menuImageActions()
@@ -1335,20 +1340,27 @@
 
 void DigikamApp::slotSetup()
 {
-    Setup setup(this);
+    setup();
+}
 
+bool DigikamApp::setup(bool iccSetupPage)
+{
+    Setup setup(this, 0, iccSetupPage ? Setup::IccProfiles : Setup::LastPageUsed);
+
     // To show the number of KIPI plugins in the setup dialog.
 
     KIPI::PluginLoader::PluginList list = KipiPluginLoader_->pluginList();
     setup.kipiPluginsPage()->initPlugins((int)list.count());
 
     if (setup.exec() != QDialog::Accepted)
-        return;
+        return false;
 
     setup.kipiPluginsPage()->applyPlugins();
     m_ImagePluginsLoader->loadPluginsFromList(setup.imagePluginsPage()->getImagePluginsListEnable());
 
     slotSetupChanged();
+
+    return true;
 }
 
 void DigikamApp::slotSetupCamera()
--- trunk/extragear/graphics/digikam/digikam/digikamapp.h #581695:581696
@@ -114,6 +114,7 @@
 
 private:
 
+    bool setup(bool iccSetupPage=false);
     void setupView();
     void setupActions();
     void setupAccelerators();
--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #581695:581696
@@ -85,6 +85,7 @@
 #include "dimginterface.h"
 #include "splashscreen.h"
 #include "setup.h"
+#include "setupicc.h"
 #include "setupimgplugins.h"
 #include "iofileprogressbar.h"
 #include "iccsettingscontainer.h"
@@ -112,6 +113,7 @@
     m_itemsNb                 = 0;
     m_deleteItem2Trash        = true;
     m_fullScreenHideThumbBar  = true;
+    m_validIccPath            = true;
 
     // -- Show splash at start ----------------------------
     
@@ -125,6 +127,13 @@
         m_splash = new Digikam::SplashScreen("showfoto-splash.png");
     }
 
+    // Check ICC profiles repository availability
+
+    if(m_splash)
+        m_splash->message(i18n("Checking ICC repository"), AlignLeft, white);
+
+    m_validIccPath = Digikam::SetupICC::iccRepositoryIsValid();
+
     // Check witch dcraw version available
 
     if(m_splash)
@@ -245,6 +254,53 @@
     return true;
 }
 
+void ShowFoto::show()
+{
+    // Remove Splashscreen.
+
+    if(m_splash)
+    {
+        m_splash->finish(this);
+        delete m_splash;
+        m_splash = 0;
+    }
+
+    // Display application window.
+
+    KMainWindow::show();
+
+    // Report errors from ICC repository path.
+
+    KConfig* config = kapp->config();
+    if(!m_validIccPath)
+    {
+        QString message = i18n("<qt><p>ICC profiles path seems to be invalid.</p>"
+                               "<p>If you want to set it now, select \"Yes\", otherwise "
+                               "select \"No\". In this case, \"Color Management\" feature "
+                               "will be disabled until you solve this issue</p></qt>");
+
+        if (KMessageBox::warningYesNo(this, message) == KMessageBox::Yes)
+        {
+            if (!setup(true))
+            {
+                config->setGroup("Color Management");
+                config->writeEntry("EnableCM", false);
+                config->sync();
+            }
+        }
+        else
+        {
+            config->setGroup("Color Management");
+            config->writeEntry("EnableCM", false);
+            config->sync();
+        }
+    }
+
+    // Report errors from dcraw detection.
+
+    Digikam::DcrawBinary::instance()->checkReport();  
+}
+
 void ShowFoto::setupConnections()
 {
     setupStandardConnections();
@@ -614,26 +670,12 @@
     printImage(m_currentItem->url());
 }
 
-void ShowFoto::show()
+bool ShowFoto::setup(bool iccSetupPage)
 {
-    if(m_splash)
-    {
-        m_splash->finish(this);
-        delete m_splash;
-        m_splash = 0;
-    }
-    KMainWindow::show();
-
-    // Report errors from dcraw detection.
-    Digikam::DcrawBinary::instance()->checkReport();  
-}
-
-void ShowFoto::setup(bool iccSetupPage)
-{
     Setup setup(this, 0, iccSetupPage ? Setup::ICCPage : Setup::LastPageUsed);
     
     if (setup.exec() != QDialog::Accepted)
-        return;
+        return false;
 
     unLoadImagePlugins();
     m_imagePluginLoader->loadPluginsFromList(setup.imagePluginsPage()->getImagePluginsListEnable());
@@ -647,6 +689,8 @@
         slotUpdateItemInfo();
         toggleActions(false);
     }
+
+    return true;
 }
 
 void ShowFoto::slotUpdateItemInfo(void)
--- trunk/extragear/graphics/digikam/showfoto/showfoto.h #581695:581696
@@ -66,12 +66,13 @@
     ~ShowFoto();
     
     virtual void show();
-    void setup(bool iccSetupPage=false);
+    bool setup(bool iccSetupPage=false);
 
 private:
     
     bool                             m_fullScreenHideThumbBar;
     bool                             m_deleteItem2Trash;
+    bool                             m_validIccPath;
     
     int                              m_itemsNb;
 
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #581695:581696
@@ -61,7 +61,7 @@
     ~EditorWindow();
 
     virtual void applySettings(){};
-    virtual void setup(bool iccSetupPage=false)=0;
+    virtual bool setup(bool iccSetupPage=false)=0;
 
 signals:
 
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #581695:581696
@@ -692,12 +692,12 @@
     }
 }
 
-void ImageWindow::setup(bool iccSetupPage)
+bool ImageWindow::setup(bool iccSetupPage)
 {
     Setup setup(this, 0, iccSetupPage ? Setup::IccProfiles : Setup::LastPageUsed);    
         
     if (setup.exec() != QDialog::Accepted)
-        return;
+        return false;
 
     unLoadImagePlugins();
     m_imagePluginLoader->loadPluginsFromList(setup.imagePluginsPage()->getImagePluginsListEnable());
@@ -705,6 +705,7 @@
     loadImagePlugins();
     
     applySettings();
+    return true;
 }
 
 void ImageWindow::toggleGUI2FullScreen()
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.h #581695:581696
@@ -64,7 +64,7 @@
     static bool         imagewindowCreated();
 
     void applySettings();
-    void setup(bool iccSetupPage=false);
+    bool setup(bool iccSetupPage=false);
 
     bool queryClose();
 
--- trunk/extragear/graphics/digikam/utilities/setup/setupicc.cpp #581695:581696
@@ -37,6 +37,7 @@
 #include <qpushbutton.h>
 #include <qstringlist.h>
 #include <qmap.h>
+#include <qdir.h>
 #include <qtooltip.h>
 
 // KDE includes.
@@ -688,6 +689,26 @@
     d->monitorProfilesKC->setEnabled(b);
     d->infoMonitorProfiles->setEnabled(b);
 }
+
+bool SetupICC::iccRepositoryIsValid()
+{
+    KConfig* config = kapp->config();
+    config->setGroup("Color Management");
+
+    // If color management is disable, no need to check anymore.
+    if (!config->readBoolEntry("EnableCM", false))
+        return true;
+
+    // To be valid, the ICC profiles repository must exist and be readable.
+
+    QDir tmpPath(config->readPathEntry("DefaultPath", QString::null));
+    kdDebug() << "ICC profiles repository is: " << tmpPath.dirName() << endl;
+
+    if ( tmpPath.exists() && tmpPath.isReadable() )
+        return true;
+
+    return false;
+}
             
 }  // namespace Digikam
 
--- trunk/extragear/graphics/digikam/utilities/setup/setupicc.h #581695:581696
@@ -47,6 +47,8 @@
 
     void applySettings();
 
+    static bool iccRepositoryIsValid();
+
 private:
 
     void readSettings();



More information about the Digikam-devel mailing list