1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2003-08-03
* Description : setup Metadata tab.
*
* Copyright (C) 2003-2004 by Ralf Holzer <ralf at well.com>
* Copyright (C) 2003-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
// Qt includes.
#include <qlayout.h>
#include <qvbuttongroup.h>
#include <qvgroupbox.h>
#include <qhgroupbox.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qwhatsthis.h>
#include <qtooltip.h>
#include <qhbox.h>
// KDE includes.
#include <klocale.h>
#include <kactivelabel.h>
#include <kdialog.h>
#include <kurllabel.h>
#include <kiconloader.h>
#include <kglobalsettings.h>
#include <kstandarddirs.h>
#include <kapplication.h>
// Local includes.
#include "albumsettings.h"
#include "setupmetadata.h"
#include "setupmetadata.moc"
namespace Digikam
{
class SetupMetadataPriv
{
public:
SetupMetadataPriv()
{
ExifAutoRotateAsChanged = false;
saveCommentsBox = 0;
ExifRotateBox = 0;
ExifSetOrientationBox = 0;
saveRatingBox = 0;
saveTagsIptcBox = 0;
saveDateTimeBox = 0;
savePhotographerIdIptcBox = 0;
saveCreditsIptcBox = 0;
}
bool ExifAutoRotateAsChanged;
bool ExifAutoRotateOrg;
QCheckBox *saveCommentsBox;
QCheckBox *ExifRotateBox;
QCheckBox *ExifSetOrientationBox;
QCheckBox *saveRatingBox;
QCheckBox *saveTagsIptcBox;
QCheckBox *saveDateTimeBox;
QCheckBox *savePhotographerIdIptcBox;
QCheckBox *saveCreditsIptcBox;
};
SetupMetadata::SetupMetadata(QWidget* parent )
: QWidget(parent)
{
d = new SetupMetadataPriv;
QVBoxLayout *mainLayout = new QVBoxLayout(parent, 0, KDialog::spacingHint());
// --------------------------------------------------------
QGroupBox *ExifGroup = new QGroupBox(1, Qt::Horizontal, i18n("EXIF Actions"), parent);
d->ExifRotateBox = new QCheckBox(ExifGroup);
d->ExifRotateBox->setText(i18n("Show images/thumbs &rotated according to orientation tag"));
d->ExifSetOrientationBox = new QCheckBox(ExifGroup);
d->ExifSetOrientationBox->setText(i18n("Set orientation tag to normal after rotate/flip"));
// --------------------------------------------------------
QGroupBox *IptcGroup = new QGroupBox(1, Qt::Horizontal, i18n("IPTC Actions"), parent);
d->saveTagsIptcBox = new QCheckBox(IptcGroup);
d->saveTagsIptcBox->setText(i18n("&Save image tags as \"Keywords\" tag"));
QWhatsThis::add( d->saveTagsIptcBox, i18n("<p>Turn this option on to store the image tags "
"in the IPTC <i>Keywords</i> tag."));
d->savePhotographerIdIptcBox = new QCheckBox(IptcGroup);
d->savePhotographerIdIptcBox->setText(i18n("&Save default photographer identity as tags"));
QWhatsThis::add( d->savePhotographerIdIptcBox, i18n("<p>Turn this option on to store the default "
"photographer identity in the IPTC tags. You can set this "
"value in the Identity setup page."));
d->saveCreditsIptcBox = new QCheckBox(IptcGroup);
d->saveCreditsIptcBox->setText(i18n("&Save default credit and copyright identity as tags"));
QWhatsThis::add( d->saveCreditsIptcBox, i18n("<p>Turn this option on to store the default "
"credit and copyright identity in the IPTC tags. "
"You can set this value in the Identity setup page."));
// --------------------------------------------------------
QGroupBox *commonGroup = new QGroupBox(1, Qt::Horizontal, i18n("Common Metadata Actions"), parent);
d->saveCommentsBox = new QCheckBox(commonGroup);
d->saveCommentsBox->setText(i18n("&Save image captions as embedded text"));
QWhatsThis::add( d->saveCommentsBox, i18n("<p>Turn this option on to store image captions "
"in the JFIF section, EXIF tag, and IPTC tag."));
d->saveDateTimeBox = new QCheckBox(commonGroup);
d->saveDateTimeBox->setText(i18n("&Save image timestamps as tags"));
QWhatsThis::add( d->saveDateTimeBox, i18n("<p>Turn this option on to store the image date and time "
"in the EXIF and IPTC tags."));
d->saveRatingBox = new QCheckBox(commonGroup);
d->saveRatingBox->setText(i18n("&Save image rating as tags"));
QWhatsThis::add( d->saveRatingBox, i18n("<p>Turn this option on to store the image rating "
"in the EXIF tag and IPTC <i>Urgency</i> tag."));
// --------------------------------------------------------
QHBox *hbox = new QHBox(parent);
KURLLabel *exiv2LogoLabel = new KURLLabel(hbox);
exiv2LogoLabel->setText(QString());
exiv2LogoLabel->setURL("http://www.exiv2.org");
KGlobal::dirs()->addResourceType("logo-exiv2", KGlobal::dirs()->kde_default("data") + "digikam/data");
QString directory = KGlobal::dirs()->findResourceDir("logo-exiv2", "logo-exiv2.png");
exiv2LogoLabel->setPixmap( QPixmap( directory + "logo-exiv2.png" ) );
QToolTip::add(exiv2LogoLabel, i18n("Visit Exiv2 project website"));
KActiveLabel* explanation = new KActiveLabel(hbox);
explanation->setText(i18n("<p><b><a href='http://en.wikipedia.org/wiki/Exif'>EXIF</a></b> is "
"a standard used by most digital cameras today to store technical "
"informations about photograph.</p>"
"<p><b><a href='http://en.wikipedia.org/wiki/IPTC'>IPTC</a></b> is "
"an standard used in digital photography to store "
"photographer informations in pictures.</p>"));
mainLayout->addWidget(ExifGroup);
mainLayout->addWidget(IptcGroup);
mainLayout->addWidget(commonGroup);
mainLayout->addSpacing(KDialog::spacingHint());
mainLayout->addWidget(hbox);
mainLayout->addStretch();
readSettings();
// --------------------------------------------------------
connect(exiv2LogoLabel, SIGNAL(leftClickedURL(const QString&)),
this, SLOT(processExiv2URL(const QString&)));
connect(d->ExifRotateBox, SIGNAL(toggled(bool)),
this, SLOT(slotExifAutoRotateToggled(bool)));
}
SetupMetadata::~SetupMetadata()
{
delete d;
}
void SetupMetadata::processExiv2URL(const QString& url)
{
KApplication::kApplication()->invokeBrowser(url);
}
void SetupMetadata::applySettings()
{
AlbumSettings* settings = AlbumSettings::instance();
if (!settings) return;
settings->setExifRotate(d->ExifRotateBox->isChecked());
settings->setExifSetOrientation(d->ExifSetOrientationBox->isChecked());
settings->setSaveComments(d->saveCommentsBox->isChecked());
settings->setSaveDateTime(d->saveDateTimeBox->isChecked());
settings->setSaveRating(d->saveRatingBox->isChecked());
settings->setSaveIptcTags(d->saveTagsIptcBox->isChecked());
settings->setSaveIptcPhotographerId(d->savePhotographerIdIptcBox->isChecked());
settings->setSaveIptcCredits(d->saveCreditsIptcBox->isChecked());
settings->saveSettings();
}
void SetupMetadata::readSettings()
{
AlbumSettings* settings = AlbumSettings::instance();
if (!settings) return;
d->ExifAutoRotateOrg = settings->getExifRotate();
d->ExifRotateBox->setChecked(d->ExifAutoRotateOrg);
d->ExifSetOrientationBox->setChecked(settings->getExifSetOrientation());
d->saveCommentsBox->setChecked(settings->getSaveComments());
d->saveDateTimeBox->setChecked(settings->getSaveDateTime());
d->saveRatingBox->setChecked(settings->getSaveRating());
d->saveTagsIptcBox->setChecked(settings->getSaveIptcTags());
d->savePhotographerIdIptcBox->setChecked(settings->getSaveIptcPhotographerId());
d->saveCreditsIptcBox->setChecked(settings->getSaveIptcCredits());
}
bool SetupMetadata::exifAutoRotateAsChanged()
{
return d->ExifAutoRotateAsChanged;
}
void SetupMetadata::slotExifAutoRotateToggled(bool b)
{
if ( b != d->ExifAutoRotateOrg)
d->ExifAutoRotateAsChanged = true;
else
d->ExifAutoRotateAsChanged = false;
}
} // namespace Digikam
|