[Digikam-devel] extragear/graphics/digikamimageplugins

Gilles Caulier caulier.gilles at free.fr
Tue Jul 26 20:31:04 BST 2005


SVN commit 438993 by cgilles:

digiKam Hot Pixels Tool : no need to have a dialog to set Black Frames list. Add list to main dialog.

CCMAIL: digikam-devel at kde.org

 M  +2 -1      common/dialogs/ctrlpaneldialog.cpp  
 M  +2 -2      hotpixels/Makefile.am  
 D             hotpixels/blackframesetupdialog.cpp  
 D             hotpixels/blackframesetupdialog.h  
 M  +35 -18    hotpixels/imageeffect_hotpixels.cpp  
 M  +3 -9      hotpixels/imageeffect_hotpixels.h  


--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/ctrlpaneldialog.cpp #438992:438993
@@ -57,7 +57,7 @@
                                  bool loadFileSettings, bool tryAction, bool progressBar,
                                  int separateViewMode)
                : KDialogBase(Plain, title,
-                             Help|Default|User1|User2|User3|Try|Ok|Cancel, Ok,
+                             Help|Default|Apply|User1|User2|User3|Try|Ok|Cancel, Ok,
                              parent, 0, true, true,
                              i18n("&Abort"),
                              i18n("&Load..."),
@@ -76,6 +76,7 @@
     showButton(User2, loadFileSettings);
     showButton(User3, loadFileSettings);
     showButton(Try, tryAction);
+    showButton(Apply, false);
             
     resize(configDialogSize(name + QString::QString(" Tool Dialog")));  
         
--- trunk/extragear/graphics/digikamimageplugins/hotpixels/Makefile.am #438992:438993
@@ -8,8 +8,8 @@
 kde_module_LTLIBRARIES = digikamimageplugin_hotpixels.la 
 
 digikamimageplugin_hotpixels_la_SOURCES = multiviewwidget.cpp hotpixelviewwidget.cpp blackframeparser.cpp \
-					  weights.cpp hotpixelfixer.cpp imageplugin_hotpixels.cpp imageeffect_hotpixels.cpp \
-					  blackframesetupdialog.cpp blackframelistview.h blackframelistview.cpp
+					  weights.cpp hotpixelfixer.cpp imageplugin_hotpixels.cpp \
+					  blackframelistview.h blackframelistview.cpp imageeffect_hotpixels.cpp 
 
 digikamimageplugin_hotpixels_la_LIBADD = $(LIB_KPARTS) $(LIBDIGIKAM_LIBS) \
 	              $(top_builddir)/digikamimageplugins/common/dialogs/libdigikamimagepluginsdialog.la 
--- trunk/extragear/graphics/digikamimageplugins/hotpixels/imageeffect_hotpixels.cpp #438992:438993
@@ -26,16 +26,17 @@
 #include <qcombobox.h>
 #include <qlabel.h>
 #include <qlayout.h>
-#include <qpushbutton.h>
 #include <qwhatsthis.h>
 
 // KDE includes.
 
 #include <kdebug.h>
 #include <klocale.h>
+#include <kimageio.h>
 #include <kaboutdata.h>
 #include <kapplication.h>
 #include <kstandarddirs.h>
+#include <kfiledialog.h>
 
 // Digikam includes.
 
@@ -46,7 +47,7 @@
 #include "version.h"
 #include "imageeffect_hotpixels.h"
 #include "hotpixelviewwidget.h"
-#include "blackframesetupdialog.h"
+#include "blackframelistview.h"
 #include "blackframeparser.h"
 
 //Temporally added includes. Please remove
@@ -60,13 +61,20 @@
                                      false, false, false, 
                                      Digikam::ImagePannelWidget::SeparateViewDuplicate)
 {
+    // No need Abort button action.
+    showButton(User1, false); 
+    
+    showButton(Apply, true);
+    setButtonText( Apply, i18n("Add Black Frame..."));
+    setButtonWhatsThis( Apply, i18n("<p>Use this button to add a new black frame file witch will "
+                                    "be used by the hot pixels removal filter.") );  
     QString whatsThis;
 
     KAboutData* about = new KAboutData("digikamimageplugins",
                                        I18N_NOOP("Hot Pixels Correction"), 
                                        digikamimageplugins_version,
                                        I18N_NOOP("A digiKam image plugin for fixing dots produced by "
-                                                 " hot/stuck/dead pixels from a CCD."),
+                                                 "hot/stuck/dead pixels from a CCD."),
                                        KAboutData::License_GPL,
                                        "(c) 2005, Unai Garro", 
                                        0,
@@ -95,14 +103,15 @@
     m_filterMethodCombo->insertItem(i18n("Cubic"));
     
     gridSettings->addMultiCellWidget(filterMethodLabel, 0, 0, 0, 0);
-    gridSettings->addMultiCellWidget(m_filterMethodCombo, 0, 0, 1, 1);
+    gridSettings->addMultiCellWidget(m_filterMethodCombo, 0, 0, 1, 2);
         
     //TODO: load the default setting from kconfig
     
-    m_blackFrameButton = new QPushButton(i18n("Black Frame..."), gboxSettings);
-    QWhatsThis::add( m_blackFrameButton, i18n("<p>Setup the black frame to use with hot "
-                                              "pixels removal filter."));    
-    gridSettings->addMultiCellWidget(m_blackFrameButton, 1, 1, 0, 0);
+    m_blackFrameListView = new BlackFrameListView(gboxSettings);
+    m_blackFrameListView->addColumn(i18n("Preview"));
+    m_blackFrameListView->addColumn(i18n("Size"));
+    m_blackFrameListView->addColumn(i18n("Enabled"));
+    gridSettings->addMultiCellWidget(m_blackFrameListView, 1, 2, 0, 2);
     
     m_imagePreviewWidget->setUserAreaWidget(gboxSettings);
         
@@ -114,14 +123,11 @@
     // -------------------------------------------------------------
     // Main window's signal & slots
     
-    connect(m_blackFrameButton, SIGNAL(clicked()), 
-            this, SLOT(setupBlackFrames()));
-    
     connect(m_filterMethodCombo, SIGNAL(activated(int)),
             this, SLOT(slotEffect()));
                           
     connect(m_parser, SIGNAL(parsed(QValueList<HotPixel>)),
-            this, SLOT(blackFrameParsed(QValueList<HotPixel>)));             
+            this, SLOT(blackFrameParsed(QValueList<HotPixel>))); 
 }
 
 ImageEffect_HotPixels::~ImageEffect_HotPixels()
@@ -129,16 +135,27 @@
     delete m_parser;
 }
 
-void ImageEffect_HotPixels::setupBlackFrames(void)
+// Select Black frame file.
+void ImageEffect_HotPixels::slotApply()
 {
-    BlackFrameSetupDialog* dialog = new BlackFrameSetupDialog(this);
-    dialog->exec();    
+    //Does one need to do this if digikam did so already?
+    KImageIO::registerFormats(); 
+    
+    KFileDialog *fileSelectDialog = new KFileDialog(QString::null, KImageIO::pattern(), this, "", true);
+    fileSelectDialog->setCaption(i18n("Select a black frame image"));
+    fileSelectDialog->exec();
+    
+    //Load the selected file and insert into the list
+    
+    KURL url = fileSelectDialog->selectedURL();
+    new BlackFrameListViewItem(m_blackFrameListView, url);
+    delete fileSelectDialog;
 }
 
 void ImageEffect_HotPixels::renderingFinished(void)
 {
     m_filterMethodCombo->setEnabled(true);
-    m_blackFrameButton->setEnabled(true);
+    enableButton(Apply, true);     
 }
 
 void ImageEffect_HotPixels::resetValues(void)
@@ -151,7 +168,7 @@
 void ImageEffect_HotPixels::prepareEffect()
 {
     m_filterMethodCombo->setEnabled(false);
-    m_blackFrameButton->setEnabled(false);
+    enableButton(Apply, false);     
 
     QImage image = m_imagePreviewWidget->getOriginalClipImage();
     
@@ -190,7 +207,7 @@
 void ImageEffect_HotPixels::prepareFinal()
 {
     m_filterMethodCombo->setEnabled(false);
-    m_blackFrameButton->setEnabled(false);
+    enableButton(Apply, false);     
     
     Digikam::ImageIface iface(0, 0);
     QImage orgImage(iface.originalWidth(), iface.originalHeight(), 32);
--- trunk/extragear/graphics/digikamimageplugins/hotpixels/imageeffect_hotpixels.h #438992:438993
@@ -35,10 +35,9 @@
 #include "hotpixelfixer.h"
 
 class QComboBox;
-class QPushButton;
 
-class HotPixelViewWidget;
 class BlackFrameParser;
+class BlackFrameListView;
 
 namespace DigikamHotPixelsImagesPlugin
 {
@@ -56,12 +55,9 @@
 
     QComboBox            *m_filterMethodCombo;
     
-    QPushButton          *m_blackFrameButton;
-    
     QValueList<HotPixel>  m_hotPixelsList;
     
-    HotPixelViewWidget   *mHPViewWidget;
-    HotPixelViewWidget   *mPreviewWidget;
+    BlackFrameListView   *m_blackFrameListView;
     
     BlackFrameParser     *m_parser;
 
@@ -78,9 +74,7 @@
 private slots:
         
     void blackFrameParsed(QValueList<HotPixel> hpList);
-    void setupBlackFrames();
-
-
+    void slotApply();
 };
 
 }  // NameSpace DigikamHotPixelsImagesPlugin



More information about the Digikam-devel mailing list