[Digikam-devel] branches/extragear/kde3/graphics/digikam

Gilles Caulier caulier.gilles at gmail.com
Fri Mar 14 09:20:13 GMT 2008


SVN commit 785523 by cgilles:

digiKam from KDE3 branch : Showfoto now support Color Theme scheme as digiKam core

CCBUGS: 120309
CCMAIL: digikam-devel at kde.org



 M  +2 -0      showfoto/Makefile.am  
 M  +25 -4     showfoto/setup/setupeditor.cpp  
 M  +5 -1      showfoto/setup/setupeditor.h  
 M  +14 -5     showfoto/showfoto.cpp  
 M  +2 -1      showfoto/showfotoui.rc  
 M  +40 -0     utilities/imageeditor/editor/editorwindow.cpp  
 M  +6 -0      utilities/imageeditor/editor/editorwindow.h  
 M  +3 -35     utilities/imageeditor/editor/imagewindow.cpp  
 M  +0 -2      utilities/imageeditor/editor/imagewindow.h  


--- branches/extragear/kde3/graphics/digikam/showfoto/Makefile.am #785522:785523
@@ -13,6 +13,7 @@
 	   -I$(top_srcdir)/digikam/libs/dimg \
 	   -I$(top_srcdir)/digikam/libs/dmetadata \
 	   -I$(top_srcdir)/digikam/libs/threadimageio \
+	   -I$(top_srcdir)/digikam/libs/themeengine \
 	   -I$(top_srcdir)/digikam/digikam \
 	   -I$(top_srcdir)/digikam/utilities/slideshow \
 	   -I$(top_srcdir)/digikam/utilities/imageeditor/canvas \
@@ -29,6 +30,7 @@
 	           $(top_builddir)/digikam/utilities/imageeditor/editor/libshowfoto.la \
 	           $(top_builddir)/digikam/utilities/slideshow/libslideshow.la \
 	           $(top_builddir)/digikam/libs/threadimageio/libthreadimageio.la \
+	           $(top_builddir)/digikam/libs/themeengine/libthemeengine.la \
 	           $(top_builddir)/digikam/libs/jpegutils/libjpegutils.la \
 	           $(LIB_KUTILS) $(LIB_KPARTS) $(LIBJPEG)  
 
--- branches/extragear/kde3/graphics/digikam/showfoto/setup/setupeditor.cpp #785522:785523
@@ -6,7 +6,7 @@
  * Date        : 2005-04-02
  * Description : setup showfoto tab.
  * 
- * Copyright (C) 2005-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -64,8 +64,12 @@
         exifSetOrientationBox = 0;
         overExposureColor     = 0;
         underExposureColor    = 0;
+        themebackgroundColor  = 0;
+        colorBox              = 0;
     }
 
+    QHBox        *colorBox;
+
     QCheckBox    *hideToolBar;
     QCheckBox    *hideThumbBar;
     QCheckBox    *horizontalThumbBar;
@@ -73,6 +77,7 @@
     QCheckBox    *useTrash;
     QCheckBox    *exifRotateBox;
     QCheckBox    *exifSetOrientationBox;
+    QCheckBox    *themebackgroundColor;
     
     KColorButton *backgroundColor;
     KColorButton *underExposureColor;
@@ -89,9 +94,15 @@
     
     QVGroupBox *interfaceOptionsGroup = new QVGroupBox(i18n("Interface Options"), parent);
     
-    QHBox* colorBox              = new QHBox(interfaceOptionsGroup);    
-    QLabel *backgroundColorlabel = new QLabel( i18n("&Background color:"), colorBox );
-    d->backgroundColor           = new KColorButton(colorBox);
+    d->themebackgroundColor = new QCheckBox(i18n("&Use theme background color"),
+                                            interfaceOptionsGroup);
+
+    QWhatsThis::add( d->themebackgroundColor, i18n("<p>Enable this option to use the background theme "
+                                              "color in the image editor area") );
+
+    d->colorBox                  = new QHBox(interfaceOptionsGroup);    
+    QLabel *backgroundColorlabel = new QLabel( i18n("&Background color:"), d->colorBox);
+    d->backgroundColor           = new KColorButton(d->colorBox);
     backgroundColorlabel->setBuddy(d->backgroundColor);
     QWhatsThis::add( d->backgroundColor, i18n("<p>Select the background color to use "
                                               "for the image editor area.") );
@@ -139,6 +150,9 @@
     
     // --------------------------------------------------------
     
+    connect(d->themebackgroundColor, SIGNAL(toggled(bool)),
+            this, SLOT(slotThemeBackgroundColor(bool)));
+
     readSettings();
 }
 
@@ -147,12 +161,18 @@
     delete d;
 }
 
+void SetupEditor::slotThemeBackgroundColor(bool e)
+{
+    d->colorBox->setEnabled(!e);
+}
+
 void SetupEditor::readSettings()
 {
     KConfig* config = kapp->config();
     QColor Black(Qt::black);
     QColor White(Qt::white);
     config->setGroup("ImageViewer Settings");
+    d->themebackgroundColor->setChecked(config->readBoolEntry("UseThemeBackgroundColor", true));
     d->backgroundColor->setColor( config->readColorEntry("BackgroundColor", &Black ) );
     d->hideToolBar->setChecked(config->readBoolEntry("FullScreen Hide ToolBar", false));
     d->hideThumbBar->setChecked(config->readBoolEntry("FullScreenHideThumbBar", true));
@@ -169,6 +189,7 @@
 {
     KConfig* config = kapp->config();
     config->setGroup("ImageViewer Settings");
+    config->writeEntry("UseThemeBackgroundColor", d->themebackgroundColor->isChecked());
     config->writeEntry("BackgroundColor", d->backgroundColor->color());
     config->writeEntry("FullScreen Hide ToolBar", d->hideToolBar->isChecked());
     config->writeEntry("FullScreenHideThumbBar", d->hideThumbBar->isChecked());
--- branches/extragear/kde3/graphics/digikam/showfoto/setup/setupeditor.h #785522:785523
@@ -6,7 +6,7 @@
  * Date        : 2005-04-02
  * Description : setup showfoto tab.
  * 
- * Copyright (C) 2005-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -44,6 +44,10 @@
 
     void applySettings();
 
+private slots:
+
+    void slotThemeBackgroundColor(bool);
+
 private:
 
     void readSettings();
--- branches/extragear/kde3/graphics/digikam/showfoto/showfoto.cpp #785522:785523
@@ -9,7 +9,7 @@
  * Copyright (C) 2004-2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu>
  * Copyright (C) 2005-2006 by Tom Albers <tomalbers at kde.nl>
  * Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
- * Copyright (C) 2006-2007 by Marcel Wiesweg <marcel.wiesweg at gmx.de>
+ * Copyright (C) 2006-2008 by Marcel Wiesweg <marcel.wiesweg at gmx.de>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -94,6 +94,7 @@
 #include "iofilesettingscontainer.h"
 #include "loadingcacheinterface.h"
 #include "savingcontextcontainer.h"
+#include "themeengine.h"
 #include "showfoto.h"
 #include "showfoto.moc"
 
@@ -178,6 +179,13 @@
 
     KDcrawIface::DcrawBinary::instance()->checkSystem();
 
+    // Populate Themes
+
+    if(d->splash)
+        d->splash->message(i18n("Loading themes"), AlignLeft, white);
+
+    Digikam::ThemeEngine::instance()->scanThemes();
+
     // -- Build the GUI -----------------------------------
 
     setupUserArea();
@@ -490,7 +498,9 @@
     if(config->hasKey("Vertical Splitter Sizes") && d->vSplitter)
         d->vSplitter->setSizes(config->readIntListEntry("Vertical Splitter Sizes"));
     else 
-        m_canvas->setSizePolicy(szPolicy);    
+        m_canvas->setSizePolicy(szPolicy);
+
+    Digikam::ThemeEngine::instance()->setCurrentTheme(config->readEntry("Theme", i18n("Default")));
 }
 
 void ShowFoto::saveSettings()
@@ -506,6 +516,8 @@
     if (d->vSplitter)
         config->writeEntry("Vertical Splitter Sizes", d->vSplitter->sizes());
 
+    config->writeEntry("Theme", Digikam::ThemeEngine::instance()->getCurrentThemeName());
+
     config->sync();    
 }
 
@@ -516,9 +528,6 @@
     KConfig* config = kapp->config();
     config->setGroup("ImageViewer Settings");
 
-    m_bgColor = config->readColorEntry("BackgroundColor", &Qt::black);
-    m_canvas->setBackgroundColor(m_bgColor);
-
     // Current image deleted go to trash ?
     d->deleteItem2Trash = config->readBoolEntry("DeleteItem2Trash", true);
     if (d->deleteItem2Trash)
--- branches/extragear/kde3/graphics/digikam/showfoto/showfotoui.rc #785522:785523
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui version="27" name="showfoto" >
+<gui version="28" name="showfoto" >
 
 <MenuBar>
 
@@ -88,6 +88,7 @@
         <Merge name="StandardToolBarMenuHandler" />
         <Action name="options_show_statusbar"/>
         <Separator/>
+        <Action name="theme_menu" />
         <Action name="options_configure_keybinding" />
         <Action name="options_configure_toolbars" />
         <Action name="options_configure" />
--- branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #785522:785523
@@ -102,6 +102,7 @@
 #include "savingcontextcontainer.h"
 #include "loadingcacheinterface.h"
 #include "slideshowsettings.h"
+#include "themeengine.h"
 #include "editorwindowprivate.h"
 #include "editorwindow.h"
 #include "editorwindow.moc"
@@ -117,6 +118,7 @@
 {
     d = new EditorWindowPriv;
 
+    m_themeMenuAction        = 0;
     m_contextMenu            = 0;
     m_canvas                 = 0;
     m_imagePluginLoader      = 0;
@@ -469,6 +471,17 @@
     KStdAction::configureToolbars(this, SLOT(slotConfToolbars()), actionCollection());
     KStdAction::preferences(this, SLOT(slotSetup()),              actionCollection());
 
+    // -----------------------------------------------------------------------------------------
+
+    m_themeMenuAction = new KSelectAction(i18n("&Themes"), 0, actionCollection(), "theme_menu");
+    m_themeMenuAction->setItems(ThemeEngine::instance()->themeNames());
+
+    connect(m_themeMenuAction, SIGNAL(activated(const QString&)),
+            this, SLOT(slotChangeTheme(const QString&)));
+
+    connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
+            this, SLOT(slotThemeChanged()));
+
     // -- Standard 'Help' menu actions ---------------------------------------------
 
     d->donateMoneyAction = new KAction(i18n("Make a donation..."),
@@ -926,6 +939,8 @@
     
     d->fullScreenHideToolBar = config->readBoolEntry("FullScreen Hide ToolBar", false);
 
+    slotThemeChanged();
+
     // -- Exposure Indicators Settings --------------------------------------- 
 
     QColor black(Qt::black);
@@ -1844,4 +1859,29 @@
                                  list, i18n("List of supported RAW camera"));
 }
 
+void EditorWindow::slotThemeChanged()
+{
+    QStringList themes(ThemeEngine::instance()->themeNames());
+    int index = themes.findIndex(ThemeEngine::instance()->getCurrentThemeName());
+    if (index == -1)
+        index = themes.findIndex(i18n("Default"));
+
+    m_themeMenuAction->setCurrentItem(index);
+
+    KConfig* config = kapp->config();
+    config->setGroup("ImageViewer Settings");
+
+    if (!config->readBoolEntry("UseThemeBackgroundColor", true))
+        m_bgColor = config->readColorEntry("BackgroundColor", &Qt::black);
+    else
+        m_bgColor = ThemeEngine::instance()->baseColor();
+
+    m_canvas->setBackgroundColor(m_bgColor);
+}
+
+void EditorWindow::slotChangeTheme(const QString& theme)
+{
+    ThemeEngine::instance()->slotChangeTheme(theme);
+}
+
 }  // namespace Digikam
--- branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #785522:785523
@@ -46,6 +46,7 @@
 class KToolBarPopupAction;
 class KToggleAction;
 class KAction;
+class KSelectAction;
 
 namespace Digikam
 {
@@ -100,6 +101,8 @@
 
     KToggleAction           *m_fullScreenAction;
 
+    KSelectAction           *m_themeMenuAction;
+
     KToolBarPopupAction     *m_undoAction;
     KToolBarPopupAction     *m_redoAction;
 
@@ -181,11 +184,14 @@
 
     void slotNameLabelCancelButtonPressed();
 
+    void slotThemeChanged();
+
     virtual void slotLoadingStarted(const QString& filename);
     virtual void slotLoadingFinished(const QString &filename, bool success);
     virtual void slotSavingStarted(const QString &filename);
 
     virtual void slotSetup(){ setup(); };
+    virtual void slotChangeTheme(const QString& theme);
 
     virtual void slotFilePrint()=0;
     virtual void slotDeleteCurrentItem()=0;
--- branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #785522:785523
@@ -68,7 +68,6 @@
 #include "dragobjects.h"
 #include "canvas.h"
 #include "dimginterface.h"
-#include "themeengine.h"
 #include "dimg.h"
 #include "dmetadata.h"
 #include "imageplugin.h"
@@ -93,6 +92,7 @@
 #include "imageattributeswatch.h"
 #include "deletedialog.h"
 #include "metadatahub.h"
+#include "themeengine.h"
 #include "imagewindow.h"
 #include "imagewindow.moc"
 
@@ -118,7 +118,6 @@
         fileTrashDirectlyAction             = 0;
         imageInfoCurrent                    = 0;
         rightSidebar                        = 0;
-        themeMenuAction                     = 0;
     }
 
     // If image editor is launched by camera interface, current
@@ -141,8 +140,6 @@
     KAction                  *fileDeletePermanentlyDirectlyAction;
     KAction                  *fileTrashDirectlyAction;
 
-    KSelectAction            *themeMenuAction;
-
     ImageInfoList             imageInfoList;
     ImageInfo                *imageInfoCurrent;
 
@@ -195,6 +192,8 @@
     readSettings();
     applySettings();
     setAutoSaveSettings("ImageViewer Settings");
+    m_themeMenuAction->setItems(ThemeEngine::instance()->themeNames());
+    slotThemeChanged();
 
     //-------------------------------------------------------------
 
@@ -266,9 +265,6 @@
 
     connect(watch, SIGNAL(signalFileMetadataChanged(const KURL &)),
             this, SLOT(slotFileMetadataChanged(const KURL &)));
-
-    connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
-            this, SLOT(slotThemeChanged()));
 }
 
 void ImageWindow::setupUserArea()
@@ -327,15 +323,6 @@
                           d->rightSidebar, SLOT(slotAssignRatingFiveStar()),
                           actionCollection(), "imageview_ratefivestar");
 
-    // -----------------------------------------------------------------------------------------
-
-    d->themeMenuAction = new KSelectAction(i18n("&Themes"), 0, actionCollection(), "theme_menu");
-    connect(d->themeMenuAction, SIGNAL(activated(const QString&)),
-            this, SLOT(slotChangeTheme(const QString&)));
-
-    d->themeMenuAction->setItems(ThemeEngine::instance()->themeNames());
-    slotThemeChanged();
-
     // -- Special Delete actions ---------------------------------------------------------------
 
     // Pop up dialog to ask user whether to permanently delete
@@ -381,13 +368,6 @@
     KConfig* config = kapp->config();
     config->setGroup("ImageViewer Settings");
 
-    if (!config->readBoolEntry("UseThemeBackgroundColor", true))
-        m_bgColor = config->readColorEntry("BackgroundColor", &Qt::black);
-    else
-        m_bgColor = ThemeEngine::instance()->baseColor();
-
-    m_canvas->setBackgroundColor(m_bgColor);
-
     AlbumSettings *settings = AlbumSettings::instance();
     m_canvas->setExifOrient(settings->getExifRotate());
     m_setExifOrientationTag = settings->getExifSetOrientation();
@@ -1240,18 +1220,6 @@
     m_canvas->slotRestore();
 }
 
-void ImageWindow::slotThemeChanged()
-{
-    QStringList themes(ThemeEngine::instance()->themeNames());
-    int index = themes.findIndex(AlbumSettings::instance()->getCurrentTheme());
-    if (index == -1)
-        index = themes.findIndex(i18n("Default"));
-
-    d->themeMenuAction->setCurrentItem(index);
-
-    m_canvas->setBackgroundColor(ThemeEngine::instance()->baseColor());
-}
-
 void ImageWindow::slotChangeTheme(const QString& theme)
 {
     AlbumSettings::instance()->setCurrentTheme(theme);
--- branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor/imagewindow.h #785522:785523
@@ -131,8 +131,6 @@
     void slotAssignRating(int rating);
 
     void slotFileMetadataChanged(const KURL &);
-
-    void slotThemeChanged();
     void slotChangeTheme(const QString& theme);
 
 private:



More information about the Digikam-devel mailing list