[Digikam-devel] [Bug 146636] adjust levels: helper line for sliders?
Gilles Caulier
caulier.gilles at gmail.com
Fri Jul 6 10:16:17 BST 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=146636
------- Additional Comments From caulier.gilles gmail com 2007-07-06 11:16 -------
SVN commit 684129 by cgilles:
digiKam from trunk (KDE4) : Backport B.K.O #146636
CCBUGS: 146636
M +120 -6 adjustlevels.cpp
M +2 -0 adjustlevels.h
--- trunk/extragear/graphics/digikam/imageplugins/adjustlevels/adjustlevels.cpp #684128:684129
@ -192,22 +192,26 @
// -------------------------------------------------------------
m_hGradientMinInput = new KGradientSelector( Qt::Horizontal, gboxSettings );
- m_hGradientMinInput->setFixedHeight( 20 );
- m_hGradientMinInput->setMinimum(0);
- m_hGradientMinInput->setMaximum(m_histoSegments);
+ m_hGradientMinInput->setIndent(false);
+ m_hGradientMinInput->setFixedHeight( 16 );
+ m_hGradientMinInput->setMinValue(0);
+ m_hGradientMinInput->setMaxValue(m_histoSegments);
m_hGradientMinInput->setWhatsThis( i18n("<p>Select here the minimal intensity "
"input value of the histogram."));
m_hGradientMinInput->setToolTip( i18n( "Minimal intensity input." ) );
m_hGradientMinInput->setColors( QColor( "black" ), QColor( "white" ) );
+ m_hGradientMinInput->installEventFilter(this);
m_hGradientMaxInput = new KGradientSelector( Qt::Horizontal, gboxSettings );
- m_hGradientMaxInput->setFixedHeight( 20 );
+ m_hGradientMaxInput->setIndent(false);
+ m_hGradientMaxInput->setFixedHeight( 16 );
m_hGradientMaxInput->setMinimum(0);
m_hGradientMaxInput->setMaximum(m_histoSegments);
m_hGradientMaxInput->setWhatsThis( i18n("<p>Select here the maximal intensity input "
"value of the histogram."));
m_hGradientMaxInput->setToolTip( i18n( "Maximal intensity input." ) );
m_hGradientMaxInput->setColors( QColor( "black" ), QColor( "white" ) );
+ m_hGradientMaxInput->installEventFilter(this);
m_minInput = new QSpinBox(gboxSettings);
m_minInput->setRange(0, m_histoSegments);
@ -216,6 +220,7 @
m_minInput->setWhatsThis( i18n("<p>Select here the minimal intensity input "
"value of the histogram."));
m_minInput->setToolTip( i18n( "Minimal intensity input." ) );
+
m_gammaInput = new KDoubleNumInput(gboxSettings);
m_gammaInput->setPrecision(2);
m_gammaInput->setRange(0.1, 3.0, 0.01);
@ -236,18 +241,22 @
m_hGradientMinOutput->setWhatsThis(i18n("<p>Select here the minimal intensity output "
"value of the histogram."));
m_hGradientMinOutput->setToolTip( i18n( "Minimal intensity output." ) );
- m_hGradientMinOutput->setFixedHeight( 20 );
+ m_hGradientMinOutput->setIndent(false);
+ m_hGradientMinOutput->setFixedHeight( 16 );
m_hGradientMinOutput->setMinimum(0);
m_hGradientMinOutput->setMaximum(m_histoSegments);
+ m_hGradientMinOutput->installEventFilter(this);
m_hGradientMaxOutput = new KGradientSelector( Qt::Horizontal, gboxSettings );
m_hGradientMaxOutput->setColors( QColor( "black" ), QColor( "white" ) );
m_hGradientMaxOutput->setWhatsThis(i18n("<p>Select here the maximal intensity output "
"value of the histogram."));
m_hGradientMaxOutput->setToolTip( i18n( "Maximal intensity output." ) );
- m_hGradientMaxOutput->setFixedHeight( 20 );
+ m_hGradientMaxOutput->setIndent(false);
+ m_hGradientMaxOutput->setFixedHeight( 16 );
m_hGradientMaxOutput->setMinimum(0);
m_hGradientMaxOutput->setMaximum(m_histoSegments);
+ m_hGradientMaxOutput->installEventFilter(this);
m_minOutput = new QSpinBox(gboxSettings);
m_minOutput->setRange(0, m_histoSegments);
@ -830,4 +839,109 @
slotChannelChanged(m_channelCB->currentIndex());
}
+// See B.K.O #146636: use event filter with all level slider to display a
+// guide over level histogram.
+bool AdjustLevelDialog::eventFilter(QObject *obj, QEvent *ev)
+{
+ if ( obj == m_hGradientMinInput )
+ {
+ if ( ev->type() == QEvent::MouseButtonPress)
+ {
+ connect(m_minInput, SIGNAL(valueChanged(int)),
+ this, SLOT(slotShowHistogramGuide(int)));
+
+ return false;
+ }
+ if ( ev->type() == QEvent::MouseButtonRelease)
+ {
+ disconnect(m_minInput, SIGNAL(valueChanged(int)),
+ this, SLOT(slotShowHistogramGuide(int)));
+
+ m_levelsHistogramWidget->reset();
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ if ( obj == m_hGradientMaxInput )
+ {
+ if ( ev->type() == QEvent::MouseButtonPress)
+ {
+ connect(m_maxInput, SIGNAL(valueChanged(int)),
+ this, SLOT(slotShowHistogramGuide(int)));
+
+ return false;
+ }
+ if ( ev->type() == QEvent::MouseButtonRelease)
+ {
+ disconnect(m_maxInput, SIGNAL(valueChanged(int)),
+ this, SLOT(slotShowHistogramGuide(int)));
+
+ m_levelsHistogramWidget->reset();
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ if ( obj == m_hGradientMinOutput )
+ {
+ if ( ev->type() == QEvent::MouseButtonPress)
+ {
+ connect(m_minOutput, SIGNAL(valueChanged(int)),
+ this, SLOT(slotShowHistogramGuide(int)));
+
+ return false;
+ }
+ if ( ev->type() == QEvent::MouseButtonRelease)
+ {
+ disconnect(m_minOutput, SIGNAL(valueChanged(int)),
+ this, SLOT(slotShowHistogramGuide(int)));
+
+ m_levelsHistogramWidget->reset();
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ if ( obj == m_hGradientMaxOutput )
+ {
+ if ( ev->type() == QEvent::MouseButtonPress)
+ {
+ connect(m_maxOutput, SIGNAL(valueChanged(int)),
+ this, SLOT(slotShowHistogramGuide(int)));
+
+ return false;
+ }
+ if ( ev->type() == QEvent::MouseButtonRelease)
+ {
+ disconnect(m_maxOutput, SIGNAL(valueChanged(int)),
+ this, SLOT(slotShowHistogramGuide(int)));
+
+ m_levelsHistogramWidget->reset();
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // pass the event on to the parent class
+ return KDialog::eventFilter(obj, ev);
+ }
+}
+
+void AdjustLevelDialog::slotShowHistogramGuide(int v)
+{
+ Digikam::DColor color(v, v, v, v, m_originalImage.sixteenBit());
+ m_levelsHistogramWidget->setHistogramGuideByColor(color);
+}
+
} // NameSpace DigikamAdjustLevelsImagesPlugin
--- trunk/extragear/graphics/digikam/imageplugins/adjustlevels/adjustlevels.h #684128:684129
@ -64,6 +64,7 @
void resetValues();
void finalRendering();
void adjustSliders(int minIn, double gamIn, int maxIn, int minOut, int maxOut);
+ bool eventFilter(QObject *obj, QEvent *ev);
private slots:
@ -83,6 +84,7 @
void slotSpotColorChanged(const Digikam::DColor &color);
void slotColorSelectedFromTarget(const Digikam::DColor &color);
void slotPickerColorButtonActived();
+ void slotShowHistogramGuide(int v);
private:
More information about the Digikam-devel
mailing list