[Digikam-devel] extragear/graphics/digikam
Gilles Caulier
caulier.gilles at kdemail.net
Thu Jan 11 13:14:47 GMT 2007
SVN commit 622294 by cgilles:
digikam from trunk : Remember User Settings from all Image Plugins :
- Preparing common dialogs implementation.
- BCG Tool fixed. All users settings will be saved between session.
- CM Tool adapted to new API (Warning : you will lost temporally your settings at next session of this tool duing this change. Just re-set the tool and all will fine)
CCMAIL: digikam-devel at kde.org
M +21 -2 imageplugins/imageeffect_bcg.cpp
M +4 -2 imageplugins/imageeffect_bcg.h
M +7 -13 imageplugins/imageeffect_iccproof.cpp
M +46 -46 imageplugins/imageeffect_iccproof.h
M +27 -14 libs/dialogs/imagedlgbase.cpp
M +9 -6 libs/dialogs/imagedlgbase.h
M +3 -3 libs/dialogs/imageguidedlg.cpp
M +6 -5 libs/dialogs/imageguidedlg.h
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_bcg.cpp #622293:622294
@@ -43,6 +43,7 @@
#include <knuminput.h>
#include <klocale.h>
#include <kapplication.h>
+#include <kconfig.h>
#include <kcursor.h>
#include <kstandarddirs.h>
@@ -264,8 +265,27 @@
m_histogramWidget->setHistogramGuideByColor(color);
}
-void ImageEffect_BCG::slotDefault()
+void ImageEffect_BCG::readUserSettings()
{
+ KConfig* config = kapp->config();
+ config->setGroup("bcgadjust Tool Dialog");
+ m_bInput->setValue(config->readNumEntry("BrightnessAjustment", 0));
+ m_cInput->setValue(config->readNumEntry("ContrastAjustment", 0));
+ m_gInput->setValue(config->readDoubleNumEntry("GammaAjustment", 1.0));
+}
+
+void ImageEffect_BCG::writeUserSettings()
+{
+ KConfig* config = kapp->config();
+ config->setGroup("bcgadjust Tool Dialog");
+ config->writeEntry("BrightnessAjustment", m_bInput->value());
+ config->writeEntry("ContrastAjustment", m_cInput->value());
+ config->writeEntry("GammaAjustment", m_gInput->value());
+ config->sync();
+}
+
+void ImageEffect_BCG::resetValues()
+{
m_bInput->blockSignals(true);
m_cInput->blockSignals(true);
m_gInput->blockSignals(true);
@@ -275,7 +295,6 @@
m_bInput->blockSignals(false);
m_cInput->blockSignals(false);
m_gInput->blockSignals(false);
- slotEffect();
}
void ImageEffect_BCG::slotEffect()
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_bcg.h #622293:622294
@@ -58,14 +58,16 @@
private slots:
- void slotDefault();
void slotEffect();
void slotChannelChanged(int channel);
void slotScaleChanged(int scale);
void slotColorSelectedFromTarget( const Digikam::DColor &color );
-protected:
+private:
+ void writeUserSettings();
+ void readUserSettings();
+ void resetValues();
void finalRendering();
private:
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_iccproof.cpp #622293:622294
@@ -3,7 +3,7 @@
* Gilles Caulier <caulier dot gilles at kdemail dot net>
* Date : 2005-12-21
* Copyright 2005-2006 by F.J. Cruz
- * 2006 by Gilles Caulier
+ * 2006-2007 by Gilles Caulier
*
* Description : digiKam image editor tool to correct picture
* colors using an ICC color profile
@@ -433,14 +433,10 @@
gridSettings->addMultiCellWidget(m_toolBoxWidgets, 3, 3, 0, 2);
setUserAreaWidget(gboxSettings);
+ enableButtonOK(false);
// -------------------------------------------------------------
- enableButtonOK( false );
- readSettings();
-
- // -------------------------------------------------------------
-
connect(lcmsLogoLabel, SIGNAL(leftClickedURL(const QString&)),
this, SLOT(processLCMSURL(const QString&)));
@@ -520,7 +516,6 @@
ImageEffect_ICCProof::~ImageEffect_ICCProof()
{
- writeSettings();
m_histogramWidget->stopHistogramComputation();
delete [] m_destinationPreviewData;
@@ -530,7 +525,7 @@
delete m_curves;
}
-void ImageEffect_ICCProof::readSettings()
+void ImageEffect_ICCProof::readUserSettings()
{
QString defaultICCPath = KGlobalSettings::documentPath();
KConfig* config = kapp->config();
@@ -563,7 +558,7 @@
}
// Plugin settings.
- config->setGroup("Color Management Tool");
+ config->setGroup("colormanagement Tool Dialog");
m_toolBoxWidgets->setCurrentIndex(config->readNumEntry("Settings Tab", GENERALPAGE));
m_inProfilesPath->setURL(config->readPathEntry("InputProfilePath", defaultICCPath));
m_proofProfilePath->setURL(config->readPathEntry("ProofProfilePath", defaultICCPath));
@@ -606,10 +601,10 @@
m_curvesWidget->curveTypeChanged();
}
-void ImageEffect_ICCProof::writeSettings()
+void ImageEffect_ICCProof::writeUserSettings()
{
KConfig* config = kapp->config();
- config->setGroup("Color Management Tool");
+ config->setGroup("colormanagement Tool Dialog");
config->writeEntry("Settings Tab", m_toolBoxWidgets->currentIndex());
config->writePathEntry("InputProfilePath", m_inProfilesPath->url());
config->writePathEntry("ProofProfilePath", m_proofProfilePath->url());
@@ -690,7 +685,7 @@
m_histogramWidget->repaint(false);
}
-void ImageEffect_ICCProof::slotDefault()
+void ImageEffect_ICCProof::resetValues()
{
m_cInput->blockSignals(true);
m_cInput->setValue(0.0);
@@ -700,7 +695,6 @@
m_curvesWidget->reset();
m_cInput->blockSignals(false);
- slotEffect();
}
void ImageEffect_ICCProof::slotEffect()
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_iccproof.h #622293:622294
@@ -3,7 +3,7 @@
* Gilles Caulier <caulier dot gilles at kdemail dot net>
* Date : 2005-12-21
* Copyright 2005-2006 by F.J. Cruz
- * 2006 by Gilles Caulier
+ * 2006-2007 by Gilles Caulier
*
* Description : digiKam image editor tool to correct picture
* colors using an ICC color profile
@@ -64,8 +64,53 @@
ImageEffect_ICCProof(QWidget* parent);
~ImageEffect_ICCProof();
+protected:
+
+ void finalRendering();
+
private:
+ void readUserSettings();
+ void writeUserSettings();
+ void resetValues();
+
+ void getICCInfo(const QString&);
+ void getICCInfo(const QByteArray&);
+
+ bool useBPC();
+ bool doProof();
+ bool checkGamut();
+ bool embedProfile();
+
+ bool useEmbeddedProfile();
+ bool useBuiltinProfile();
+ bool useDefaultInProfile();
+ bool useSelectedInProfile();
+
+ bool useDefaultSpaceProfile();
+ bool useSelectedSpaceProfile();
+
+ bool useDefaultProofProfile();
+ bool useSelectedProofProfile();
+
+private slots:
+
+ void slotUser2();
+ void slotUser3();
+ void slotEffect();
+ void slotChannelChanged(int);
+ void slotScaleChanged(int);
+ void slotSpotColorChanged(const Digikam::DColor &);
+ void slotColorSelectedFromTarget(const Digikam::DColor &);
+ void slotToggledWidgets(bool);
+ void slotInICCInfo();
+ void slotProofICCInfo();
+ void slotSpaceICCInfo();
+ void slotCMDisabledWarning();
+ void processLCMSURL(const QString&);
+
+private:
+
enum HistogramScale
{
Linear = 0,
@@ -150,51 +195,6 @@
Digikam::ICCPreviewWidget *m_iccInPreviewWidget;
Digikam::ICCPreviewWidget *m_iccSpacePreviewWidget;
Digikam::ICCPreviewWidget *m_iccProofPreviewWidget;
-
-private:
-
- void readSettings();
- void writeSettings();
-
- void getICCInfo(const QString&);
- void getICCInfo(const QByteArray&);
-
- bool useBPC();
- bool doProof();
- bool checkGamut();
- bool embedProfile();
-
- bool useEmbeddedProfile();
- bool useBuiltinProfile();
- bool useDefaultInProfile();
- bool useSelectedInProfile();
-
- bool useDefaultSpaceProfile();
- bool useSelectedSpaceProfile();
-
- bool useDefaultProofProfile();
- bool useSelectedProofProfile();
-
-private slots:
-
- void slotUser2();
- void slotUser3();
- void slotDefault();
- void slotEffect();
- void slotChannelChanged(int);
- void slotScaleChanged(int);
- void slotSpotColorChanged(const Digikam::DColor &);
- void slotColorSelectedFromTarget(const Digikam::DColor &);
- void slotToggledWidgets(bool);
- void slotInICCInfo();
- void slotProofICCInfo();
- void slotSpaceICCInfo();
- void slotCMDisabledWarning();
- void processLCMSURL(const QString&);
-
-protected:
-
- void finalRendering();
};
} // NameSpace DigikamImagesPluginCore
--- trunk/extragear/graphics/digikam/libs/dialogs/imagedlgbase.cpp #622293:622294
@@ -1,13 +1,12 @@
/* ============================================================
- * File : imagedlgbase.cpp
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date : 2005-07-23
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date : 2005-07-23
* Description : simple plugins dialog without threadable
* filter interface. The dialog layout is
* designed to accept custom widgets in
* preview and settings area.
*
- * Copyright 2005-2006 by Gilles Caulier
+ * Copyright 2005-2007 by Gilles Caulier
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -54,6 +53,7 @@
#include "sidebar.h"
#include "dimginterface.h"
#include "imagedlgbase.h"
+#include "imagedlgbase.moc"
namespace Digikam
{
@@ -155,10 +155,20 @@
delete d;
}
-void ImageDlgBase::writeConfig()
+void ImageDlgBase::readSettings(void)
{
KConfig *config = kapp->config();
config->setGroup(d->name + QString(" Tool Dialog"));
+ if(config->hasKey("SplitterSizes"))
+ d->splitter->setSizes(config->readIntListEntry("SplitterSizes"));
+
+ readUserSettings();
+}
+
+void ImageDlgBase::writeSettings()
+{
+ KConfig *config = kapp->config();
+ config->setGroup(d->name + QString(" Tool Dialog"));
config->writeEntry("SplitterSizes", d->splitter->sizes());
config->sync();
saveDialogSize(d->name + QString(" Tool Dialog"));
@@ -166,22 +176,29 @@
void ImageDlgBase::closeEvent(QCloseEvent *e)
{
- writeConfig();
+ writeSettings();
e->accept();
}
void ImageDlgBase::slotCancel()
{
- writeConfig();
+ writeSettings();
done(Cancel);
}
void ImageDlgBase::slotOk()
{
- writeConfig();
+ writeSettings();
+ writeUserSettings();
finalRendering();
}
+void ImageDlgBase::slotDefault()
+{
+ resetValues();
+ slotEffect();
+}
+
void ImageDlgBase::slotHelp()
{
// If setAboutData() is called by plugin, well DigikamImagePlugins help is lauch,
@@ -219,11 +236,8 @@
d->settingsSideBar->setSplitter(d->splitter);
d->settingsSideBar->appendTab(w, SmallIcon("configure"), i18n("Settings"));
d->settingsSideBar->loadViewState();
-
- KConfig *config = kapp->config();
- config->setGroup(d->name + QString(" Tool Dialog"));
- if(config->hasKey("SplitterSizes"))
- d->splitter->setSizes(config->readIntListEntry("SplitterSizes"));
+
+ readSettings();
}
void ImageDlgBase::slotTimer()
@@ -242,4 +256,3 @@
} // NameSpace Digikam
-#include "imagedlgbase.moc"
--- trunk/extragear/graphics/digikam/libs/dialogs/imagedlgbase.h #622293:622294
@@ -1,13 +1,12 @@
/* ============================================================
- * File : imagedlgbase.h
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date : 2005-07-23
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date : 2005-07-23
* Description : simple plugins dialog without threadable
* filter interface. The dialog layout is
* designed to accept custom widgets in
* preview and settings area.
*
- * Copyright 2005-2006 by Gilles Caulier
+ * Copyright 2005-2007 by Gilles Caulier
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -62,12 +61,16 @@
protected slots:
+ virtual void slotDefault();
virtual void slotTimer();
protected:
void closeEvent(QCloseEvent *e);
virtual void finalRendering(){};
+ virtual void writeUserSettings(void){};
+ virtual void readUserSettings(void){ slotDefault(); };
+ virtual void resetValues(void){};
private slots:
@@ -78,12 +81,12 @@
private:
- void writeConfig();
+ void readSettings(void);
+ void writeSettings(void);
private:
ImageDlgBasePriv* d;
-
};
} // NameSpace Digikam
--- trunk/extragear/graphics/digikam/libs/dialogs/imageguidedlg.cpp #622293:622294
@@ -1,10 +1,10 @@
/* ============================================================
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date : 2005-05-07
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date : 2005-05-07
* Description : A threaded filter plugin dialog with a preview
* image guide widget and a settings user area
*
- * Copyright 2005-2006 by Gilles Caulier
+ * Copyright 2005-2007 by Gilles Caulier
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
--- trunk/extragear/graphics/digikam/libs/dialogs/imageguidedlg.h #622293:622294
@@ -1,11 +1,10 @@
/* ============================================================
- * File : imageguidedlg.h
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date : 2005-05-07
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date : 2005-05-07
* Description : A threaded filter plugin dialog with a preview
* image guide widget and a settings user area
*
- * Copyright 2005-2006 by Gilles Caulier
+ * Copyright 2005-2007 by Gilles Caulier
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -76,13 +75,15 @@
void slotEffect();
void slotOk();
-private slots:
+protected slots:
virtual void slotCancel();
virtual void slotUser1();
virtual void slotDefault();
virtual void slotInit();
virtual void readUserSettings(void){ slotDefault(); };
+
+private slots:
void slotResized();
void slotHelp();
More information about the Digikam-devel
mailing list