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.
*
* ============================================================ */
// TQt includes.
#include <tqlayout.h>
#include <tqvbuttongroup.h>
#include <tqvgroupbox.h>
#include <tqhgroupbox.h>
#include <tqgroupbox.h>
#include <tqcheckbox.h>
#include <tqlabel.h>
#include <tqwhatsthis.h>
#include <tqtooltip.h>
#include <tqhbox.h>
// KDE includes.
#include <tdelocale.h>
#include <kactivelabel.h>
#include <kdialog.h>
#include <kurllabel.h>
#include <kiconloader.h>
#include <tdeglobalsettings.h>
#include <kstandarddirs.h>
#include <tdeapplication.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;
TQCheckBox *saveCommentsBox;
TQCheckBox *ExifRotateBox;
TQCheckBox *ExifSetOrientationBox;
TQCheckBox *saveRatingBox;
TQCheckBox *saveTagsIptcBox;
TQCheckBox *saveDateTimeBox;
TQCheckBox *savePhotographerIdIptcBox;
TQCheckBox *saveCreditsIptcBox;
};
SetupMetadata::SetupMetadata(TQWidget* parent )
: TQWidget(parent)
{
d = new SetupMetadataPriv;
TQVBoxLayout *mainLayout = new TQVBoxLayout(parent, 0, KDialog::spacingHint());
// --------------------------------------------------------
TQGroupBox *ExifGroup = new TQGroupBox(1, TQt::Horizontal, i18n("EXIF Actions"), parent);
d->ExifRotateBox = new TQCheckBox(ExifGroup);
d->ExifRotateBox->setText(i18n("Show images/thumbs &rotated according to orientation tag"));
d->ExifSetOrientationBox = new TQCheckBox(ExifGroup);
d->ExifSetOrientationBox->setText(i18n("Set orientation tag to normal after rotate/flip"));
// --------------------------------------------------------
TQGroupBox *IptcGroup = new TQGroupBox(1, TQt::Horizontal, i18n("IPTC Actions"), parent);
d->saveTagsIptcBox = new TQCheckBox(IptcGroup);
d->saveTagsIptcBox->setText(i18n("&Save image tags as \"Keywords\" tag"));
TQWhatsThis::add( d->saveTagsIptcBox, i18n("<p>Turn this option on to store the image tags "
"in the IPTC <i>Keywords</i> tag."));
d->savePhotographerIdIptcBox = new TQCheckBox(IptcGroup);
d->savePhotographerIdIptcBox->setText(i18n("&Save default photographer identity as tags"));
TQWhatsThis::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 TQCheckBox(IptcGroup);
d->saveCreditsIptcBox->setText(i18n("&Save default credit and copyright identity as tags"));
TQWhatsThis::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."));
// --------------------------------------------------------
TQGroupBox *commonGroup = new TQGroupBox(1, TQt::Horizontal, i18n("Common Metadata Actions"), parent);
d->saveCommentsBox = new TQCheckBox(commonGroup);
d->saveCommentsBox->setText(i18n("&Save image captions as embedded text"));
TQWhatsThis::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 TQCheckBox(commonGroup);
d->saveDateTimeBox->setText(i18n("&Save image timestamps as tags"));
TQWhatsThis::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 TQCheckBox(commonGroup);
d->saveRatingBox->setText(i18n("&Save image rating as tags"));
TQWhatsThis::add( d->saveRatingBox, i18n("<p>Turn this option on to store the image rating "
"in the EXIF tag and IPTC <i>Urgency</i> tag."));
// --------------------------------------------------------
TQHBox *hbox = new TQHBox(parent);
KURLLabel *exiv2LogoLabel = new KURLLabel(hbox);
exiv2LogoLabel->setText(TQString());
exiv2LogoLabel->setURL("http://www.exiv2.org");
TDEGlobal::dirs()->addResourceType("logo-exiv2", TDEGlobal::dirs()->kde_default("data") + "digikam/data");
TQString directory = TDEGlobal::dirs()->findResourceDir("logo-exiv2", "logo-exiv2.png");
exiv2LogoLabel->setPixmap( TQPixmap( directory + "logo-exiv2.png" ) );
TQToolTip::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, TQT_SIGNAL(leftClickedURL(const TQString&)),
this, TQT_SLOT(processExiv2URL(const TQString&)));
connect(d->ExifRotateBox, TQT_SIGNAL(toggled(bool)),
this, TQT_SLOT(slotExifAutoRotateToggled(bool)));
}
SetupMetadata::~SetupMetadata()
{
delete d;
}
void SetupMetadata::processExiv2URL(const TQString& url)
{
TDEApplication::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
|