[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/utilities/imageeditor/editor
From:       Andi Clemens <andi.clemens () gmx ! net>
Date:       2010-09-25 16:53:02
Message-ID: 20100925165302.F1F2EAC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1179490 by aclemens:

Show a tooldescriptor in the right sidebar to see what editor tool is currently
used.

Right now the ThemeEngine colors are used, to avoid problems with different
themes.

This patch was discussed in March 2010 on the ML, hope it is still ok to
commit
it :-)

CCMAIL:digikam-devel@kde.org

 M  +3 -0      editortool.cpp  
 M  +79 -24    editortoolsettings.cpp  
 M  +4 -0      editortoolsettings.h  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editortool.cpp #1179489:1179490
@@ -147,6 +147,9 @@
 {
     d->settings = settings;
 
+    d->settings->setToolIcon(toolIcon());
+    d->settings->setToolName(toolName());
+
     connect(d->settings, SIGNAL(signalOkClicked()),
             this, SLOT(slotOk()));
 
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editortoolsettings.cpp #1179489:1179490
@@ -27,6 +27,7 @@
 
 #include <QButtonGroup>
 #include <QLabel>
+#include <QPixmap>
 #include <QLayout>
 #include <QMap>
 #include <QPair>
@@ -59,6 +60,7 @@
 #include "histogramwidget.h"
 #include "histogrambox.h"
 #include "globals.h"
+#include "themeengine.h"
 
 using namespace KDcrawIface;
 
@@ -70,26 +72,30 @@
 
 public:
 
-    EditorToolSettingsPriv()
+    EditorToolSettingsPriv() :
+        scaleBG(0),
+        linHistoButton(0),
+        logHistoButton(0),
+        settingsArea(0),
+        plainPage(0),
+        toolName(0),
+        toolIcon(0),
+        btnBox1(0),
+        btnBox2(0),
+        guideBox(0),
+        channelCB(0),
+        colorsCB(0),
+        okBtn(0),
+        cancelBtn(0),
+        tryBtn(0),
+        defaultBtn(0),
+        saveAsBtn(0),
+        loadBtn(0),
+        guideColorBt(0),
+        hGradient(0),
+        histogramBox(0),
+        guideSize(0)
     {
-        okBtn        = 0;
-        cancelBtn    = 0;
-        tryBtn       = 0;
-        defaultBtn   = 0;
-        settingsArea = 0;
-        plainPage    = 0;
-        btnBox1      = 0;
-        btnBox2      = 0;
-        saveAsBtn    = 0;
-        loadBtn      = 0;
-        guideBox     = 0;
-        guideColorBt = 0;
-        guideSize    = 0;
-        channelCB    = 0;
-        colorsCB     = 0;
-        scaleBG      = 0;
-        histogramBox = 0;
-        hGradient    = 0;
     }
 
     QButtonGroup*        scaleBG;
@@ -100,6 +106,9 @@
     QWidget*             settingsArea;
     QWidget*             plainPage;
 
+    QLabel*              toolName;
+    QLabel*              toolIcon;
+
     KHBox*               btnBox1;
     KHBox*               btnBox2;
     KHBox*               guideBox;
@@ -143,6 +152,41 @@
 
     // ---------------------------------------------------------------
 
+    QFrame* toolDescriptor = new QFrame(d->settingsArea);
+
+    d->toolName = new QLabel();
+    d->toolIcon = new QLabel();
+
+    QFont font = d->toolName->font();
+    font.setBold(true);
+    d->toolName->setFont(font);
+
+    QString frameStyle = QString("QFrame {"
+            "color: %1;"
+            "border: 1px solid %2;"
+            "border-radius: 5px;"
+            "background-color: %3;"
+            "}")
+            .arg(ThemeEngine::instance()->textSelColor().name())
+            .arg(ThemeEngine::instance()->textSelColor().name())
+            .arg(ThemeEngine::instance()->thumbSelColor().name());
+
+    QString noFrameStyle("QFrame {"
+            "border: none;"
+            "}");
+
+    toolDescriptor->setStyleSheet(frameStyle);
+    d->toolName->setStyleSheet(noFrameStyle);
+    d->toolIcon->setStyleSheet(noFrameStyle);
+
+    QGridLayout* descrLayout = new QGridLayout();
+    descrLayout->addWidget(d->toolIcon, 0, 0, 1, 1);
+    descrLayout->addWidget(d->toolName, 0, 1, 1, 1);
+    descrLayout->setColumnStretch(1, 10);
+    toolDescriptor->setLayout(descrLayout);
+
+    // ---------------------------------------------------------------
+
     new QLabel(i18n("Guide:"), d->guideBox);
     QLabel* space4  = new QLabel(d->guideBox);
     d->guideColorBt = new KColorButton(QColor(Qt::red), d->guideBox);
@@ -203,11 +247,12 @@
 
     // ---------------------------------------------------------------
 
-    gridSettings->addWidget(d->histogramBox,   0, 0, 2, 2);
-    gridSettings->addWidget(d->plainPage,      3, 0, 1, 2);
-    gridSettings->addWidget(d->guideBox,       4, 0, 1, 2);
-    gridSettings->addWidget(d->btnBox2,        5, 0, 1, 2);
-    gridSettings->addWidget(d->btnBox1,        6, 0, 1, 2);
+    gridSettings->addWidget(toolDescriptor,    0, 0, 1,-1);
+    gridSettings->addWidget(d->histogramBox,   1, 0, 2, 2);
+    gridSettings->addWidget(d->plainPage,      4, 0, 1, 2);
+    gridSettings->addWidget(d->guideBox,       5, 0, 1, 2);
+    gridSettings->addWidget(d->btnBox2,        6, 0, 1, 2);
+    gridSettings->addWidget(d->btnBox1,        7, 0, 1, 2);
     gridSettings->setSpacing(spacingHint());
     gridSettings->setMargin(spacingHint());
 
@@ -368,4 +413,14 @@
     d->histogramBox->setHistogramType(type);
 }
 
+void EditorToolSettings::setToolIcon(const QPixmap& pixmap)
+{
+    d->toolIcon->setPixmap(pixmap);
+}
+
+void EditorToolSettings::setToolName(const QString& name)
+{
+    d->toolName->setText(name);
+}
+
 } // namespace Digikam
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editortoolsettings.h #1179489:1179490
@@ -39,6 +39,8 @@
 #include "globals.h"
 
 class KPushButton;
+class QPixmap;
+class QString;
 
 namespace Digikam
 {
@@ -77,6 +79,8 @@
     void setButtons(Buttons buttonMask);
     void setTools(Tools toolMask);
     void setHistogramType(HistogramBoxType type);
+    void setToolIcon(const QPixmap& pixmap);
+    void setToolName(const QString& name);
 
     virtual void setBusy(bool)   {};
     virtual void writeSettings() {};
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic