[Digikam-devel] extragear/graphics/digikam/imageplugins
Gilles Caulier
caulier.gilles at kdemail.net
Tue Jan 16 15:48:29 GMT 2007
SVN commit 624167 by cgilles:
digiKam from trunk : Color Balance Tool : remember the settings between plugin sessions
CCMAIL: digikam-devel at kde.org
M +51 -8 imageeffect_rgb.cpp
M +20 -18 imageeffect_rgb.h
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_rgb.cpp #624166:624167
@@ -1,9 +1,9 @@
/* ============================================================
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date : 2004-07-11
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date : 2004-07-11
* Description : digiKam image editor Color Balance tool.
*
- * Copyright 2004-2006 by Gilles Caulier
+ * Copyright 2004-2007 by Gilles Caulier
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -39,6 +39,7 @@
// KDE includes.
+#include <kconfig.h>
#include <klocale.h>
#include <kapplication.h>
#include <kcursor.h>
@@ -56,6 +57,7 @@
// Local includes.
#include "imageeffect_rgb.h"
+#include "imageeffect_rgb.moc"
namespace DigikamImagesPluginCore
{
@@ -285,19 +287,61 @@
m_histogramWidget->setHistogramGuideByColor(color);
}
-void ImageEffect_RGB::slotDefault()
+void ImageEffect_RGB::readUserSettings()
{
+ KConfig* config = kapp->config();
+ config->setGroup("colorbalance Tool Dialog");
+ m_channelCB->setCurrentItem(config->readNumEntry("Histogram Channel", 0)); // Luminosity.
+ m_scaleBG->setButton(config->readNumEntry("Histogram Scale", Digikam::HistogramWidget::LogScaleHistogram));
+ int r = config->readNumEntry("RedAjustment", 0);
+ int g = config->readNumEntry("GreenAjustment", 0);
+ int b = config->readNumEntry("BlueAjustment", 0);
+ adjustSliders(r, g, b);
+ slotChannelChanged(m_channelCB->currentItem());
+ slotScaleChanged(m_scaleBG->selectedId());
+}
+
+void ImageEffect_RGB::writeUserSettings()
+{
+ KConfig* config = kapp->config();
+ config->setGroup("colorbalance Tool Dialog");
+ config->writeEntry("Histogram Channel", m_channelCB->currentItem());
+ config->writeEntry("Histogram Scale", m_scaleBG->selectedId());
+ config->writeEntry("RedAjustment", m_rSlider->value());
+ config->writeEntry("GreenAjustment", m_gInput->value());
+ config->writeEntry("BlueAjustment", m_bInput->value());
+ config->sync();
+}
+
+void ImageEffect_RGB::resetValues()
+{
adjustSliders(0, 0, 0);
- slotEffect();
}
void ImageEffect_RGB::adjustSliders(int r, int g, int b)
{
- blockSignals(true);
+ m_rSlider->blockSignals(true);
+ m_gSlider->blockSignals(true);
+ m_bSlider->blockSignals(true);
+ m_rInput->blockSignals(true);
+ m_gInput->blockSignals(true);
+ m_bInput->blockSignals(true);
+
m_rSlider->setValue(r);
m_gSlider->setValue(g);
m_bSlider->setValue(b);
- blockSignals(false);
+ m_rInput->setValue(r);
+ m_gInput->setValue(g);
+ m_bInput->setValue(b);
+
+ m_rSlider->blockSignals(false);
+ m_gSlider->blockSignals(false);
+ m_bSlider->blockSignals(false);
+ m_rInput->blockSignals(false);
+ m_gInput->blockSignals(false);
+ m_bInput->blockSignals(false);
+
+ slotEffect();
}
void ImageEffect_RGB::slotEffect()
@@ -368,4 +412,3 @@
} // NameSpace DigikamImagesPluginCore
-#include "imageeffect_rgb.moc"
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_rgb.h #624166:624167
@@ -1,9 +1,9 @@
/* ============================================================
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date : 2004-07-11
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date : 2004-07-11
* Description : digiKam image editor Color Balance tool.
*
- * Copyright 2004-2006 by Gilles Caulier
+ * Copyright 2004-2007 by Gilles Caulier
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -51,6 +51,23 @@
ImageEffect_RGB(QWidget *parent);
~ImageEffect_RGB();
+private:
+
+ void writeUserSettings();
+ void readUserSettings();
+ void resetValues();
+ void adjustSliders(int r, int g, int b);
+ void finalRendering();
+
+private slots:
+
+ void slotEffect();
+ void slotChannelChanged(int channel);
+ void slotScaleChanged(int scale);
+ void slotColorSelectedFromTarget( const Digikam::DColor &color );
+
+private:
+
enum HistogramScale
{
Linear=0,
@@ -84,22 +101,7 @@
Digikam::ColorGradientWidget *m_hGradient;
Digikam::HistogramWidget *m_histogramWidget;
-
-private:
-
- void adjustSliders(int r, int g, int b);
-private slots:
-
- void slotDefault();
- void slotEffect();
- void slotChannelChanged(int channel);
- void slotScaleChanged(int scale);
- void slotColorSelectedFromTarget( const Digikam::DColor &color );
-
-protected:
-
- void finalRendering();
};
} // NameSpace DigikamImagesPluginCore
More information about the Digikam-devel
mailing list