~ubuntu-branches/ubuntu/intrepid/digikam/intrepid

« back to all changes in this revision

Viewing changes to digikam/libs/dimg/loaders/jp2ksettings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2008-07-17 20:25:39 UTC
  • mfrom: (1.3.2 upstream) (37 hardy)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: james.westby@ubuntu.com-20080717202539-1bw3w3nrsso7yj4z
* New upstream release
  - digiKam 0.9.4 Release Plan (KDE3) ~ 13 July 08 (Closes: #490144)
* DEB_CONFIGURE_EXTRA_FLAGS := --without-included-sqlite3
* Debhelper compatibility level V7
* Install pixmaps in debian/*.install
* Add debian/digikam.lintian-overrides

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of digiKam project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2007-08-02
 
7
 * Description : save JPEG 2000 image options.
 
8
 *
 
9
 * Copyright (C) 2007 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)
 
15
 * any later version.
 
16
 *
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 *
 
22
 * ============================================================ */
 
23
 
 
24
// Qt includes.
 
25
 
 
26
#include <qstring.h>
 
27
#include <qlabel.h>
 
28
#include <qcheckbox.h>
 
29
#include <qlayout.h>
 
30
#include <qwhatsthis.h>
 
31
 
 
32
// KDE includes.
 
33
 
 
34
#include <klocale.h>
 
35
#include <kdialog.h>
 
36
#include <knuminput.h>
 
37
 
 
38
// Local includes.
 
39
 
 
40
#include "jp2ksettings.h"
 
41
#include "jp2ksettings.moc"
 
42
 
 
43
namespace Digikam
 
44
{
 
45
 
 
46
class JP2KSettingsPriv
 
47
{
 
48
 
 
49
public:
 
50
 
 
51
    JP2KSettingsPriv()
 
52
    {
 
53
        JPEG2000Grid             = 0;
 
54
        labelJPEG2000compression = 0;
 
55
        JPEG2000compression      = 0;
 
56
        JPEG2000LossLess         = 0;
 
57
    }
 
58
 
 
59
    QGridLayout  *JPEG2000Grid;
 
60
 
 
61
    QLabel       *labelJPEG2000compression;
 
62
 
 
63
    QCheckBox    *JPEG2000LossLess;
 
64
 
 
65
    KIntNumInput *JPEG2000compression;
 
66
};
 
67
 
 
68
JP2KSettings::JP2KSettings(QWidget *parent)
 
69
            : QWidget(parent, 0, Qt::WDestructiveClose)
 
70
{
 
71
    d = new JP2KSettingsPriv;
 
72
 
 
73
    d->JPEG2000Grid     = new QGridLayout(this, 1, 1, KDialog::spacingHint());
 
74
    d->JPEG2000LossLess = new QCheckBox(i18n("Lossless JPEG 2000 files"), this);
 
75
 
 
76
    QWhatsThis::add(d->JPEG2000LossLess, i18n("<p>Toggle lossless compression for JPEG 2000 images.<p>"
 
77
                                              "If you enable this option, you will use a lossless method "
 
78
                                              "to compress JPEG 2000 pictures.<p>"));
 
79
 
 
80
    d->JPEG2000compression = new KIntNumInput(75, this);
 
81
    d->JPEG2000compression->setRange(1, 100, 1, true );
 
82
    d->labelJPEG2000compression = new QLabel(i18n("JPEG 2000 quality:"), this);
 
83
 
 
84
    QWhatsThis::add( d->JPEG2000compression, i18n("<p>The quality value for JPEG 2000 images:<p>"
 
85
                                                  "<b>1</b>: low quality (high compression and small "
 
86
                                                  "file size)<p>"
 
87
                                                  "<b>50</b>: medium quality<p>"
 
88
                                                  "<b>75</b>: good quality (default)<p>"
 
89
                                                  "<b>100</b>: high quality (no compression and "
 
90
                                                  "large file size)<p>"
 
91
                                                  "<b>Note: JPEG 2000 is not a lossless image "
 
92
                                                  "compression format when you use this setting.</b>"));
 
93
 
 
94
    d->JPEG2000Grid->addMultiCellWidget(d->JPEG2000LossLess, 0, 0, 0, 1);
 
95
    d->JPEG2000Grid->addMultiCellWidget(d->labelJPEG2000compression, 1, 1, 0, 0);
 
96
    d->JPEG2000Grid->addMultiCellWidget(d->JPEG2000compression, 1, 1, 1, 1);
 
97
    d->JPEG2000Grid->setColStretch(1, 10);
 
98
 
 
99
    connect(d->JPEG2000LossLess, SIGNAL(toggled(bool)),
 
100
            this, SLOT(slotToggleJPEG2000LossLess(bool)));
 
101
 
 
102
    connect(d->JPEG2000LossLess, SIGNAL(toggled(bool)),
 
103
            this, SLOT(slotToggleJPEG2000LossLess(bool)));
 
104
}
 
105
 
 
106
JP2KSettings::~JP2KSettings()
 
107
{
 
108
    delete d;
 
109
}
 
110
 
 
111
void JP2KSettings::setCompressionValue(int val)
 
112
{
 
113
    d->JPEG2000compression->setValue(val);
 
114
}
 
115
 
 
116
int JP2KSettings::getCompressionValue()
 
117
{
 
118
    return d->JPEG2000compression->value();
 
119
}
 
120
 
 
121
void JP2KSettings::setLossLessCompression(bool b)
 
122
{
 
123
    d->JPEG2000LossLess->setChecked(b);
 
124
    slotToggleJPEG2000LossLess(d->JPEG2000LossLess->isChecked());
 
125
}
 
126
 
 
127
bool JP2KSettings::getLossLessCompression()
 
128
{
 
129
    return d->JPEG2000LossLess->isChecked();
 
130
}
 
131
 
 
132
void JP2KSettings::slotToggleJPEG2000LossLess(bool b)
 
133
{
 
134
    d->JPEG2000compression->setEnabled(!b);
 
135
    d->labelJPEG2000compression->setEnabled(!b);
 
136
}
 
137
 
 
138
}  // namespace Digikam
 
139