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

« back to all changes in this revision

Viewing changes to libs/dimg/filters/curves/curvessettings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
    CurvesSettingsPriv() :
78
78
        histoSegments(0),
79
79
        curvesBox(0)
80
 
        {}
 
80
    {}
81
81
 
82
82
    static const QString configCurveEntry;
83
83
 
89
89
// --------------------------------------------------------
90
90
 
91
91
CurvesSettings::CurvesSettings(QWidget* parent, DImg* img)
92
 
              : QWidget(parent),
93
 
                d(new CurvesSettingsPriv)
 
92
    : QWidget(parent),
 
93
      d(new CurvesSettingsPriv)
94
94
{
95
95
    d->histoSegments  = img->sixteenBit() ? 65535 : 255;
96
96
    QGridLayout* grid = new QGridLayout(this);
153
153
        {
154
154
            // Black tonal curves point.
155
155
            d->curvesBox->curves()->setCurvePoint(LuminosityChannel, 1,
156
 
                    QPoint(qMax(qMax(sc.red(), sc.green()), sc.blue()), 42*d->histoSegments/256));
 
156
                                                  QPoint(qMax(qMax(sc.red(), sc.green()), sc.blue()), 42*d->histoSegments/256));
157
157
            d->curvesBox->curves()->setCurvePoint(RedChannel, 1, QPoint(sc.red(), 42*d->histoSegments/256));
158
158
            d->curvesBox->curves()->setCurvePoint(GreenChannel, 1, QPoint(sc.green(), 42*d->histoSegments/256));
159
159
            d->curvesBox->curves()->setCurvePoint(BlueChannel, 1, QPoint(sc.blue(), 42*d->histoSegments/256));
164
164
        {
165
165
            // Gray tonal curves point.
166
166
            d->curvesBox->curves()->setCurvePoint(LuminosityChannel, 8,
167
 
                    QPoint(qMax(qMax(sc.red(), sc.green()), sc.blue()), 128*d->histoSegments/256));
 
167
                                                  QPoint(qMax(qMax(sc.red(), sc.green()), sc.blue()), 128*d->histoSegments/256));
168
168
            d->curvesBox->curves()->setCurvePoint(RedChannel, 8, QPoint(sc.red(), 128*d->histoSegments/256));
169
169
            d->curvesBox->curves()->setCurvePoint(GreenChannel, 8, QPoint(sc.green(), 128*d->histoSegments/256));
170
170
            d->curvesBox->curves()->setCurvePoint(BlueChannel, 8, QPoint(sc.blue(), 128*d->histoSegments/256));
175
175
        {
176
176
            // White tonal curves point.
177
177
            d->curvesBox->curves()->setCurvePoint(LuminosityChannel, 15,
178
 
                    QPoint(qMax(qMax(sc.red(), sc.green()), sc.blue()), 213*d->histoSegments/256));
 
178
                                                  QPoint(qMax(qMax(sc.red(), sc.green()), sc.blue()), 213*d->histoSegments/256));
179
179
            d->curvesBox->curves()->setCurvePoint(RedChannel, 15, QPoint(sc.red(), 213*d->histoSegments/256));
180
180
            d->curvesBox->curves()->setCurvePoint(GreenChannel, 15, QPoint(sc.green(), 213*d->histoSegments/256));
181
181
            d->curvesBox->curves()->setCurvePoint(BlueChannel, 15, QPoint(sc.blue(), 213*d->histoSegments/256));
192
192
    // Calculate Red, green, blue curves.
193
193
 
194
194
    for (int i = LuminosityChannel ; i <= BlueChannel ; ++i)
195
 
       d->curvesBox->curves()->curvesCalculateCurve(i);
 
195
    {
 
196
        d->curvesBox->curves()->curvesCalculateCurve(i);
 
197
    }
196
198
 
197
199
    d->curvesBox->repaint();
198
200
 
252
254
    KUrl loadCurvesFile;
253
255
 
254
256
    loadCurvesFile = KFileDialog::getOpenUrl(KGlobalSettings::documentPath(),
255
 
                                             QString( "*" ), kapp->activeWindow(),
256
 
                                             QString( i18n("Select Gimp Curves File to Load")) );
 
257
                     QString( "*" ), kapp->activeWindow(),
 
258
                     QString( i18n("Select Gimp Curves File to Load")) );
 
259
 
257
260
    if ( loadCurvesFile.isEmpty() )
258
 
       return;
 
261
    {
 
262
        return;
 
263
    }
259
264
 
260
265
    if ( d->curvesBox->curves()->loadCurvesFromGimpCurvesFile( loadCurvesFile ) == false )
261
266
    {
270
275
    KUrl saveCurvesFile;
271
276
 
272
277
    saveCurvesFile = KFileDialog::getSaveUrl(KGlobalSettings::documentPath(),
273
 
                                             QString( "*" ), kapp->activeWindow(),
274
 
                                             QString( i18n("Gimp Curves File to Save")) );
 
278
                     QString( "*" ), kapp->activeWindow(),
 
279
                     QString( i18n("Gimp Curves File to Save")) );
 
280
 
275
281
    if ( saveCurvesFile.isEmpty() )
276
 
       return;
 
282
    {
 
283
        return;
 
284
    }
277
285
 
278
286
    if ( d->curvesBox->curves()->saveCurvesToGimpCurvesFile( saveCurvesFile ) == false )
279
287
    {