[Digikam-devel] extragear/graphics/kipi-plugins

Andi Clemens andi.clemens at gmx.net
Fri Nov 28 18:23:57 GMT 2008


SVN commit 890271 by aclemens:

The imageslist widget used in IPod, Flickr, SendImages and RemoveRedEyes has
been refactorized to be a common kipiplugins widget. Flickr and RemoveRedEyes
have already been ported.

The widget can be used "as it is", if no special features or columns are
required. It will display "Thumbnail" and "Filename" column by default.
It also provides 3 User Columns, as shown here:
http://www.flickr.com/photos/26732399@N05/3066278002/

Also a plainPage widget is added, where a plugin can add additional widgets if
needed, like the summarybox in RemoveRedEyes plugin.
If you need additional methods, just derive your own class from the common
imageslist.

The cstor of the ImagesList widget takes two additional parameters:

allowRAW:
---------
allow RAW files to be added [default: true]
If false, don't load RAW files and send a signal so that the plugin
can react in this case
           
autoLoad:
---------
load images from interface directly when ImagesList widget is
created [default: true]
I needed to provide this for RemoveRedEyes because I need to load
the images later, otherwise some signals will not work

To change the column setup, you can use the widget as follows:

m_imglst = new KIPIPlugins::ImagesList(iface, true, true, parent);
m_imglst->listView()->setWhatsThis(i18n("This is the list of images "
                      "to upload on your Flickr account."));

// set additional column
m_imglst->listView()->setColumnEnabled(KIPIPlugins::ImagesListView::User1,
                      true);
m_imglst->listView()->setColumnLabel(KIPIPlugins::ImagesListView::User1,
                      i18n("blabla"));

// or use this wrapper method instead
m_imglst->listView()->setColumn(KIPIPlugins::ImagesListView::User1,
                      i18n("blabla"),
                      true);

For additional information, take a look at the already ported plugins (Flickr
and RemoveRedEyes).

Andi

CCMAIL: kde-imaging at kde.org
CCMAIL: digikam-devel at kde.org

 M  +7 -2      common/libkipiplugins/CMakeLists.txt  
 M  +2 -2      common/libkipiplugins/imagedialog.h  
 A             common/libkipiplugins/imageslist.cpp   flickrexport/imageslist.cpp#890219 [License: GPL (v2+)]
 A             common/libkipiplugins/imageslist.h   removeredeyes/imageslist.h#890219 [License: GPL (v2+)]
 M  +0 -1      flickrexport/CMakeLists.txt  
 M  +3 -1      flickrexport/flickrwidget.cpp  
 M  +6 -2      flickrexport/flickrwidget.h  
 M  +1 -1      flickrexport/flickrwindow.cpp  
 M  +7 -6      flickrexport/flickrwindow.h  
 D             flickrexport/imageslist.cpp  
 D             flickrexport/imageslist.h  
 M  +2 -2      removeredeyes/CMakeLists.txt  
 D             removeredeyes/imageslist.cpp  
 D             removeredeyes/imageslist.h  
 A             removeredeyes/myimageslist.cpp   [License: GPL (v2+)]
 A             removeredeyes/myimageslist.h   [License: GPL (v2+)]
 M  +7 -7      removeredeyes/removeredeyeswindow.cpp  


--- trunk/extragear/graphics/kipi-plugins/common/libkipiplugins/CMakeLists.txt #890270:890271
@@ -1,8 +1,13 @@
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/pluginsversion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/pluginsversion.h)
 INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_PNG_INCLUDE_DIR})
 
-SET(kipiplugins_LIB_SRCS kpaboutdata.cpp kpwriteimage.cpp iccjpeg.c
-                         batchprogressdialog.cpp imagedialog.cpp)
+SET(kipiplugins_LIB_SRCS kpaboutdata.cpp
+                         kpwriteimage.cpp
+                         iccjpeg.c
+                         batchprogressdialog.cpp
+                         imageslist.cpp
+                         imagedialog.cpp
+                         )
 
 KDE4_ADD_LIBRARY(kipiplugins SHARED ${kipiplugins_LIB_SRCS})
 
--- trunk/extragear/graphics/kipi-plugins/common/libkipiplugins/imagedialog.h #890270:890271
@@ -12,12 +12,12 @@
  * and/or modify it under the terms of the GNU General
  * Public License as published by the Free Software Foundation;
  * either version 2, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * ============================================================ */
 
 #ifndef IMAGEDIALOG_H
--- trunk/extragear/graphics/kipi-plugins/flickrexport/CMakeLists.txt #890270:890271
@@ -2,7 +2,6 @@
 
 SET(kipiplugin_flickrexport_PART_SRCS
     plugin_flickrexport.cpp
-    imageslist.cpp
     flickrwindow.cpp
     login.cpp
     flickrtalker.cpp
--- trunk/extragear/graphics/kipi-plugins/flickrexport/flickrwidget.cpp #890270:890271
@@ -80,7 +80,9 @@
 
     // -------------------------------------------------------------------
 
-    m_imglst                       = new ImagesList(m_tab, iface);
+    m_imglst                       = new KIPIPlugins::ImagesList(iface, true, true, m_tab);
+    m_imglst->listView()->setWhatsThis(i18n("This is the list of images to upload on your Flickr account."));
+
     QWidget* settingsBox           = new QWidget(m_tab);
     QVBoxLayout* settingsBoxLayout = new QVBoxLayout(settingsBox);
 
--- trunk/extragear/graphics/kipi-plugins/flickrexport/flickrwidget.h #890270:890271
@@ -42,10 +42,14 @@
     class Interface;
 }
 
+namespace KIPIPlugins
+{
+    class ImagesList;
+}
+
 namespace KIPIFlickrExportPlugin
 {
 
-class ImagesList;
 
 class FlickrWidget : public QWidget
 {
@@ -92,7 +96,7 @@
 
     KHTMLPart*    m_photoView;
 
-    ImagesList*   m_imglst;
+    KIPIPlugins::ImagesList*   m_imglst;
 
     friend class FlickrWindow;
 };
--- trunk/extragear/graphics/kipi-plugins/flickrexport/flickrwindow.cpp #890270:890271
@@ -62,10 +62,10 @@
 
 // Local includes.
 
+#include "imageslist.h"
 #include "kpaboutdata.h"
 #include "pluginsversion.h"
 #include "login.h"
-#include "imageslist.h"
 #include "flickrtalker.h"
 #include "flickritem.h"
 #include "flickrviewitem.h"
--- trunk/extragear/graphics/kipi-plugins/flickrexport/flickrwindow.h #890270:890271
@@ -39,10 +39,6 @@
 
 #include <libkipi/interface.h>
 
-// Local includes.
-
-#include "kpaboutdata.h"
-
 class QProgressDialog;
 class QPushButton;
 class QSpinBox;
@@ -57,6 +53,12 @@
 class Interface;
 }
 
+namespace KIPIPlugins
+{
+class KPAboutData;
+class ImagesList;
+}
+
 namespace KWallet
 {
 class Wallet;
@@ -155,11 +157,10 @@
     FlickrWidget                          *m_widget;
     FlickrTalker                          *m_talker;
 
-    ImagesList                            *m_imglst;
-
     KIPI::Interface                       *m_interface;
 
     KIPIPlugins::KPAboutData              *m_about;
+    KIPIPlugins::ImagesList               *m_imglst;
 };
 
 } // namespace KIPIFlickrExportPlugin
--- trunk/extragear/graphics/kipi-plugins/removeredeyes/CMakeLists.txt #890270:890271
@@ -18,7 +18,7 @@
     advancedsettings.cpp
     blobsettingsbox.cpp
     classifiersettingsbox.cpp
-    imageslist.cpp
+    myimageslist.cpp
     plugin_removeredeyes.cpp
     removeredeyeswindow.cpp
     settingstab.cpp
@@ -34,7 +34,6 @@
 KDE4_ADD_PLUGIN(kipiplugin_removeredeyes ${kipiplugin_removeredeyes_PART_SRCS})
 
 TARGET_LINK_LIBRARIES(kipiplugin_removeredeyes
-                      kipiplugins
                       ${KIPI_LIBRARIES}
                       ${KDCRAW_LIBRARIES}
                       ${QT_AND_KDECORE_LIBS}
@@ -45,6 +44,7 @@
                       ${OpenCV_CXCORE_LIBRARY}
                       ${OpenCV_CVAUX_LIBRARY}
                       ${OpenCV_HIGHGUI_LIBRARY}
+                      kipiplugins
                      )
 
 INSTALL(TARGETS kipiplugin_removeredeyes DESTINATION ${PLUGIN_INSTALL_DIR})
--- trunk/extragear/graphics/kipi-plugins/removeredeyes/removeredeyeswindow.cpp #890270:890271
@@ -48,7 +48,7 @@
 
 // Local includes.
 
-#include "imageslist.h"
+#include "myimageslist.h"
 #include "kpaboutdata.h"
 #include "removalsettings.h"
 #include "settingstab.h"
@@ -84,7 +84,7 @@
 
     KTabWidget*                 tabWidget;
 
-    ImagesList*                 imageList;
+    MyImagesList*               imageList;
     RemovalSettings             settings;
     SettingsTab*                settingsTab;
     WorkerThread*               thread;
@@ -109,7 +109,7 @@
     d->interface            = interface;
     d->tabWidget            = new KTabWidget;
 
-    d->imageList            = new ImagesList(interface);
+    d->imageList            = new MyImagesList(interface);
 
     d->progress             = new QProgressBar;
     d->progress->setMaximumHeight(fontMetrics().height() + 2);
@@ -173,7 +173,7 @@
     connect(handbook, SIGNAL(triggered(bool)),
             this, SLOT(helpClicked()));
 
-    connect(d->imageList, SIGNAL(foundRAWImages(bool)),
+    connect(d->imageList, SIGNAL(signalFoundRAWImages(bool)),
             this, SLOT(foundRAWImages(bool)));
 
     connect(this, SIGNAL(user1Clicked()),
@@ -193,7 +193,7 @@
     KIPI::ImageCollection images = interface->currentSelection();
 
     if (images.isValid())
-        d->imageList->addImages(images.images());
+        d->imageList->slotAddImages(images.images());
 
     readSettings();
     setBusy(false);
@@ -351,7 +351,7 @@
     {
         // disable connection to make sure that the "test run" and "correct photos"
         // buttons are not enabled again on ImageListChange
-        disconnect(d->imageList, SIGNAL(imageListChanged(bool)),
+        disconnect(d->imageList, SIGNAL(signalImageListChanged(bool)),
                 this, SLOT(imageListChanged(bool)));
 
         disconnect(this, SIGNAL(myCloseClicked()),
@@ -371,7 +371,7 @@
     {
         // enable connection again to make sure that an empty image list will
         // disable the "test run" and "correct photos" buttons
-        connect(d->imageList, SIGNAL(imageListChanged(bool)),
+        connect(d->imageList, SIGNAL(signalImageListChanged(bool)),
                 this, SLOT(imageListChanged(bool)));
 
         disconnect(this, SIGNAL(myCloseClicked()),



More information about the Digikam-devel mailing list