[Digikam-devel] extragear/graphics/digikam/imageplugins/blurfx

Gilles Caulier caulier.gilles at gmail.com
Thu Jul 5 11:09:47 BST 2007


SVN commit 683797 by cgilles:

digiKam from trunk : complete KDE4 port of BlurFX image plugin.
CCMAIL: digikam-devel at kde.org


 M  +10 -16    CMakeLists.txt  
 M  +1 -1      blurfx.cpp  
 M  +10 -10    blurfx.h  
 M  +70 -71    imageeffect_blurfx.cpp  
 M  +0 -2      imageeffect_blurfx.h  
 M  +3 -1      imageplugin_blurfx.cpp  
 M  +1 -2      imageplugin_blurfx.h  


--- trunk/extragear/graphics/digikam/imageplugins/blurfx/CMakeLists.txt #683796:683797
@@ -1,22 +1,16 @@
 
-include_directories( ${CMAKE_SOURCE_DIR}/digikam/utilities/imageeditor/editor ${CMAKE_SOURCE_DIR}/digikam/utilities/imageeditor/canvas ${CMAKE_SOURCE_DIR}/digikam/libs/histogram ${CMAKE_SOURCE_DIR}/digikam/libs/levels ${CMAKE_SOURCE_DIR}/digikam/libs/curves ${CMAKE_SOURCE_DIR}/digikam/libs/whitebalance ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/common ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/iccprofiles ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/imageplugins ${CMAKE_SOURCE_DIR}/digikam/libs/dialogs ${CMAKE_SOURCE_DIR}/digikam/libs/dimg ${CMAKE_SOURCE_DIR}/digikam/libs/dmetadata ${CMAKE_SOURCE_DIR}/digikam/libs/dimg/filters ${CMAKE_SOURCE_DIR}/digikam/digikam   )
+SET(digikamimageplugin_blurfx_PART_SRCS imageplugin_blurfx.cpp
+                                        imageeffect_blurfx.cpp 
+                                        blurfx.cpp 
+   )
 
+KDE4_AUTOMOC(${digikamimageplugin_blurfx_PART_SRCS})
 
-########### next target ###############
+KDE4_ADD_PLUGIN(digikamimageplugin_blurfx ${digikamimageplugin_blurfx_PART_SRCS})
 
-set(digikamimageplugin_blurfx_PART_SRCS imageplugin_blurfx.cpp imageeffect_blurfx.cpp blurfx.cpp )
+TARGET_LINK_LIBRARIES(digikamimageplugin_blurfx digikam)
 
-kde4_automoc(${digikamimageplugin_blurfx_PART_SRCS})
+INSTALL(TARGETS digikamimageplugin_blurfx DESTINATION ${PLUGIN_INSTALL_DIR})
 
-kde4_add_plugin(digikamimageplugin_blurfx ${digikamimageplugin_blurfx_PART_SRCS})
-
-target_link_libraries(digikamimageplugin_blurfx  digikam )
-
-install(TARGETS digikamimageplugin_blurfx DESTINATION ${PLUGIN_INSTALL_DIR} )
-
-
-########### install files ###############
-
-install( FILES  digikamimageplugin_blurfx_ui.rc      DESTINATION ${DATA_INSTALL_DIR}/digikam )
-install( FILES  digikamimageplugin_blurfx.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
+INSTALL(FILES digikamimageplugin_blurfx_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam)
+INSTALL(FILES digikamimageplugin_blurfx.desktop DESTINATION ${SERVICES_INSTALL_DIR})
--- trunk/extragear/graphics/digikam/imageplugins/blurfx/blurfx.cpp #683796:683797
@@ -36,7 +36,7 @@
 
 // Qt includes.
 
-#include <qdatetime.h>
+#include <QDateTime>
 
 // Local includes.
 
--- trunk/extragear/graphics/digikam/imageplugins/blurfx/blurfx.h #683796:683797
@@ -49,16 +49,16 @@
 
     enum BlurFXTypes 
     {
-    ZoomBlur=0,
-    RadialBlur,
-    FarBlur,
-    MotionBlur,
-    SoftenerBlur,
-    ShakeBlur,
-    FocusBlur,
-    SmartBlur,
-    FrostGlass,
-    Mosaic
+        ZoomBlur=0,
+        RadialBlur,
+        FarBlur,
+        MotionBlur,
+        SoftenerBlur,
+        ShakeBlur,
+        FocusBlur,
+        SmartBlur,
+        FrostGlass,
+        Mosaic
     };
 
 private:  // BlurFX filter data.
--- trunk/extragear/graphics/digikam/imageplugins/blurfx/imageeffect_blurfx.cpp #683796:683797
@@ -24,16 +24,13 @@
 
 // Qt includes. 
  
-#include <qlabel.h>
+#include <QLabel>
+#include <QSlider>
+#include <QImage>
+#include <QComboBox>
+#include <QDateTime> 
+#include <QGridLayout>
 
-#include <qlayout.h>
-#include <qslider.h>
-#include <qimage.h>
-#include <qcombobox.h>
-#include <qdatetime.h> 
-//Added by qt3to4:
-#include <Q3GridLayout>
-
 // KDE includes.
 
 #include <kconfig.h>
@@ -88,63 +85,66 @@
     // -------------------------------------------------------------
 
     QWidget *gboxSettings     = new QWidget(m_imagePreviewWidget);
-    Q3GridLayout* gridSettings = new Q3GridLayout( gboxSettings, 5, 1, 0, spacingHint());
+    QGridLayout* gridSettings = new QGridLayout( gboxSettings );
     
     m_effectTypeLabel = new QLabel(i18n("Type:"), gboxSettings);
     
-    m_effectType = new QComboBox( false, gboxSettings );
-    m_effectType->insertItem( i18n("Zoom Blur") );
-    m_effectType->insertItem( i18n("Radial Blur") );
-    m_effectType->insertItem( i18n("Far Blur") );
-    m_effectType->insertItem( i18n("Motion Blur") );
-    m_effectType->insertItem( i18n("Softener Blur") );
-    m_effectType->insertItem( i18n("Skake Blur") );
-    m_effectType->insertItem( i18n("Focus Blur") );
-    m_effectType->insertItem( i18n("Smart Blur") );
-    m_effectType->insertItem( i18n("Frost Glass") );
-    m_effectType->insertItem( i18n("Mosaic") );
+    m_effectType      = new QComboBox( gboxSettings );
+    m_effectType->addItem( i18n("Zoom Blur") );
+    m_effectType->addItem( i18n("Radial Blur") );
+    m_effectType->addItem( i18n("Far Blur") );
+    m_effectType->addItem( i18n("Motion Blur") );
+    m_effectType->addItem( i18n("Softener Blur") );
+    m_effectType->addItem( i18n("Skake Blur") );
+    m_effectType->addItem( i18n("Focus Blur") );
+    m_effectType->addItem( i18n("Smart Blur") );
+    m_effectType->addItem( i18n("Frost Glass") );
+    m_effectType->addItem( i18n("Mosaic") );
     m_effectType->setWhatsThis( i18n("<p>Select here the blurring effect to apply on image.<p>"
-                                        "<b>Zoom Blur</b>:  blurs the image along radial lines starting from "
-                                        "a specified center point. This simulates the blur of a zooming camera.<p>"
-                                        "<b>Radial Blur</b>: blurs the image by rotating the pixels around "
-                                        "the specified center point. This simulates the blur of a rotating camera.<p>"
-                                        "<b>Far Blur</b>: blurs the image by using far pixels. This simulates the blur "
-                                        "of an unfocalized camera lens.<p>"
-                                        "<b>Motion Blur</b>: blurs the image by moving the pixels horizontally. "
-                                        "This simulates the blur of a linear moving camera.<p>"
-                                        "<b>Softener Blur</b>: blurs the image softly in dark tones and hardly in light "
-                                        "tones. This gives images a dreamy and glossy soft focus effect. It's ideal "
-                                        "for creating romantic portraits, glamour photographs, or giving images a warm "
-                                        "and subtle glow.<p>"
-                                        "<b>Skake Blur</b>: blurs the image by skaking randomly the pixels. "
-                                        "This simulates the blur of a random moving camera.<p>"
-                                        "<b>Focus Blur</b>: blurs the image corners to reproduce the astigmatism distortion "
-                                        "of a lens.<p>"
-                                        "<b>Smart Blur</b>: finds the edges of color in your image and blurs them without "
-                                        "muddying the rest of the image.<p>"
-                                        "<b>Frost Glass</b>: blurs the image by randomly disperse light coming through "
-                                        "a frosted glass.<p>"
-                                        "<b>Mosaic</b>: divides the photograph into rectangular cells and then "
-                                        "recreates it by filling those cells with average pixel value."));
-    gridSettings->addMultiCellWidget(m_effectTypeLabel, 0, 0, 0, 1);
-    gridSettings->addMultiCellWidget(m_effectType, 1, 1, 0, 1);
+                                     "<b>Zoom Blur</b>:  blurs the image along radial lines starting from "
+                                     "a specified center point. This simulates the blur of a zooming camera.<p>"
+                                     "<b>Radial Blur</b>: blurs the image by rotating the pixels around "
+                                     "the specified center point. This simulates the blur of a rotating camera.<p>"
+                                     "<b>Far Blur</b>: blurs the image by using far pixels. This simulates the blur "
+                                     "of an unfocalized camera lens.<p>"
+                                     "<b>Motion Blur</b>: blurs the image by moving the pixels horizontally. "
+                                     "This simulates the blur of a linear moving camera.<p>"
+                                     "<b>Softener Blur</b>: blurs the image softly in dark tones and hardly in light "
+                                     "tones. This gives images a dreamy and glossy soft focus effect. It's ideal "
+                                     "for creating romantic portraits, glamour photographs, or giving images a warm "
+                                     "and subtle glow.<p>"
+                                     "<b>Skake Blur</b>: blurs the image by skaking randomly the pixels. "
+                                     "This simulates the blur of a random moving camera.<p>"
+                                     "<b>Focus Blur</b>: blurs the image corners to reproduce the astigmatism distortion "
+                                     "of a lens.<p>"
+                                     "<b>Smart Blur</b>: finds the edges of color in your image and blurs them without "
+                                     "muddying the rest of the image.<p>"
+                                     "<b>Frost Glass</b>: blurs the image by randomly disperse light coming through "
+                                     "a frosted glass.<p>"
+                                     "<b>Mosaic</b>: divides the photograph into rectangular cells and then "
+                                     "recreates it by filling those cells with average pixel value."));
                                                   
     m_distanceLabel = new QLabel(i18n("Distance:"), gboxSettings);
     m_distanceInput = new KIntNumInput(gboxSettings);
     m_distanceInput->setRange(0, 100, 1, true);    
     m_distanceInput->setWhatsThis( i18n("<p>Set here the blur distance in pixels."));
     
-    gridSettings->addMultiCellWidget(m_distanceLabel, 2, 2, 0, 1);
-    gridSettings->addMultiCellWidget(m_distanceInput, 3, 3, 0, 1);
-        
     m_levelLabel = new QLabel(i18n("Level:"), gboxSettings);
     m_levelInput = new KIntNumInput(gboxSettings);
     m_levelInput->setRange(0, 360, 1, true);
     m_levelInput->setWhatsThis( i18n("<p>This value controls the level to use with the current effect."));  
+
+    // -------------------------------------------------------------
     
+    gridSettings->addMultiCellWidget(m_effectTypeLabel, 0, 0, 0, 1);
+    gridSettings->addMultiCellWidget(m_effectType, 1, 1, 0, 1);
+    gridSettings->addMultiCellWidget(m_distanceLabel, 2, 2, 0, 1);
+    gridSettings->addMultiCellWidget(m_distanceInput, 3, 3, 0, 1);
     gridSettings->addMultiCellWidget(m_levelLabel, 4, 4, 0, 1);
     gridSettings->addMultiCellWidget(m_levelInput, 5, 5, 0, 1);
-    
+    gridSettings->setMargin(spacingHint());
+    gridSettings->setSpacing(spacingHint());
+
     m_imagePreviewWidget->setUserAreaWidget(gboxSettings);
         
     // -------------------------------------------------------------
@@ -171,8 +171,8 @@
     m_distanceInput->setEnabled(true);
     m_distanceLabel->setEnabled(true);
     
-    switch (m_effectType->currentItem())
-       {
+    switch (m_effectType->currentIndex())
+    {
        case BlurFX::ZoomBlur:
        case BlurFX::RadialBlur:
        case BlurFX::FarBlur:
@@ -192,7 +192,7 @@
           m_distanceInput->setEnabled(false);
           m_distanceLabel->setEnabled(false);
           break;
-       }
+    }
 }
 
 void ImageEffect_BlurFX::readUserSettings()
@@ -202,7 +202,7 @@
     m_effectType->blockSignals(true);
     m_distanceInput->blockSignals(true);
     m_levelInput->blockSignals(true);
-    m_effectType->setCurrentItem(group.readEntry("EffectType", (int)BlurFX::ZoomBlur));
+    m_effectType->setCurrentIndex(group.readEntry("EffectType", (int)BlurFX::ZoomBlur));
     m_distanceInput->setValue(group.readEntry("DistanceAjustment", 3));
     m_levelInput->setValue(group.readEntry("LevelAjustment", 128));
     m_effectType->blockSignals(false);
@@ -214,7 +214,7 @@
 {
     KSharedConfig::Ptr config = KGlobal::config();
     KConfigGroup group = config->group("blurfx Tool Dialog");
-    group.writeEntry("EffectType", m_effectType->currentItem());
+    group.writeEntry("EffectType", m_effectType->currentIndex());
     group.writeEntry("DistanceAjustment", m_distanceInput->value());
     group.writeEntry("LevelAjustment", m_levelInput->value());
     group.sync();
@@ -222,8 +222,8 @@
 
 void ImageEffect_BlurFX::resetValues()
 {
-       m_effectType->setCurrentItem(BlurFX::ZoomBlur);
-       slotEffectTypeChanged(BlurFX::ZoomBlur);
+    m_effectType->setCurrentIndex(BlurFX::ZoomBlur);
+    slotEffectTypeChanged(BlurFX::ZoomBlur);
 } 
 
 void ImageEffect_BlurFX::slotEffectTypeChanged(int type)
@@ -242,7 +242,7 @@
     m_levelLabel->setEnabled(false);
           
     switch (type)
-       {
+    {
        case BlurFX::ZoomBlur:
           break;
        
@@ -289,7 +289,7 @@
           m_distanceInput->setRange(0, 50, 1, true);
           m_distanceInput->setValue(3);
           break;
-       }
+    }
 
     m_distanceInput->blockSignals(false);
     m_levelInput->blockSignals(false);
@@ -308,16 +308,16 @@
 
     Digikam::DImg image;
 
-    switch (m_effectType->currentItem())
-       {
+    switch (m_effectType->currentIndex())
+    {
        case BlurFX::ZoomBlur:
        case BlurFX::RadialBlur:
        case BlurFX::FocusBlur:
-            {
+       {
             Digikam::ImageIface iface(0, 0);
             image = *iface.getOriginalImg();
             break;
-            }
+       }
 
        case BlurFX::FarBlur:
        case BlurFX::MotionBlur:
@@ -328,9 +328,9 @@
        case BlurFX::Mosaic: 
            image = m_imagePreviewWidget->getOriginalRegionImage();
            break;
-       }
+    }
 
-    int t = m_effectType->currentItem();
+    int t = m_effectType->currentIndex();
     int d = m_distanceInput->value();
     int l = m_levelInput->value();
 
@@ -346,7 +346,7 @@
     m_levelInput->setEnabled(false);
     m_levelLabel->setEnabled(false);
 
-    int t = m_effectType->currentItem();
+    int t = m_effectType->currentIndex();
     int d = m_distanceInput->value();
     int l = m_levelInput->value();
 
@@ -356,17 +356,17 @@
 
 void ImageEffect_BlurFX::putPreviewData(void)
 {
-    switch (m_effectType->currentItem())
-        {
+    switch (m_effectType->currentIndex())
+    {
         case BlurFX::ZoomBlur:
         case BlurFX::RadialBlur:
         case BlurFX::FocusBlur:
-            {
+        {
             QRect pRect    = m_imagePreviewWidget->getOriginalImageRegionToRender();
             Digikam::DImg destImg = m_threadedFilter->getTargetImage().copy(pRect);
             m_imagePreviewWidget->setPreviewImage(destImg);
             break;
-            }
+        }
         case BlurFX::FarBlur:
         case BlurFX::MotionBlur:
         case BlurFX::SoftenerBlur:
@@ -376,7 +376,7 @@
         case BlurFX::Mosaic: 
             m_imagePreviewWidget->setPreviewImage(m_threadedFilter->getTargetImage());
             break;
-        }
+    }
 }
 
 void ImageEffect_BlurFX::putFinalData(void)
@@ -388,4 +388,3 @@
 }
 
 }  // NameSpace DigikamBlurFXImagesPlugin
-
--- trunk/extragear/graphics/digikam/imageplugins/blurfx/imageeffect_blurfx.h #683796:683797
@@ -28,8 +28,6 @@
 // Digikam includes.
 
 #include "ctrlpaneldlg.h"
-//Added by qt3to4:
-#include <QLabel>
 
 class QComboBox;
 class QLabel;
--- trunk/extragear/graphics/digikam/imageplugins/blurfx/imageplugin_blurfx.cpp #683796:683797
@@ -45,7 +45,9 @@
 {
     m_blurfxAction  = new KAction(KIcon("blurfx"), i18n("Blur Effects..."), this);
     actionCollection()->addAction("imageplugin_blurfx", m_blurfxAction );
-    connect(m_blurfxAction, SIGNAL(triggered(bool) ), SLOT(slotBlurFX()));
+
+    connect(m_blurfxAction, SIGNAL(triggered(bool)), 
+            this, SLOT(slotBlurFX()));
                 
     setXMLFile( "digikamimageplugin_blurfx_ui.rc" );    
         
--- trunk/extragear/graphics/digikam/imageplugins/blurfx/imageplugin_blurfx.h #683796:683797
@@ -37,8 +37,7 @@
     
 public:
 
-    ImagePlugin_BlurFX(QObject *parent,
-                       const QStringList &args);
+    ImagePlugin_BlurFX(QObject *parent, const QStringList &args);
     ~ImagePlugin_BlurFX();
     
     void setEnabledActions(bool enable);



More information about the Digikam-devel mailing list