Bug 142109

Summary: Turn under/over exposure display on/off by click on corresponding icons
Product: [Applications] digikam Reporter: krienke
Component: ImageEditor-CanvasAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.1
Sentry Crash Report:

Description krienke 2007-02-23 15:21:03 UTC
Version:           0.9.1rc1 (using KDE KDE 3.5.6)
Installed from:    SuSE RPMs
Compiler:          gcc 4.2 
OS:                Linux

In image editor digikam allows to turn on/off an over and under exposure indicator. The state for each of both (on/off) is displayed by a little icon in the right lower corner. 

Now having this icons it would be nice (and logical)  if one could click on them to turn it on/off as an accelerator to the corresponding menu items.

I clicked already several times on those icons to turn eg the over exposure display off ... :-)
Comment 1 caulier.gilles 2007-02-23 21:38:36 UTC
SVN commit 636688 by cgilles:

digikam from trunk : make over/under exposure and Color Managed view indicator on status bar of editor like action buttons to toogle on/off options.

Nota : there are already keyboard shorcuts for these actions : F9/F10/F11
BUG: 142109

 M  +40 -18    editorwindow.cpp  
 M  +7 -8      editorwindowprivate.h  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #636687:636688
@@ -32,6 +32,7 @@
 #include <qdockarea.h>
 #include <qlayout.h>
 #include <qtooltip.h>
+#include <qtoolbutton.h>
 #include <qsplitter.h>
 #include <qdir.h>
 #include <qfileinfo.h>
@@ -466,23 +467,29 @@
     m_resLabel->setMaximumHeight(fontMetrics().height()+2);   
     statusBar()->addWidget(m_resLabel, 100);
 
-    d->underExposureIndicator = new QLabel(statusBar());
-    d->underExposureIndicator->setPixmap(SmallIcon("underexposure"));
-    d->underExposureIndicator->setAlignment(Qt::AlignCenter);
-    d->underExposureIndicator->setMaximumHeight(fontMetrics().height()+2);   
+    d->underExposureIndicator = new QToolButton(statusBar());
+    d->underExposureIndicator->setIconSet(SmallIcon("underexposure"));
+    d->underExposureIndicator->setToggleButton(true);
     statusBar()->addWidget(d->underExposureIndicator, 1);
 
-    d->overExposureIndicator = new QLabel(statusBar());
-    d->overExposureIndicator->setPixmap(SmallIcon("overexposure"));
-    d->overExposureIndicator->setAlignment(Qt::AlignCenter);
-    d->overExposureIndicator->setMaximumHeight(fontMetrics().height()+2);
+    d->overExposureIndicator = new QToolButton(statusBar());
+    d->overExposureIndicator->setIconSet(SmallIcon("overexposure"));
+    d->overExposureIndicator->setToggleButton(true);
     statusBar()->addWidget(d->overExposureIndicator, 1);
 
-    d->cmViewIndicator = new QLabel(statusBar());
-    d->cmViewIndicator->setPixmap(SmallIcon("tv"));
-    d->cmViewIndicator->setAlignment(Qt::AlignCenter);
-    d->cmViewIndicator->setMaximumHeight(fontMetrics().height()+2);
+    d->cmViewIndicator = new QToolButton(statusBar());
+    d->cmViewIndicator->setIconSet(SmallIcon("tv"));
+    d->cmViewIndicator->setToggleButton(true);
     statusBar()->addWidget(d->cmViewIndicator, 1);
+
+    connect(d->underExposureIndicator, SIGNAL(toggled(bool)),
+            this, SLOT(slotToggleUnderExposureIndicator()));
+
+    connect(d->overExposureIndicator, SIGNAL(toggled(bool)),
+            this, SLOT(slotToggleOverExposureIndicator()));
+
+    connect(d->cmViewIndicator, SIGNAL(toggled(bool)),
+            this, SLOT(slotToggleColorManagedView()));
 }
 
 void EditorWindow::printImage(KURL url)
@@ -731,7 +738,7 @@
 
     d->viewCMViewAction->setEnabled(d->ICCSettings->enableCMSetting);
     d->viewCMViewAction->setChecked(d->ICCSettings->managedViewSetting);
-    d->cmViewIndicator->setEnabled(d->ICCSettings->managedViewSetting && d->ICCSettings->enableCMSetting);
+    d->cmViewIndicator->setOn(d->ICCSettings->managedViewSetting && d->ICCSettings->enableCMSetting);
     setColorManagedViewIndicatorToolTip(d->ICCSettings->managedViewSetting && d->ICCSettings->enableCMSetting);
     m_canvas->setICCSettings(d->ICCSettings);
 
@@ -802,8 +809,8 @@
 
     d->viewUnderExpoAction->setChecked(d->exposureSettings->underExposureIndicator);
     d->viewOverExpoAction->setChecked(d->exposureSettings->overExposureIndicator);
-    d->underExposureIndicator->setEnabled(d->exposureSettings->underExposureIndicator);
-    d->overExposureIndicator->setEnabled(d->exposureSettings->overExposureIndicator);
+    d->underExposureIndicator->setOn(d->exposureSettings->underExposureIndicator);
+    d->overExposureIndicator->setOn(d->exposureSettings->overExposureIndicator);
     setUnderExposureToolTip(d->exposureSettings->underExposureIndicator);
     setOverExposureToolTip(d->exposureSettings->overExposureIndicator);
     m_canvas->setExposureSettings(d->exposureSettings);
@@ -1535,6 +1542,8 @@
 
 void EditorWindow::slotToggleColorManagedView()
 {
+    d->cmViewIndicator->blockSignals(true);
+    d->viewCMViewAction->blockSignals(true);
     bool cmv = false;
     if (d->ICCSettings->enableCMSetting)
     {    
@@ -1550,8 +1559,11 @@
         config->writeEntry("ManagedView", cmv);
     }
 
-    d->cmViewIndicator->setEnabled(cmv);
+    d->cmViewIndicator->setOn(cmv);
+    d->viewCMViewAction->setChecked(cmv);
     setColorManagedViewIndicatorToolTip(cmv);
+    d->cmViewIndicator->blockSignals(false);
+    d->viewCMViewAction->blockSignals(false);
 }    
 
 void EditorWindow::setColorManagedViewIndicatorToolTip(bool cmv)
@@ -1564,11 +1576,16 @@
 
 void EditorWindow::slotToggleUnderExposureIndicator()
 {
+    d->underExposureIndicator->blockSignals(true);
+    d->viewUnderExpoAction->blockSignals(true);
     bool uei = !d->exposureSettings->underExposureIndicator;
-    d->underExposureIndicator->setEnabled(uei);
+    d->underExposureIndicator->setOn(uei);
+    d->viewUnderExpoAction->setChecked(uei);
     d->exposureSettings->underExposureIndicator = uei;
     m_canvas->setExposureSettings(d->exposureSettings);
     setUnderExposureToolTip(uei);
+    d->underExposureIndicator->blockSignals(false);
+    d->viewUnderExpoAction->blockSignals(false);
 }    
 
 void EditorWindow::setUnderExposureToolTip(bool uei)
@@ -1581,11 +1598,16 @@
 
 void EditorWindow::slotToggleOverExposureIndicator()
 {
+    d->overExposureIndicator->blockSignals(true);
+    d->viewOverExpoAction->blockSignals(true);
     bool oei = !d->exposureSettings->overExposureIndicator;
-    d->overExposureIndicator->setEnabled(oei);
+    d->overExposureIndicator->setOn(oei);
+    d->viewOverExpoAction->setChecked(oei);
     d->exposureSettings->overExposureIndicator = oei;
     m_canvas->setExposureSettings(d->exposureSettings);
     setOverExposureToolTip(oei);
+    d->overExposureIndicator->blockSignals(false);
+    d->viewOverExpoAction->blockSignals(false);
 }    
 
 void EditorWindow::setOverExposureToolTip(bool oei)
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindowprivate.h #636687:636688
@@ -1,10 +1,10 @@
 /* ============================================================
- * Author: Gilles Caulier <caulier dot gilles at gmail dot com>
- * Date  : 2006-01-20
+ * Authors: Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Date   : 2006-01-20
  * Description : main image editor GUI implementation
  *               private data.
  *
- * Copyright 2006 by Gilles Caulier
+ * Copyright 2006-2007 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -22,7 +22,7 @@
 #ifndef EDITORWINDOWPRIVATE_H
 #define EDITORWINDOWPRIVATE_H
 
-class QLabel;
+class QToolButton;
 
 class KAction;
 class KToggleAction;
@@ -83,10 +83,9 @@
     bool                       fullScreenHideToolBar;
     bool                       slideShowInFullScreen;
 
-    QLabel                    *cmViewIndicator;
- 
-    QLabel                    *underExposureIndicator; 
-    QLabel                    *overExposureIndicator; 
+    QToolButton               *cmViewIndicator;
+    QToolButton               *underExposureIndicator; 
+    QToolButton               *overExposureIndicator; 
 
     KAction                   *imagePluginsHelpAction;
     KAction                   *donateMoneyAction;