~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/expoblending/blendingdlg/enfusesettings.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer, Rohan Garg, Philip Muškovac, Felix Geyer
  • Date: 2011-09-23 18:18:55 UTC
  • mfrom: (1.2.36 upstream)
  • Revision ID: package-import@ubuntu.com-20110923181855-ifs67wxkugshev9k
Tags: 2:2.1.1-0ubuntu1
[ Rohan Garg ]
* New upstream release (LP: #834190)
  - debian/control
    + Build with libqtwebkit-dev
 - debian/kipi-plugins-common
    + Install libkvkontakte required by kipi-plugins
 - debian/digikam
    + Install panoramagui

[ Philip Muškovac ]
* New upstream release
  - debian/control:
    + Add libcv-dev, libcvaux-dev, libhighgui-dev, libboost-graph1.46-dev,
      libksane-dev, libxml2-dev, libxslt-dev, libqt4-opengl-dev, libqjson-dev,
      libgpod-dev and libqca2-dev to build-deps
    + Add packages for kipi-plugins, libmediawiki, libkface, libkgeomap and
      libkvkontakte
  - debian/rules:
    + Don't build with gphoto2 since it doesn't build with it.
  - Add kubuntu_fix_test_linking.diff to fix linking of the dngconverter test
  - update install files
  - update kubuntu_01_mysqld_executable_name.diff for new cmake layout
    and rename to kubuntu_mysqld_executable_name.diff
* Fix typo in digikam-data description (LP: #804894)
* Fix Vcs links

[ Felix Geyer ]
* Move library data files to the new packages libkface-data, libkgeomap-data
  and libkvkontakte-data.
* Override version of the embedded library packages to 1.0~digikam<version>.
* Exclude the library packages from digikam-dbg to prevent file conflicts in
  the future.
* Call dh_install with --list-missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of kipi-plugins project
 
4
 * http://www.kipi-plugins.org
 
5
 *
 
6
 * Date        : 2009-11-13
 
7
 * Description : a plugin to blend bracketed images.
 
8
 *
 
9
 * Copyright (C) 2009-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 *
 
11
 * This program is free software; you can redistribute it
 
12
 * and/or modify it under the terms of the GNU General
 
13
 * Public License as published by the Free Software Foundation;
 
14
 * either version 2, or (at your option) any later version.
 
15
 *
 
16
 * This program is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU General Public License for more details.
 
20
 *
 
21
 * ============================================================ */
 
22
 
 
23
#include "enfusesettings.moc"
 
24
 
 
25
// Qt includes
 
26
 
 
27
#include <QCheckBox>
 
28
#include <QGridLayout>
 
29
#include <QLabel>
 
30
 
 
31
// KDE includes
 
32
 
 
33
#include <kdialog.h>
 
34
#include <klocale.h>
 
35
#include <kseparator.h>
 
36
 
 
37
// Libkdcraw includes
 
38
 
 
39
#include <libkdcraw/rnuminput.h>
 
40
 
 
41
using namespace KDcrawIface;
 
42
 
 
43
namespace KIPIExpoBlendingPlugin
 
44
{
 
45
 
 
46
class EnfuseSettingsWidget::EnfuseSettingsWidgetPriv
 
47
{
 
48
public:
 
49
 
 
50
    EnfuseSettingsWidgetPriv()
 
51
    {
 
52
        autoLevelsCB    = 0;
 
53
        levelsLabel     = 0;
 
54
        levelsInput     = 0;
 
55
        hardMaskCB      = 0;
 
56
        exposureLabel   = 0;
 
57
        exposureInput   = 0;
 
58
        saturationLabel = 0;
 
59
        saturationInput = 0;
 
60
        contrastLabel   = 0;
 
61
        contrastInput   = 0;
 
62
        ciecam02CB      = 0;
 
63
    }
 
64
 
 
65
    QCheckBox*       autoLevelsCB;
 
66
    QCheckBox*       hardMaskCB;
 
67
    QCheckBox*       ciecam02CB;
 
68
 
 
69
    QLabel*          levelsLabel;
 
70
    QLabel*          exposureLabel;
 
71
    QLabel*          saturationLabel;
 
72
    QLabel*          contrastLabel;
 
73
 
 
74
    RIntNumInput*    levelsInput;
 
75
 
 
76
    RDoubleNumInput* exposureInput;
 
77
    RDoubleNumInput* saturationInput;
 
78
    RDoubleNumInput* contrastInput;
 
79
};
 
80
 
 
81
EnfuseSettingsWidget::EnfuseSettingsWidget(QWidget* parent)
 
82
                    : QWidget(parent), d(new EnfuseSettingsWidgetPriv)
 
83
{
 
84
    setAttribute(Qt::WA_DeleteOnClose);
 
85
 
 
86
    QGridLayout* grid = new QGridLayout(this);
 
87
 
 
88
    // ------------------------------------------------------------------------
 
89
 
 
90
    d->autoLevelsCB = new QCheckBox(i18nc("enfuse settings", "Auto Levels"), this);
 
91
    d->autoLevelsCB->setWhatsThis( i18n("Set automatic level selection (maximized) for pyramid blending."));
 
92
 
 
93
    d->levelsLabel  = new QLabel(i18nc("enfuse settings", "Levels:"));
 
94
    d->levelsInput  = new RIntNumInput();
 
95
    d->levelsInput->setRange(1, 29, 1);
 
96
    d->levelsInput->setSliderEnabled(true);
 
97
    d->levelsInput->setDefaultValue(20);
 
98
    d->levelsInput->setWhatsThis(i18n("Set the number of levels for pyramid blending. "
 
99
                                      "A low number trades off quality of results for faster "
 
100
                                      "execution time and lower memory usage."));
 
101
 
 
102
    d->hardMaskCB = new QCheckBox(i18n("Hard Mask"), this);
 
103
    d->hardMaskCB->setWhatsThis(i18n("Force hard blend masks and no averaging on finest "
 
104
                                     "scale. This is especially useful for focus "
 
105
                                     "stacks with thin and high contrast features, "
 
106
                                     "improves sharpness at the expense of increased noise."));
 
107
 
 
108
    d->exposureLabel = new QLabel(i18nc("enfuse settings", "Exposure:"));
 
109
    d->exposureInput = new RDoubleNumInput();
 
110
    d->exposureInput->setDecimals(2);
 
111
    d->exposureInput->input()->setRange(0.0, 1.0, 0.01, true);
 
112
    d->exposureInput->setDefaultValue(1.0);
 
113
    d->exposureInput->setWhatsThis( i18n("Set the exposure contribution for the blending process. "
 
114
                                         "Higher values will favor well-exposed pixels."));
 
115
 
 
116
    d->saturationLabel = new QLabel(i18nc("enfuse settings", "Saturation:"));
 
117
    d->saturationInput = new RDoubleNumInput();
 
118
    d->saturationInput->setDecimals(2);
 
119
    d->saturationInput->input()->setRange(0.0, 1.0, 0.01, true);
 
120
    d->saturationInput->setDefaultValue(0.2);
 
121
    d->saturationInput->setWhatsThis( i18n("Increasing this value makes pixels with high "
 
122
                                           "saturation contribute more to the final output."));
 
123
 
 
124
    d->contrastLabel = new QLabel(i18nc("enfuse settings", "Contrast:"));
 
125
    d->contrastInput = new RDoubleNumInput();
 
126
    d->contrastInput->setDecimals(2);
 
127
    d->contrastInput->input()->setRange(0.0, 1.0, 0.01, true);
 
128
    d->contrastInput->setDefaultValue(0.0);
 
129
    d->contrastInput->setWhatsThis(i18n("Sets the relative weight of high-contrast pixels. "
 
130
                                        "Increasing this weight makes pixels with neighboring differently colored "
 
131
                                        "pixels contribute more to the final output. Particularly useful for focus stacks."));
 
132
 
 
133
    d->ciecam02CB = new QCheckBox(i18n("Use Color Appearance Modelling"), this);
 
134
    d->ciecam02CB->setWhatsThis(i18n("Use Color Appearance Modelling (CIECAM02) to render detailed colors. "
 
135
                                     "Your input files should have embedded ICC profiles. If no ICC profile is present, "
 
136
                                     "sRGB color space will be used instead. The difference between using this option "
 
137
                                     "and default color blending algorithm is very slight, and will be most noticeable "
 
138
                                     "when you need to blend areas of different primary colors together."));
 
139
 
 
140
    // ------------------------------------------------------------------------
 
141
 
 
142
    grid->addWidget(d->autoLevelsCB,    0, 0, 1, 2);
 
143
    grid->addWidget(d->levelsLabel,     1, 0, 1, 1);
 
144
    grid->addWidget(d->levelsInput,     1, 1, 1, 1);
 
145
    grid->addWidget(d->hardMaskCB,      2, 0, 1, 2);
 
146
    grid->addWidget(d->exposureLabel,   3, 0, 1, 1);
 
147
    grid->addWidget(d->exposureInput,   3, 1, 1, 1);
 
148
    grid->addWidget(d->saturationLabel, 4, 0, 1, 1);
 
149
    grid->addWidget(d->saturationInput, 4, 1, 1, 1);
 
150
    grid->addWidget(d->contrastLabel,   5, 0, 1, 1);
 
151
    grid->addWidget(d->contrastInput,   5, 1, 1, 1);
 
152
    grid->addWidget(d->ciecam02CB,      6, 0, 1, 2);
 
153
    grid->setRowStretch(7, 10);
 
154
    grid->setMargin(KDialog::spacingHint());
 
155
    grid->setSpacing(KDialog::spacingHint());
 
156
 
 
157
    // ------------------------------------------------------------------------
 
158
 
 
159
    connect(d->autoLevelsCB, SIGNAL(toggled(bool)),
 
160
            d->levelsLabel, SLOT(setDisabled(bool)));
 
161
 
 
162
    connect(d->autoLevelsCB, SIGNAL(toggled(bool)),
 
163
            d->levelsInput, SLOT(setDisabled(bool)));
 
164
}
 
165
 
 
166
EnfuseSettingsWidget::~EnfuseSettingsWidget()
 
167
{
 
168
    delete d;
 
169
}
 
170
 
 
171
void EnfuseSettingsWidget::resetToDefault()
 
172
{
 
173
    d->autoLevelsCB->setChecked(true);
 
174
    d->levelsInput->slotReset();
 
175
    d->hardMaskCB->setChecked(false);
 
176
    d->exposureInput->slotReset();
 
177
    d->saturationInput->slotReset();
 
178
    d->contrastInput->slotReset();
 
179
    d->ciecam02CB->setChecked(false);
 
180
}
 
181
 
 
182
void EnfuseSettingsWidget::setSettings(const EnfuseSettings& settings)
 
183
{
 
184
    d->autoLevelsCB->setChecked(settings.autoLevels);
 
185
    d->levelsInput->setValue(settings.levels);
 
186
    d->hardMaskCB->setChecked(settings.hardMask);
 
187
    d->exposureInput->setValue(settings.exposure);
 
188
    d->saturationInput->setValue(settings.saturation);
 
189
    d->contrastInput->setValue(settings.contrast);
 
190
    d->ciecam02CB->setChecked(settings.ciecam02);
 
191
}
 
192
 
 
193
EnfuseSettings EnfuseSettingsWidget::settings() const
 
194
{
 
195
    EnfuseSettings settings;
 
196
    settings.autoLevels = d->autoLevelsCB->isChecked();
 
197
    settings.levels     = d->levelsInput->value();
 
198
    settings.hardMask   = d->hardMaskCB->isChecked();
 
199
    settings.exposure   = d->exposureInput->value();
 
200
    settings.saturation = d->saturationInput->value();
 
201
    settings.contrast   = d->contrastInput->value();
 
202
    settings.ciecam02   = d->ciecam02CB->isChecked();
 
203
    return settings;
 
204
}
 
205
 
 
206
void EnfuseSettingsWidget::readSettings(KConfigGroup& group)
 
207
{
 
208
    d->autoLevelsCB->setChecked(group.readEntry("Auto Levels",       true));
 
209
    d->levelsInput->setValue(group.readEntry("Levels Value",         d->levelsInput->defaultValue()));
 
210
    d->hardMaskCB->setChecked(group.readEntry("Hard Mask",           false));
 
211
    d->exposureInput->setValue(group.readEntry("Exposure Value",     d->exposureInput->defaultValue()));
 
212
    d->saturationInput->setValue(group.readEntry("Saturation Value", d->saturationInput->defaultValue()));
 
213
    d->contrastInput->setValue(group.readEntry("Contrast Value",     d->contrastInput->defaultValue()));
 
214
    d->ciecam02CB->setChecked(group.readEntry("CIECAM02",            false));
 
215
}
 
216
 
 
217
void EnfuseSettingsWidget::writeSettings(KConfigGroup& group)
 
218
{
 
219
    group.writeEntry("Auto Levels",      d->autoLevelsCB->isChecked());
 
220
    group.writeEntry("Levels Value",     d->levelsInput->value());
 
221
    group.writeEntry("Hard Mask",        d->hardMaskCB->isChecked());
 
222
    group.writeEntry("Exposure Value",   d->exposureInput->value());
 
223
    group.writeEntry("Saturation Value", d->saturationInput->value());
 
224
    group.writeEntry("Contrast Value",   d->contrastInput->value());
 
225
    group.writeEntry("CIECAM02",         d->ciecam02CB->isChecked());
 
226
}
 
227
 
 
228
} // namespace KIPIExpoBlendingPlugin