1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : save JPEG 2000 image options.
9
* Copyright (C) 2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
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)
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.
22
* ============================================================ */
28
#include <qcheckbox.h>
30
#include <qwhatsthis.h>
36
#include <knuminput.h>
40
#include "jp2ksettings.h"
41
#include "jp2ksettings.moc"
46
class JP2KSettingsPriv
54
labelJPEG2000compression = 0;
55
JPEG2000compression = 0;
59
QGridLayout *JPEG2000Grid;
61
QLabel *labelJPEG2000compression;
63
QCheckBox *JPEG2000LossLess;
65
KIntNumInput *JPEG2000compression;
68
JP2KSettings::JP2KSettings(QWidget *parent)
69
: QWidget(parent, 0, Qt::WDestructiveClose)
71
d = new JP2KSettingsPriv;
73
d->JPEG2000Grid = new QGridLayout(this, 1, 1, KDialog::spacingHint());
74
d->JPEG2000LossLess = new QCheckBox(i18n("Lossless JPEG 2000 files"), this);
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>"));
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);
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 "
87
"<b>50</b>: medium quality<p>"
88
"<b>75</b>: good quality (default)<p>"
89
"<b>100</b>: high quality (no compression and "
91
"<b>Note: JPEG 2000 is not a lossless image "
92
"compression format when you use this setting.</b>"));
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);
99
connect(d->JPEG2000LossLess, SIGNAL(toggled(bool)),
100
this, SLOT(slotToggleJPEG2000LossLess(bool)));
102
connect(d->JPEG2000LossLess, SIGNAL(toggled(bool)),
103
this, SLOT(slotToggleJPEG2000LossLess(bool)));
106
JP2KSettings::~JP2KSettings()
111
void JP2KSettings::setCompressionValue(int val)
113
d->JPEG2000compression->setValue(val);
116
int JP2KSettings::getCompressionValue()
118
return d->JPEG2000compression->value();
121
void JP2KSettings::setLossLessCompression(bool b)
123
d->JPEG2000LossLess->setChecked(b);
124
slotToggleJPEG2000LossLess(d->JPEG2000LossLess->isChecked());
127
bool JP2KSettings::getLossLessCompression()
129
return d->JPEG2000LossLess->isChecked();
132
void JP2KSettings::slotToggleJPEG2000LossLess(bool b)
134
d->JPEG2000compression->setEnabled(!b);
135
d->labelJPEG2000compression->setEnabled(!b);
138
} // namespace Digikam