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

List:       kde-commits
Subject:    extragear/graphics/digikamimageplugins/channelmixer
From:       Gilles Caulier <caulier.gilles () free ! fr>
Date:       2005-08-26 7:36:42
Message-ID: 1125041802.110973.9331.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 453431 by cgilles:

digikam ChannelMixer tool : Polish GUI.

- Using QGroupButton to select histogram scale.
- Using QHLoayout to optimize user settings area size.

Gerhard, please update handbook screenshots.

CCMAIL: Gerhard Kulzer <gerhard@kulzer.net>

 M  +32 -24    channelmixer.cpp  
 M  +3 -1      channelmixer.h  


--- trunk/extragear/graphics/digikamimageplugins/channelmixer/channelmixer.cpp \
#453430:453431 @@ -37,6 +37,7 @@
 #include <qgroupbox.h>
 #include <qhgroupbox.h>
 #include <qvgroupbox.h>
+#include <qhbuttongroup.h> 
 #include <qlabel.h>
 #include <qpainter.h>
 #include <qcombobox.h>
@@ -117,21 +118,38 @@
                                        "<b>Green</b>: display the green \
                image-channel values.<p>"
                                        "<b>Blue</b>: display the blue image-channel \
values.<p>"));  
-    QLabel *label2 = new QLabel(i18n("Scale:"), gboxSettings);
-    label2->setAlignment ( Qt::AlignRight | Qt::AlignVCenter);
-    m_scaleCB = new QComboBox( false, gboxSettings );
-    m_scaleCB->insertItem( i18n("Linear") );
-    m_scaleCB->insertItem( i18n("Logarithmic") );
-    m_scaleCB->setCurrentText( i18n("Logarithmic") );
-    QWhatsThis::add( m_scaleCB, i18n("<p>Select here the histogram scale.<p>"
+    m_scaleBG = new QHButtonGroup(gboxSettings);
+    m_scaleBG->setExclusive(true);
+    m_scaleBG->setFrameShape(QFrame::NoFrame);
+    m_scaleBG->setInsideMargin( 0 );
+    QWhatsThis::add( m_scaleBG, 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 );
+    QToolTip::add( linHistoButton, 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); +    
+    QPushButton *logHistoButton = new QPushButton( m_scaleBG );
+    QToolTip::add( logHistoButton, 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);         
-    grid->addMultiCellWidget(label1, 0, 0, 0, 0);
-    grid->addMultiCellWidget(m_channelCB, 0, 0, 1, 1);
-    grid->addMultiCellWidget(label2, 0, 0, 3, 3);
-    grid->addMultiCellWidget(m_scaleCB, 0, 0, 4, 4);
+    QHBoxLayout* l1 = new QHBoxLayout();
+    l1->addWidget(label1);
+    l1->addWidget(m_channelCB);
+    l1->addWidget(m_scaleBG);
+    l1->addStretch(10);
+    
+    grid->addMultiCellLayout(l1, 0, 0, 0, 4);
 
     m_histogramWidget = new Digikam::HistogramWidget(256, 140, imageData, width, \
                height, gboxSettings, false, true, true);
     QWhatsThis::add( m_histogramWidget, i18n("<p>Here you can see the target preview \
image histogram drawing of the " @@ -173,7 +191,7 @@
     grid->addMultiCellWidget(m_redGain, 3, 3, 1, 4);
     grid->addMultiCellWidget(m_greenGain, 4, 4, 1, 4);
     grid->addMultiCellWidget(m_blueGain, 5, 5, 1, 4);
-    grid->addMultiCellWidget(m_resetButton, 6, 6, 0, 2);
+    grid->addMultiCellWidget(m_resetButton, 6, 6, 0, 1);
 
     // -------------------------------------------------------------
     
@@ -215,7 +233,7 @@
     connect(m_channelCB, SIGNAL(activated(int)),
             this, SLOT(slotChannelChanged(int)));
 
-    connect(m_scaleCB, SIGNAL(activated(int)),
+    connect(m_scaleBG, SIGNAL(released(int)),
             this, SLOT(slotScaleChanged(int)));
 
     connect(m_previewTargetWidget, SIGNAL(spotPositionChanged( const QColor &, bool, \
const QPoint & )), @@ -520,17 +538,7 @@
 
 void ChannelMixerDialog::slotScaleChanged(int scale)
 {
-    switch(scale)
-       {
-       case Linear:
-          m_histogramWidget->m_scaleType = \
                Digikam::HistogramWidget::LinScaleHistogram;
-          break;
-       
-       case Logarithmic:
-          m_histogramWidget->m_scaleType = \
                Digikam::HistogramWidget::LogScaleHistogram;
-          break;
-       }
-
+    m_histogramWidget->m_scaleType = scale;
     m_histogramWidget->repaint(false);
 }
 
--- trunk/extragear/graphics/digikamimageplugins/channelmixer/channelmixer.h \
#453430:453431 @@ -29,6 +29,7 @@
 class QComboBox;
 class QPushButton;
 class QCheckBox;
+class QHButtonGroup;
 
 class KDoubleNumInput;
 
@@ -86,8 +87,9 @@
     double                        m_blackBlueGain;
     
     QComboBox                    *m_channelCB;    
-    QComboBox                    *m_scaleCB;    
     
+    QHButtonGroup                *m_scaleBG;  
+
     KDoubleNumInput              *m_redGain;
     KDoubleNumInput              *m_greenGain;
     KDoubleNumInput              *m_blueGain;


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

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