~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to core/utilities/importui/widgets/advancedsettings.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

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        : 2011-08-12
 
7
 * Description : advanced settings for camera interface.
 
8
 *
 
9
 * Copyright (C) 2011-2012 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
#include "advancedsettings.moc"
 
25
 
 
26
// Qt includes
 
27
 
 
28
#include <QVBoxLayout>
 
29
#include <QLabel>
 
30
#include <QCheckBox>
 
31
#include <QToolButton>
 
32
 
 
33
// KDE includes
 
34
 
 
35
#include <kdialog.h>
 
36
#include <klocale.h>
 
37
#include <kcombobox.h>
 
38
#include <khbox.h>
 
39
#include <kdebug.h>
 
40
 
 
41
// Local includes
 
42
 
 
43
#include "templateselector.h"
 
44
#include "ddatetimeedit.h"
 
45
#include "template.h"
 
46
 
 
47
namespace Digikam
 
48
{
 
49
 
 
50
class AdvancedSettings::Private
 
51
{
 
52
public:
 
53
 
 
54
    Private()
 
55
        : formatLabel(0),
 
56
          autoRotateCheck(0),
 
57
          convertJpegCheck(0),
 
58
          fixDateTimeCheck(0),
 
59
          losslessFormat(0),
 
60
          dateTimeEdit(0),
 
61
          templateSelector(0)
 
62
    {
 
63
    }
 
64
 
 
65
    QLabel*           formatLabel;
 
66
 
 
67
    QCheckBox*        autoRotateCheck;
 
68
    QCheckBox*        convertJpegCheck;
 
69
    QCheckBox*        fixDateTimeCheck;
 
70
 
 
71
    KComboBox*        losslessFormat;
 
72
 
 
73
    DDateTimeEdit*    dateTimeEdit;
 
74
 
 
75
    TemplateSelector* templateSelector;
 
76
};
 
77
 
 
78
AdvancedSettings::AdvancedSettings(QWidget* const parent)
 
79
    : QWidget(parent), d(new Private)
 
80
{
 
81
    QVBoxLayout* onFlyVlay = new QVBoxLayout(this);
 
82
    d->templateSelector    = new TemplateSelector(this);
 
83
    d->fixDateTimeCheck    = new QCheckBox(i18n("Fix internal date && time"), this);
 
84
    d->dateTimeEdit        = new DDateTimeEdit(this, "datepicker");
 
85
    d->autoRotateCheck     = new QCheckBox(i18n("Auto-rotate/flip image"), this);
 
86
    d->convertJpegCheck    = new QCheckBox(i18n("Convert to lossless file format"), this);
 
87
    KHBox* hbox2           = new KHBox(this);
 
88
    d->formatLabel         = new QLabel(i18n("New image format:"), hbox2);
 
89
    d->losslessFormat      = new KComboBox(hbox2);
 
90
    d->losslessFormat->insertItem(0, "PNG");
 
91
    d->losslessFormat->insertItem(1, "TIF");
 
92
    d->losslessFormat->insertItem(2, "JP2");
 
93
    d->losslessFormat->insertItem(3, "PGF");
 
94
 
 
95
    onFlyVlay->addWidget(d->templateSelector);
 
96
    onFlyVlay->addWidget(d->fixDateTimeCheck);
 
97
    onFlyVlay->addWidget(d->dateTimeEdit);
 
98
    onFlyVlay->addWidget(d->autoRotateCheck);
 
99
    onFlyVlay->addWidget(d->convertJpegCheck);
 
100
    onFlyVlay->addWidget(hbox2);
 
101
    onFlyVlay->addStretch();
 
102
    onFlyVlay->setMargin(KDialog::spacingHint());
 
103
    onFlyVlay->setSpacing(KDialog::spacingHint());
 
104
 
 
105
    setWhatsThis(i18n("Set here all options to fix/transform JPEG files automatically "
 
106
                      "as they are downloaded."));
 
107
    d->autoRotateCheck->setWhatsThis(i18n("Enable this option if you want images automatically "
 
108
                                          "rotated or flipped using EXIF information provided by the camera."));
 
109
    d->templateSelector->setWhatsThis(i18n("Select here which metadata template you want to apply "
 
110
                                           "to images."));
 
111
    d->fixDateTimeCheck->setWhatsThis(i18n("Enable this option to set date and time metadata "
 
112
                                           "tags to the right values if your camera does not set "
 
113
                                           "these tags correctly when pictures are taken. The values will "
 
114
                                           "be saved in the DateTimeDigitized and DateTimeCreated EXIF, XMP, and IPTC tags."));
 
115
    d->convertJpegCheck->setWhatsThis(i18n("Enable this option to automatically convert "
 
116
                                           "all JPEG files to a lossless image format. <b>Note:</b> Image conversion can take a "
 
117
                                           "while on a slow computer."));
 
118
    d->losslessFormat->setWhatsThis(i18n("Select your preferred lossless image file format to "
 
119
                                         "convert to. <b>Note:</b> All metadata will be preserved during the conversion."));
 
120
 
 
121
    // ---------------------------------------------------------------------------------------
 
122
 
 
123
    connect(d->convertJpegCheck, SIGNAL(toggled(bool)),
 
124
            d->losslessFormat, SLOT(setEnabled(bool)));
 
125
 
 
126
    connect(d->convertJpegCheck, SIGNAL(toggled(bool)),
 
127
            d->formatLabel, SLOT(setEnabled(bool)));
 
128
 
 
129
    connect(d->convertJpegCheck, SIGNAL(toggled(bool)),
 
130
            this, SIGNAL(signalDownloadNameChanged()));
 
131
 
 
132
    connect(d->losslessFormat, SIGNAL(activated(int)),
 
133
            this, SIGNAL(signalDownloadNameChanged()));
 
134
 
 
135
    connect(d->fixDateTimeCheck, SIGNAL(toggled(bool)),
 
136
            d->dateTimeEdit, SLOT(setEnabled(bool)));
 
137
}
 
138
 
 
139
AdvancedSettings::~AdvancedSettings()
 
140
{
 
141
    delete d;
 
142
}
 
143
 
 
144
void AdvancedSettings::readSettings(KConfigGroup& group)
 
145
{
 
146
    d->autoRotateCheck->setChecked(group.readEntry("AutoRotate",         true));
 
147
    d->fixDateTimeCheck->setChecked(group.readEntry("FixDateTime",       false));
 
148
    d->templateSelector->setTemplateIndex(group.readEntry("Template",    0));
 
149
    d->convertJpegCheck->setChecked(group.readEntry("ConvertJpeg",       false));
 
150
    d->losslessFormat->setCurrentIndex(group.readEntry("LossLessFormat", 0));      // PNG by default
 
151
 
 
152
    d->dateTimeEdit->setEnabled(d->fixDateTimeCheck->isChecked());
 
153
    d->losslessFormat->setEnabled(d->convertJpegCheck->isChecked());
 
154
    d->formatLabel->setEnabled(d->convertJpegCheck->isChecked());
 
155
}
 
156
 
 
157
void AdvancedSettings::saveSettings(KConfigGroup& group)
 
158
{
 
159
    group.writeEntry("AutoRotate",     d->autoRotateCheck->isChecked());
 
160
    group.writeEntry("FixDateTime",    d->fixDateTimeCheck->isChecked());
 
161
    group.writeEntry("Template",       d->templateSelector->getTemplateIndex());
 
162
    group.writeEntry("ConvertJpeg",    d->convertJpegCheck->isChecked());
 
163
    group.writeEntry("LossLessFormat", d->losslessFormat->currentIndex());
 
164
}
 
165
 
 
166
DownloadSettings AdvancedSettings::settings() const
 
167
{
 
168
    DownloadSettings settings;
 
169
 
 
170
    settings.autoRotate     = d->autoRotateCheck->isChecked();
 
171
    settings.fixDateTime    = d->fixDateTimeCheck->isChecked();
 
172
    settings.convertJpeg    = d->convertJpegCheck->isChecked();
 
173
    settings.newDateTime    = d->dateTimeEdit->dateTime();
 
174
    settings.losslessFormat = d->losslessFormat->currentText();
 
175
    settings.templateTitle  = d->templateSelector->getTemplate().templateTitle();
 
176
 
 
177
    return settings;
 
178
}
 
179
 
 
180
}  // namespace Digikam