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

Gilles Caulier caulier.gilles at gmail.com
Wed Jul 4 21:19:15 BST 2007


SVN commit 683505 by cgilles:

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


 M  +9 -18     CMakeLists.txt  
 M  +76 -81    imageeffect_colorfx.cpp  
 M  +2 -4      imageeffect_colorfx.h  
 M  +3 -2      imageplugin_colorfx.cpp  


--- trunk/extragear/graphics/digikam/imageplugins/colorfx/CMakeLists.txt #683504:683505
@@ -1,24 +1,15 @@
 
-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_colorfx_PART_SRCS imageplugin_colorfx.cpp 
+                                         imageeffect_colorfx.cpp 
+   )
 
+KDE4_AUTOMOC(${digikamimageplugin_colorfx_PART_SRCS})
 
-########### next target ###############
+KDE4_ADD_PLUGIN(digikamimageplugin_colorfx ${digikamimageplugin_colorfx_PART_SRCS})
 
-set(digikamimageplugin_colorfx_PART_SRCS imageplugin_colorfx.cpp imageeffect_colorfx.cpp )
+TARGET_LINK_LIBRARIES(digikamimageplugin_colorfx digikam)
 
+INSTALL(TARGETS digikamimageplugin_colorfx DESTINATION ${PLUGIN_INSTALL_DIR})
 
-kde4_automoc(${digikamimageplugin_colorfx_PART_SRCS})
-
-kde4_add_plugin(digikamimageplugin_colorfx ${digikamimageplugin_colorfx_PART_SRCS})
-
-target_link_libraries(digikamimageplugin_colorfx  digikam )
-
-install(TARGETS digikamimageplugin_colorfx DESTINATION ${PLUGIN_INSTALL_DIR} )
-
-
-########### install files ###############
-
-install( FILES  digikamimageplugin_colorfx_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam )
-install( FILES  digikamimageplugin_colorfx.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
-
+INSTALL(FILES digikamimageplugin_colorfx_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam)
+INSTALL(FILES digikamimageplugin_colorfx.desktop DESTINATION ${SERVICES_INSTALL_DIR})
--- trunk/extragear/graphics/digikam/imageplugins/colorfx/imageeffect_colorfx.cpp #683504:683505
@@ -25,20 +25,14 @@
 
 // Qt includes.
 
-#include <q3vgroupbox.h>
-#include <q3hgroupbox.h>
-#include <Q3HButtonGroup> 
-#include <qcombobox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-
-#include <qlayout.h>
-#include <q3frame.h>
-
-#include <qtooltip.h>
-//Added by qt3to4:
-#include <Q3HBoxLayout>
-#include <Q3GridLayout>
+#include <QGroupBox>
+#include <QButtonGroup> 
+#include <QComboBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QGridLayout>
 #include <QPixmap>
 
 // KDE includes.
@@ -110,107 +104,108 @@
 
     // -------------------------------------------------------------
 
-    QWidget *gboxSettings     = new QWidget(widget);
-    Q3GridLayout* gridSettings = new Q3GridLayout( gboxSettings, 9, 4, spacingHint());
+    QWidget *gboxSettings     = new QWidget(mainWidget());
+    QGridLayout* gridSettings = new QGridLayout(gboxSettings);
 
     QLabel *label1 = new QLabel(i18n("Channel:"), gboxSettings);
-    label1->setAlignment ( Qt::AlignRight | Qt::AlignVCenter );
-    m_channelCB = new QComboBox( false, gboxSettings );
-    m_channelCB->insertItem( i18n("Luminosity") );
-    m_channelCB->insertItem( i18n("Red") );
-    m_channelCB->insertItem( i18n("Green") );
-    m_channelCB->insertItem( i18n("Blue") );
+    label1->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
+    m_channelCB = new QComboBox( gboxSettings );
+    m_channelCB->addItem( i18n("Luminosity") );
+    m_channelCB->addItem( i18n("Red") );
+    m_channelCB->addItem( i18n("Green") );
+    m_channelCB->addItem( i18n("Blue") );
     m_channelCB->setWhatsThis( i18n("<p>Select here the histogram channel to display:<p>"
-                                       "<b>Luminosity</b>: display the image's luminosity values.<p>"
-                                       "<b>Red</b>: display the red image-channel values.<p>"
-                                       "<b>Green</b>: display the green image-channel values.<p>"
-                                       "<b>Blue</b>: display the blue image-channel values.<p>"));
+                                    "<b>Luminosity</b>: display the image's luminosity values.<p>"
+                                    "<b>Red</b>: display the red image-channel values.<p>"
+                                    "<b>Green</b>: display the green image-channel values.<p>"
+                                    "<b>Blue</b>: display the blue image-channel values.<p>"));
 
-    m_scaleBG = new Q3HButtonGroup(gboxSettings);
-    m_scaleBG->setExclusive(true);
-    //m_scaleBG->setFrameShape(QFrame::NoFrame);
-    m_scaleBG->setInsideMargin( 0 );
-    m_scaleBG->setWhatsThis( i18n("<p>Select here the histogram scale.<p>"
-                                     "If the image's maximal counts are small, you can use the linear scale.<p>"
-                                     "Logarithmic scale can be used when the maximal counts are big; "
-                                     "if it is used, all values (small and large) will be visible on the graph."));
+    QWidget *scaleBox = new QWidget(gboxSettings);
+    QHBoxLayout *hlay = new QHBoxLayout(scaleBox);
+    m_scaleBG         = new QButtonGroup(scaleBox);
+    scaleBox->setWhatsThis( i18n("<p>Select here the histogram scale.<p>"
+                                 "If the image's maximal counts are small, you can use the linear scale.<p>"
+                                 "Logarithmic scale can be used when the maximal counts are big; "
+                                 "if it is used, all values (small and large) will be visible on the graph."));
     
-    QPushButton *linHistoButton = new QPushButton( m_scaleBG );
+    QPushButton *linHistoButton = new QPushButton( scaleBox );
     linHistoButton->setToolTip( i18n( "<p>Linear" ) );
-    m_scaleBG->insert(linHistoButton, Digikam::HistogramWidget::LinScaleHistogram);
-    KGlobal::dirs()->addResourceType("histogram-lin", KGlobal::dirs()->kde_default("data") + "digikam/data");
-    QString directory = KGlobal::dirs()->findResourceDir("histogram-lin", "histogram-lin.png");
-    linHistoButton->setPixmap( QPixmap( directory + "histogram-lin.png" ) );
-    linHistoButton->setToggleButton(true);
+    linHistoButton->setIcon(QPixmap(KStandardDirs::locate("data", "digikam/data/histogram-lin.png")));
+    linHistoButton->setCheckable(true);
+    m_scaleBG->addButton(linHistoButton, Digikam::HistogramWidget::LinScaleHistogram);
     
-    QPushButton *logHistoButton = new QPushButton( m_scaleBG );
+    QPushButton *logHistoButton = new QPushButton( scaleBox );
     logHistoButton->setToolTip( i18n( "<p>Logarithmic" ) );
-    m_scaleBG->insert(logHistoButton, Digikam::HistogramWidget::LogScaleHistogram);
-    KGlobal::dirs()->addResourceType("histogram-log", KGlobal::dirs()->kde_default("data") + "digikam/data");
-    directory = KGlobal::dirs()->findResourceDir("histogram-log", "histogram-log.png");
-    logHistoButton->setPixmap( QPixmap( directory + "histogram-log.png" ) );
-    logHistoButton->setToggleButton(true);       
+    logHistoButton->setIcon(QPixmap(KStandardDirs::locate("data", "digikam/data/histogram-log.png")));
+    logHistoButton->setCheckable(true);
+    m_scaleBG->addButton(logHistoButton, Digikam::HistogramWidget::LogScaleHistogram);
+    
+    hlay->setMargin(0);
+    hlay->setSpacing(0);
+    hlay->addWidget(linHistoButton);
+    hlay->addWidget(logHistoButton);
 
-    Q3HBoxLayout* l1 = new Q3HBoxLayout();
+    m_scaleBG->setExclusive(true);
+    logHistoButton->setChecked(true);    
+
+    QHBoxLayout* l1 = new QHBoxLayout();
     l1->addWidget(label1);
     l1->addWidget(m_channelCB);
     l1->addStretch(10);
-    l1->addWidget(m_scaleBG);
+    l1->addWidget(scaleBox);
     
-    gridSettings->addMultiCellLayout(l1, 0, 0, 0, 4);
-
     // -------------------------------------------------------------
 
     KVBox *histoBox   = new KVBox(gboxSettings);
     m_histogramWidget = new Digikam::HistogramWidget(256, 140, histoBox, false, true, true);
     m_histogramWidget->setWhatsThis( i18n("<p>Here you can see the target preview image histogram drawing "
-                                             "of the selected image channel. This one is re-computed at any "
-                                             "settings changes."));
+                                          "of the selected image channel. This one is re-computed at any "
+                                          "settings changes."));
     QLabel *space = new QLabel(histoBox);
     space->setFixedHeight(1);    
     m_hGradient = new Digikam::ColorGradientWidget( Digikam::ColorGradientWidget::Horizontal, 10, histoBox );
     m_hGradient->setColors( QColor( "black" ), QColor( "white" ) );
     
-    gridSettings->addMultiCellWidget(histoBox, 1, 2, 0, 4);
-
     // -------------------------------------------------------------
 
     m_effectTypeLabel = new QLabel(i18n("Type:"), gboxSettings);
     
-    m_effectType = new QComboBox( false, gboxSettings );
-    m_effectType->insertItem( i18n("Solarize") );
-    m_effectType->insertItem( i18n("Vivid") );
-    m_effectType->insertItem( i18n("Neon") );    
-    m_effectType->insertItem( i18n("Find Edges") );    
+    m_effectType = new QComboBox( gboxSettings );
+    m_effectType->addItem( i18n("Solarize") );
+    m_effectType->addItem( i18n("Vivid") );
+    m_effectType->addItem( i18n("Neon") );    
+    m_effectType->addItem( i18n("Find Edges") );    
     m_effectType->setWhatsThis( i18n("<p>Select here the effect type to apply on the image.<p>"
-                                        "<b>Solarize</b>: simulates solarization of photograph.<p>"
-                                        "<b>Vivid</b>: simulates the Velvia(tm) slide film colors.<p>"
-                                        "<b>Neon</b>: coloring the edges in a photograph to "
-                                        "reproduce a fluorescent light effect.<p>"
-                                        "<b>Find Edges</b>: detects the edges in a photograph "
-                                        "and their strength."
-                                        ));
-    gridSettings->addMultiCellWidget(m_effectTypeLabel, 3, 3, 0, 4);
-    gridSettings->addMultiCellWidget(m_effectType, 4, 4, 0, 4);
+                                     "<b>Solarize</b>: simulates solarization of photograph.<p>"
+                                     "<b>Vivid</b>: simulates the Velvia(tm) slide film colors.<p>"
+                                     "<b>Neon</b>: coloring the edges in a photograph to "
+                                     "reproduce a fluorescent light effect.<p>"
+                                     "<b>Find Edges</b>: detects the edges in a photograph "
+                                     "and their strength."));
                                                   
     m_levelLabel = new QLabel(i18n("Level:"), gboxSettings);
     m_levelInput = new KIntNumInput(gboxSettings);
     m_levelInput->setRange(0, 100, 1, true);
     m_levelInput->setWhatsThis( i18n("<p>Set here the level of the effect."));
     
-    gridSettings->addMultiCellWidget(m_levelLabel, 5, 5, 0, 4);
-    gridSettings->addMultiCellWidget(m_levelInput, 6, 6, 0, 4);
-        
     m_iterationLabel = new QLabel(i18n("Iteration:"), gboxSettings);
     m_iterationInput = new KIntNumInput(gboxSettings);
     m_iterationInput->setRange(0, 100, 1, true);
     m_iterationInput->setWhatsThis( i18n("<p>This value controls the number of iterations "
-                                            "to use with Neon and Find Edges effects."));
+                                         "to use with Neon and Find Edges effects."));
     
+    gridSettings->addMultiCellLayout(l1, 0, 0, 0, 4);
+    gridSettings->addMultiCellWidget(histoBox, 1, 2, 0, 4);
+    gridSettings->addMultiCellWidget(m_effectTypeLabel, 3, 3, 0, 4);
+    gridSettings->addMultiCellWidget(m_effectType, 4, 4, 0, 4);
+    gridSettings->addMultiCellWidget(m_levelLabel, 5, 5, 0, 4);
+    gridSettings->addMultiCellWidget(m_levelInput, 6, 6, 0, 4);
     gridSettings->addMultiCellWidget(m_iterationLabel, 7, 7, 0, 4);
     gridSettings->addMultiCellWidget(m_iterationInput, 8, 8, 0, 4);
-
     gridSettings->setRowStretch(9, 10);
+    gridSettings->setMargin(spacingHint());
+    gridSettings->setSpacing(0);
+
     setUserAreaWidget(gboxSettings);
 
     // -------------------------------------------------------------
@@ -218,7 +213,7 @@
     connect(m_channelCB, SIGNAL(activated(int)),
             this, SLOT(slotChannelChanged(int)));
 
-    connect(m_scaleBG, SIGNAL(released(int)),
+    connect(m_scaleBG, SIGNAL(buttonReleased(int)),
             this, SLOT(slotScaleChanged(int)));
 
     connect(m_previewWidget, SIGNAL(spotPositionChangedFromTarget( const Digikam::DColor &, const QPoint & )),
@@ -251,17 +246,17 @@
 {
     KSharedConfig::Ptr config = KGlobal::config();
     KConfigGroup group = config->group("coloreffect Tool Dialog");
-    m_effectType->setCurrentItem(group.readEntry("EffectType", (int)ColorFX));
+    m_effectType->setCurrentIndex(group.readEntry("EffectType", (int)ColorFX));
     m_levelInput->setValue(group.readEntry("LevelAjustment", 0));
     m_iterationInput->setValue(group.readEntry("IterationAjustment", 3));
-    slotEffectTypeChanged(m_effectType->currentItem());  //check for enable/disable of iteration
+    slotEffectTypeChanged(m_effectType->currentIndex());  //check for enable/disable of iteration
 }
 
 void ImageEffect_ColorFX::writeUserSettings()
 {
     KSharedConfig::Ptr config = KGlobal::config();
     KConfigGroup group = config->group("coloreffect Tool Dialog");
-    group.writeEntry("EffectType", m_effectType->currentItem());
+    group.writeEntry("EffectType", m_effectType->currentIndex());
     group.writeEntry("LevelAjustment", m_levelInput->value());
     group.writeEntry("IterationAjustment", m_iterationInput->value());
     group.sync();
@@ -297,13 +292,13 @@
             break;
     }
 
-    m_histogramWidget->repaint(false);
+    m_histogramWidget->repaint();
 }
 
 void ImageEffect_ColorFX::slotScaleChanged(int scale)
 {
     m_histogramWidget->m_scaleType = scale;
-    m_histogramWidget->repaint(false);
+    m_histogramWidget->repaint();
 }
 
 void ImageEffect_ColorFX::slotColorSelectedFromTarget( const Digikam::DColor &color )
@@ -395,7 +390,7 @@
         colorEffect(data, w, h, sb);
         QString name;
 
-        switch (m_effectType->currentItem())
+        switch (m_effectType->currentIndex())
         {
             case ColorFX:
                 name = i18n("ColorFX");
@@ -424,7 +419,7 @@
 
 void ImageEffect_ColorFX::colorEffect(uchar *data, int w, int h, bool sb)
 {
-    switch (m_effectType->currentItem())
+    switch (m_effectType->currentIndex())
     {
         case ColorFX:
             solarize(m_levelInput->value(), data, w, h, sb);
--- trunk/extragear/graphics/digikam/imageplugins/colorfx/imageeffect_colorfx.h #683504:683505
@@ -29,10 +29,8 @@
 // Digikam includes.
 
 #include "imagedlgbase.h"
-//Added by qt3to4:
-#include <QLabel>
 
-class Q3HButtonGroup;
+class QButtonGroup;
 class QComboBox;
 class QLabel;
 
@@ -111,7 +109,7 @@
     QComboBox                    *m_channelCB;
     QComboBox                    *m_effectType;
     
-    Q3HButtonGroup                *m_scaleBG;
+    QButtonGroup                 *m_scaleBG;
 
     QLabel                       *m_effectTypeLabel;
     QLabel                       *m_levelLabel;
--- trunk/extragear/graphics/digikam/imageplugins/colorfx/imageplugin_colorfx.cpp #683504:683505
@@ -47,7 +47,9 @@
 {
     m_solarizeAction  = new KAction(KIcon("colorfx"), i18n("Color Effects..."), this);
     actionCollection()->addAction("imageplugin_colorfx", m_solarizeAction );
-    connect(m_solarizeAction, SIGNAL(triggered(bool) ), SLOT(slotColorFX()));
+
+    connect(m_solarizeAction, SIGNAL(triggered(bool) ), 
+            this, SLOT(slotColorFX()));
                 
     setXMLFile( "digikamimageplugin_colorfx_ui.rc" );    
         
@@ -68,4 +70,3 @@
     DigikamColorFXImagesPlugin::ImageEffect_ColorFX dlg(parentWidget());
     dlg.exec();
 }
-



More information about the Digikam-devel mailing list