[Digikam-devel] extragear/graphics/digikam

Gilles Caulier caulier.gilles at gmail.com
Fri Jan 8 12:59:11 GMT 2010


SVN commit 1071622 by cgilles:

under/over/cm indicator : information is propagated to all editor tools preview now (I hope to not forget something there).
Preview incator buttons are removed. Use status bar buttons, or menu options, or keyboard shortcuts to switch indicators.

This is not yet editor tools preview factorization. This require image preview port to Qt4.
Andi, please, can you help me to merge with current devel branche to trunk after 1.1 release ?

At least this commit simplify source code, and will help for future factoring.

CCMAIL: digikam-devel at kde.org


 M  +8 -2      libs/widgets/imageplugins/imageguidewidget.cpp  
 M  +2 -1      libs/widgets/imageplugins/imageguidewidget.h  
 M  +13 -2     libs/widgets/imageplugins/imagepanelwidget.cpp  
 M  +7 -2      libs/widgets/imageplugins/imagepanelwidget.h  
 M  +1 -1      libs/widgets/imageplugins/imageregionwidget.cpp  
 M  +1 -2      libs/widgets/imageplugins/imageregionwidget.h  
 M  +30 -58    libs/widgets/imageplugins/imagewidget.cpp  
 M  +6 -2      libs/widgets/imageplugins/imagewidget.h  
 M  +28 -6     utilities/imageeditor/editor/editortool.cpp  
 M  +3 -3      utilities/imageeditor/editor/editortool.h  


--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imageguidewidget.cpp #1071621:1071622
@@ -6,7 +6,7 @@
  * Date        : 2004-11-16
  * Description : a widget to display an image with guides
  *
- * Copyright (C) 2004-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2004-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -42,7 +42,6 @@
 
 // KDE includes
 
-
 #include <kstandarddirs.h>
 #include <kcursor.h>
 #include <kglobal.h>
@@ -51,6 +50,8 @@
 
 #include "dimg.h"
 #include "imageiface.h"
+#include "exposurecontainer.h"
+#include "iccsettingscontainer.h"
 
 namespace Digikam
 {
@@ -199,6 +200,11 @@
     updatePreview();
 }
 
+void ImageGuideWidget::slotCMViewSettingsChanged()
+{
+    updatePreview();
+}
+
 void ImageGuideWidget::resetSpotPosition()
 {
     d->spot.setX( d->width  / 2 );
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imageguidewidget.h #1071621:1071622
@@ -6,7 +6,7 @@
  * Date        : 2004-08-20
  * Description : a widget to display an image with guides
  *
- * Copyright (C) 2004-2009 Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2004-2010 Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -115,6 +115,7 @@
     void slotChangeRenderingPreviewMode(int mode);
     void slotToggleUnderExposure(bool);
     void slotToggleOverExposure(bool);
+    void slotCMViewSettingsChanged();
 
 Q_SIGNALS:
 
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imagepanelwidget.cpp #1071621:1071622
@@ -6,7 +6,7 @@
  * Date        : 2005-07-01
  * Description : a widget to draw a control panel image tool.
  *
- * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -41,7 +41,6 @@
 
 // KDE includes
 
-
 #include <kapplication.h>
 #include <kconfig.h>
 #include <kcursor.h>
@@ -53,6 +52,8 @@
 
 // Local includes
 
+#include "exposurecontainer.h"
+#include "iccsettingscontainer.h"
 #include "thumbnailsize.h"
 #include "imageregionwidget.h"
 #include "imagepaniconwidget.h"
@@ -336,4 +337,14 @@
                                            rect.width(), rect.height()));
 }
 
+void ImagePanelWidget::setICCSettings(ICCSettingsContainer*)
+{
+    d->imageRegionWidget->viewport()->repaint();
+}
+
+void ImagePanelWidget::setExposureSettings(ExposureSettingsContainer*)
+{
+    // NOTE : not yet managed here by imageRegionWidget.
+}
+
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imagepanelwidget.h #1071621:1071622
@@ -6,7 +6,7 @@
  * Date        : 2005-07-01
  * Description : a widget to draw a control panel image tool.
  *
- * Copyright (C) 2005-2008 Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005-2010 Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -43,9 +43,11 @@
 namespace Digikam
 {
 
-class ImagePanelWidgetPriv;
+class ExposureSettingsContainer;
+class ICCSettingsContainer;
 class ImageRegionWidget;
 class ImagePanIconWidget;
+class ImagePanelWidgetPriv;
 
 class DIGIKAM_EXPORT ImagePanelWidget : public QWidget
 {
@@ -76,6 +78,9 @@
 
     void   setPanIconHighLightPoints(const QPolygon& pt);
 
+    void   setExposureSettings(ExposureSettingsContainer*);
+    void   setICCSettings(ICCSettingsContainer*);
+    
     void   writeSettings();
 
     ImageRegionWidget *previewWidget() const;
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imageregionwidget.cpp #1071621:1071622
@@ -6,7 +6,7 @@
  * Date        : 2004-08-17
  * Description : a widget to draw an image clip region.
  *
- * Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2004-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imageregionwidget.h #1071621:1071622
@@ -6,7 +6,7 @@
  * Date        : 2004-08-17
  * Description : a widget to draw an image clip region.
  *
- * Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2004-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -94,7 +94,6 @@
 
 private:
 
-    void  updatePixmap(DImg& img);
     QRect getLocalTargetImageRegion();
     QRect getLocalImageRegionToRender();
     void  viewportPaintExtraData();
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imagewidget.cpp #1071621:1071622
@@ -7,7 +7,7 @@
  * Description : a widget to display an image preview with some
  *               modes to compare effect results.
  *
- * Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -36,7 +36,6 @@
 
 // KDE includes
 
-
 #include <kapplication.h>
 #include <kconfig.h>
 #include <kdialog.h>
@@ -46,6 +45,12 @@
 #include <ksqueezedtextlabel.h>
 #include <kstandarddirs.h>
 
+// Local includes
+
+#include "exposurecontainer.h"
+#include "iccsettingscontainer.h"
+
+
 namespace Digikam
 {
 
@@ -55,28 +60,23 @@
 
     ImageWidgetPriv()
     {
-        spotInfoLabel       = 0;
-        previewButtons      = 0;
-        underExposureButton = 0;
-        overExposureButton  = 0;
-        previewWidget       = 0;
-        prevBBox            = 0;
-        expoBBox            = 0;
+        spotInfoLabel  = 0;
+        previewButtons = 0;
+        previewWidget  = 0;
+        prevBBox       = 0;
+        expoBBox       = 0;
     }
 
-    QWidget            *prevBBox;
-    QWidget            *expoBBox;
+    QWidget*            prevBBox;
+    QWidget*            expoBBox;
 
     QString             settingsSection;
 
-    QButtonGroup       *previewButtons;
+    QButtonGroup*       previewButtons;
 
-    QToolButton        *underExposureButton;
-    QToolButton        *overExposureButton;
+    KSqueezedTextLabel* spotInfoLabel;
 
-    KSqueezedTextLabel *spotInfoLabel;
-
-    ImageGuideWidget   *previewWidget;
+    ImageGuideWidget*   previewWidget;
 };
 
 ImageWidget::ImageWidget(const QString& settingsSection, QWidget *parent,
@@ -170,33 +170,6 @@
 
     // -------------------------------------------------------------
 
-    d->expoBBox                   = new QWidget(this);
-    QHBoxLayout *hlay2            = new QHBoxLayout(d->expoBBox);
-    QButtonGroup *exposureButtons = new QButtonGroup(d->expoBBox);
-    exposureButtons->setExclusive(false);
-    hlay2->setSpacing(0);
-    hlay2->setMargin(0);
-
-    d->underExposureButton = new QToolButton(d->expoBBox);
-    exposureButtons->addButton(d->underExposureButton, UnderExposure);
-    hlay2->addWidget(d->underExposureButton);
-    d->underExposureButton->setIcon(SmallIcon("underexposure"));
-    d->underExposureButton->setCheckable(true);
-    d->underExposureButton->setWhatsThis( i18n("Set this option to display black "
-                                               "overlaid on the preview. This will help you to avoid "
-                                               "under-exposing the image." ) );
-
-    d->overExposureButton = new QToolButton(d->expoBBox);
-    exposureButtons->addButton(d->overExposureButton, OverExposure);
-    hlay2->addWidget(d->overExposureButton);
-    d->overExposureButton->setIcon(SmallIcon("overexposure"));
-    d->overExposureButton->setCheckable(true);
-    d->overExposureButton->setWhatsThis( i18n("Set this option to display white "
-                                              "overlaid on the preview. This will help you to avoid "
-                                              "over-exposing the image." ) );
-
-    // -------------------------------------------------------------
-
     QFrame *frame    = new QFrame(this);
     frame->setFrameStyle(QFrame::Panel|QFrame::Sunken);
     QVBoxLayout* l   = new QVBoxLayout(frame);
@@ -212,8 +185,7 @@
 
     grid->addWidget(d->prevBBox,      1, 0, 1, 1);
     grid->addWidget(d->spotInfoLabel, 1, 1, 1, 1);
-    grid->addWidget(d->expoBBox,      1, 3, 1, 1);
-    grid->addWidget(frame,            3, 0, 1, 4 );
+    grid->addWidget(frame,            3, 0, 1, 4);
     grid->setColumnMinimumWidth(2, KDialog::spacingHint());
     grid->setColumnMinimumWidth(1, KDialog::spacingHint());
     grid->setRowMinimumHeight(0, KDialog::spacingHint());
@@ -243,12 +215,6 @@
     connect(d->previewButtons, SIGNAL(buttonReleased(int)),
             d->previewWidget, SLOT(slotChangeRenderingPreviewMode(int)));
 
-    connect(d->underExposureButton, SIGNAL(toggled(bool)),
-            d->previewWidget, SLOT(slotToggleUnderExposure(bool)));
-
-    connect(d->overExposureButton, SIGNAL(toggled(bool)),
-            d->previewWidget, SLOT(slotToggleOverExposure(bool)));
-
     // -------------------------------------------------------------
 
     if (prevModeOptions)
@@ -337,9 +303,6 @@
     KSharedConfig::Ptr config = KGlobal::config();
     KConfigGroup group        = config->group(d->settingsSection);
 
-    d->underExposureButton->setChecked(group.readEntry("Under Exposure Indicator", false));
-    d->overExposureButton->setChecked(group.readEntry("Over Exposure Indicator", false));
-
     int mode = group.readEntry("Separate View", (int)ImageGuideWidget::PreviewBothImagesVertCont);
     mode     = qMax((int)ImageGuideWidget::PreviewOriginalImage, mode);
     mode     = qMin((int)ImageGuideWidget::NoPreviewMode, mode);
@@ -350,9 +313,7 @@
 {
     KSharedConfig::Ptr config = KGlobal::config();
     KConfigGroup group        = config->group(d->settingsSection);
-    group.writeEntry("Separate View",            getRenderingPreviewMode());
-    group.writeEntry("Under Exposure Indicator", d->underExposureButton->isChecked());
-    group.writeEntry("Over Exposure Indicator",  d->overExposureButton->isChecked());
+    group.writeEntry("Separate View", getRenderingPreviewMode());
     config->sync();
 }
 
@@ -391,4 +352,15 @@
     d->previewWidget->setEraseMode(erase);
 }
 
+void ImageWidget::setICCSettings(ICCSettingsContainer*)
+{
+    d->previewWidget->slotCMViewSettingsChanged();
+}
+
+void ImageWidget::setExposureSettings(ExposureSettingsContainer* settings)
+{
+    d->previewWidget->slotToggleUnderExposure(settings->underExposureIndicator);
+    d->previewWidget->slotToggleOverExposure(settings->overExposureIndicator);
+}
+
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imagewidget.h #1071621:1071622
@@ -7,7 +7,7 @@
  * Description : a widget to display an image preview with some
  *               modes to compare effect results.
  *
- * Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -41,6 +41,8 @@
 namespace Digikam
 {
 
+class ExposureSettingsContainer;
+class ICCSettingsContainer;
 class ImageIface;
 class ImageWidgetPriv;
 
@@ -82,7 +84,9 @@
     void   setMaskEnabled(bool enabled);
     void   setMaskPenSize(int size);
     void   setEraseMode(bool erase);
-
+    void   setExposureSettings(ExposureSettingsContainer*);
+    void   setICCSettings(ICCSettingsContainer*);
+    
     QImage getMask() const;
 
 public Q_SLOTS:
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editortool.cpp #1071621:1071622
@@ -6,7 +6,7 @@
  * Date        : 2008-08-20
  * Description : editor tool template class.
  *
- * Copyright (C) 2008-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2008-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -58,12 +58,12 @@
         settings = 0;
     }
 
-    QString             helpAnchor;
-    QString             name;
+    QString  helpAnchor;
+    QString  name;
 
-    QWidget*            view;
-    QPixmap             icon;
-    QTimer*             timer;
+    QWidget* view;
+    QPixmap  icon;
+    QTimer*  timer;
 
     EditorToolSettings* settings;
 };
@@ -227,6 +227,28 @@
     slotCancel();
 }
 
+void EditorTool::setICCSettings(ICCSettingsContainer* settings)
+{
+    ImageWidget* view = dynamic_cast<ImageWidget*>(d->view);
+    if (view)
+        view->setICCSettings(settings);
+
+    ImagePanelWidget* view2 = dynamic_cast<ImagePanelWidget*>(d->view);
+    if (view2)
+        view2->setICCSettings(settings);
+}
+
+void EditorTool::setExposureSettings(ExposureSettingsContainer* settings)
+{
+    ImageWidget* view = dynamic_cast<ImageWidget*>(d->view);
+    if (view)
+        view->setExposureSettings(settings);
+
+    ImagePanelWidget* view2 = dynamic_cast<ImagePanelWidget*>(d->view);
+    if (view2)
+        view2->setExposureSettings(settings);
+}
+
 // ----------------------------------------------------------------
 
 class EditorToolThreadedPriv
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editortool.h #1071621:1071622
@@ -6,7 +6,7 @@
  * Date        : 2008-08-20
  * Description : editor tool template class.
  *
- * Copyright (C) 2008-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2008-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -61,8 +61,8 @@
     QWidget*            toolView() const;
     EditorToolSettings* toolSettings() const;
 
-    virtual void        setICCSettings(ICCSettingsContainer*){};
-    virtual void        setExposureSettings(ExposureSettingsContainer*){};
+    virtual void        setICCSettings(ICCSettingsContainer*);
+    virtual void        setExposureSettings(ExposureSettingsContainer*);
 
 public Q_SLOTS:
 



More information about the Digikam-devel mailing list