[Digikam-devel] extragear/graphics/digikam

Gilles Caulier caulier.gilles at free.fr
Thu Jan 26 08:16:34 GMT 2006


SVN commit 502485 by cgilles:

digikam from trunk : Showfoto/IE common GUI implementation : new unLoadImagePlugins() and loadImagePlugins() common methods.

CCMAIL: digikam-devel at kde.org

 M  +8 -41     showfoto/showfoto.cpp  
 M  +0 -2      showfoto/showfoto.h  
 M  +34 -0     utilities/imageeditor/editor/editorwindow.cpp  
 M  +6 -1      utilities/imageeditor/editor/editorwindow.h  
 M  +8 -28     utilities/imageeditor/editor/imagewindow.cpp  


--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #502484:502485
@@ -128,14 +128,14 @@
     setupUserArea();
     setupStatusBar();
 
-    // Build the gui
+    // Build the GUI
 
     setupActions();
 
-    // Load image plugins.
+    // Load image plugins to GUI
 
     m_imagePluginLoader = new Digikam::ImagePluginLoader(this, m_splash);
-    loadPlugins();
+    loadImagePlugins();
 
     // If plugin core isn't available, plug BCG actions to collection instead.
     
@@ -210,10 +210,10 @@
 
 ShowFoto::~ShowFoto()
 {
-    unLoadPlugins();
+    unLoadImagePlugins();
 
-    delete m_bar;
     delete m_imagePluginLoader;
+    delete m_bar;
     delete m_slideShow;
     delete m_rightSidebar;
 }
@@ -1101,10 +1101,11 @@
     if (setup.exec() != QDialog::Accepted)
         return;
 
-    unLoadPlugins();
+    unLoadImagePlugins();
     m_imagePluginLoader->loadPluginsFromList(setup.imagePluginsPage()->getImagePluginsListEnable());
     kapp->config()->sync();
-    loadPlugins();
+    loadImagePlugins();
+    
     applySettings();
 
     if ( m_itemsNb == 0 )
@@ -1114,40 +1115,6 @@
     }
 }
 
-void ShowFoto::loadPlugins()
-{
-    QPtrList<Digikam::ImagePlugin> pluginList = m_imagePluginLoader->pluginList();
-
-    for (Digikam::ImagePlugin* plugin = pluginList.first();
-         plugin; plugin = pluginList.next())
-    {
-        if (plugin)
-        {
-            guiFactory()->addClient(plugin);
-            plugin->setParentWidget(this);
-            plugin->setEnabledSelectionActions(false);
-        }
-        else
-            kdDebug() << "Invalid plugin to add!" << endl;
-    }
-}
-
-void ShowFoto::unLoadPlugins()
-{
-    QPtrList<Digikam::ImagePlugin> pluginList = m_imagePluginLoader->pluginList();
-
-    for (Digikam::ImagePlugin* plugin = pluginList.first();
-         plugin; plugin = pluginList.next())
-    {
-        if (plugin) 
-        {
-            guiFactory()->removeClient(plugin);
-            plugin->setParentWidget(0);
-            plugin->setEnabledSelectionActions(false);
-        }
-    }
-}
-
 void ShowFoto::slotDeleteCurrentItem()
 {
     KURL urlCurrent(m_currentItem->url());
--- trunk/extragear/graphics/digikam/showfoto/showfoto.h #502484:502485
@@ -47,7 +47,6 @@
 
 namespace Digikam
 {
-class ImagePluginLoader;
 class ThumbBarView;
 class ThumbBarItem;
 class ImagePropertiesSideBar;
@@ -95,7 +94,6 @@
     
     KActionMenu                     *m_BCGAction;
     
-    Digikam::ImagePluginLoader       *m_imagePluginLoader;
     Digikam::ThumbBarView            *m_bar;
     Digikam::ThumbBarItem            *m_currentItem;
     Digikam::ImagePropertiesSideBar  *m_rightSidebar;
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #502484:502485
@@ -86,6 +86,7 @@
     d = new EditorWindowPriv;
 
     m_canvas                 = 0;
+    m_imagePluginLoader      = 0;
     m_undoAction             = 0;
     m_redoAction             = 0;
     m_zoomPlusAction         = 0;
@@ -574,7 +575,40 @@
     m_accel->remove(action->text());
 }
 
+void EditorWindow::loadImagePlugins()
+{
+    QPtrList<Digikam::ImagePlugin> pluginList = m_imagePluginLoader->pluginList();
 
+    for (Digikam::ImagePlugin* plugin = pluginList.first();
+         plugin; plugin = pluginList.next())
+    {
+        if (plugin)
+        {
+            guiFactory()->addClient(plugin);
+            plugin->setParentWidget(this);
+            plugin->setEnabledSelectionActions(false);
+        }
+        else
+            kdDebug() << "Invalid plugin to add!" << endl;
+    }
+}
+
+void EditorWindow::unLoadImagePlugins()
+{
+    QPtrList<Digikam::ImagePlugin> pluginList = m_imagePluginLoader->pluginList();
+
+    for (Digikam::ImagePlugin* plugin = pluginList.first();
+         plugin; plugin = pluginList.next())
+    {
+        if (plugin) 
+        {
+            guiFactory()->removeClient(plugin);
+            plugin->setParentWidget(0);
+            plugin->setEnabledSelectionActions(false);
+        }
+    }
+}
+
 }  // namespace Digikam
 
 #include "editorwindow.moc"
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #502484:502485
@@ -44,6 +44,7 @@
 {
 
 class Canvas;
+class ImagePluginLoader;
 class ICCSettingsContainer;
 class IOFileSettingsContainer;
 class SavingContextContainer;
@@ -109,8 +110,9 @@
 
     KToolBarPopupAction     *m_undoAction;
     KToolBarPopupAction     *m_redoAction;
-    
+
     Canvas                  *m_canvas;
+    ImagePluginLoader       *m_imagePluginLoader;
     IOFileProgressBar       *m_nameLabel;
     ICCSettingsContainer    *m_ICCSettings;
     IOFileSettingsContainer *m_IOFileSettings;
@@ -156,6 +158,9 @@
 
     void plugActionAccel(KAction* action);
     void unplugActionAccel(KAction* action);
+
+    void unLoadImagePlugins();
+    void loadImagePlugins();
     
     virtual void setupConnections()=0;
     virtual void setupActions()=0;
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #502484:502485
@@ -103,23 +103,15 @@
     setupUserArea();
     setupStatusBar();
 
-    // Build the gui
+    // Build the GUI
 
     setupActions();
         
-    QPtrList<ImagePlugin> pluginList = ImagePluginLoader::instance()->pluginList();
+    // Load image plugins to GUI
+    
+    m_imagePluginLoader = ImagePluginLoader::instance();
+    loadImagePlugins();
 
-    for (ImagePlugin* plugin = pluginList.first();
-         plugin; plugin = pluginList.next())
-    {
-        if (plugin) 
-        {
-            guiFactory()->addClient(plugin);
-            plugin->setParentWidget(this);
-            plugin->setEnabledSelectionActions(false);
-        }
-    }
-
     m_contextMenu = dynamic_cast<QPopupMenu*>(factory()->container("RMBMenu", this));
     
     // -- setup connections ---------------------------
@@ -143,19 +135,8 @@
 {
     m_instance = 0;
 
-    QPtrList<ImagePlugin> pluginList = ImagePluginLoader::instance()->pluginList();
+    unLoadImagePlugins();
     
-    for (ImagePlugin* plugin = pluginList.first();
-         plugin; plugin = pluginList.next())
-    {
-        if (plugin) 
-        {
-            guiFactory()->removeClient(plugin);
-            plugin->setParentWidget(0);
-            plugin->setEnabledSelectionActions(false);
-        }
-    }
-    
     delete m_rightSidebar;
 }
 
@@ -624,9 +605,8 @@
     m_cropAction->setEnabled(val);
     m_copyAction->setEnabled(val);
 
-    ImagePluginLoader* loader = ImagePluginLoader::instance();
-    for (ImagePlugin* plugin = loader->pluginList().first();
-         plugin; plugin = loader->pluginList().next()) 
+    for (ImagePlugin* plugin = m_imagePluginLoader->pluginList().first();
+         plugin; plugin = m_imagePluginLoader->pluginList().next())
     {
         if (plugin) 
         {



More information about the Digikam-devel mailing list