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
|
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2006-07-04
* Description : default IPTC identity setup tab.
*
* Copyright (C) 2006-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 <tqhgroupbox.h>
#include <tqgroupbox.h>
#include <tqlabel.h>
#include <tqwhatsthis.h>
#include <tqvalidator.h>
// KDE includes.
#include <tdelocale.h>
#include <kdialog.h>
#include <klineedit.h>
#include <kactivelabel.h>
// Local includes.
#include "albumsettings.h"
#include "setupidentity.h"
#include "setupidentity.moc"
namespace Digikam
{
class SetupIdentityPriv
{
public:
SetupIdentityPriv()
{
authorEdit = 0;
authorTitleEdit = 0;
creditEdit = 0;
sourceEdit = 0;
copyrightEdit = 0;
}
KLineEdit *authorEdit;
KLineEdit *authorTitleEdit;
KLineEdit *creditEdit;
KLineEdit *sourceEdit;
KLineEdit *copyrightEdit;
};
SetupIdentity::SetupIdentity(TQWidget* parent )
: TQWidget(parent)
{
d = new SetupIdentityPriv;
TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint() );
// --------------------------------------------------------
// IPTC only accept printable Ascii char.
TQRegExp asciiRx("[\x20-\x7F]+$");
TQValidator *asciiValidator = new TQRegExpValidator(asciiRx, this);
TQGroupBox *photographerIdGroup = new TQGroupBox(0, TQt::Horizontal, i18n("Photographer and Copyright Information"), parent);
TQGridLayout* grid = new TQGridLayout( photographerIdGroup->layout(), 1, 1, KDialog::spacingHint());
TQLabel *label1 = new TQLabel(i18n("Author:"), photographerIdGroup);
d->authorEdit = new KLineEdit(photographerIdGroup);
d->authorEdit->setValidator(asciiValidator);
d->authorEdit->setMaxLength(32);
label1->setBuddy(d->authorEdit);
grid->addMultiCellWidget(label1, 0, 0, 0, 0);
grid->addMultiCellWidget(d->authorEdit, 0, 0, 1, 1);
TQWhatsThis::add( d->authorEdit, i18n("<p>This field should contain your name, or the name of the person who created the photograph. "
"If it is not appropriate to add the name of the photographer (for example, if the identify of "
"the photographer needs to be protected) the name of a company or organization can also be used. "
"Once saved, this field should not be changed by anyone. This field does not support the use of "
"commas or semi-colons as separator. \nThis field is limited to 32 ASCII characters.</p>"));
TQLabel *label2 = new TQLabel(i18n("Author Title:"), photographerIdGroup);
d->authorTitleEdit = new KLineEdit(photographerIdGroup);
d->authorTitleEdit->setValidator(asciiValidator);
d->authorTitleEdit->setMaxLength(32);
label2->setBuddy(d->authorTitleEdit);
grid->addMultiCellWidget(label2, 1, 1, 0, 0);
grid->addMultiCellWidget(d->authorTitleEdit, 1, 1, 1, 1);
TQWhatsThis::add( d->authorTitleEdit, i18n("<p>This field should contain the job title of the photographer. Examples might include "
"titles such as: Staff Photographer, Freelance Photographer, or Independent Commercial "
"Photographer. Since this is a qualifier for the Author field, the Author field must also "
"be filled out. \nThis field is limited to 32 ASCII characters.</p>"));
// --------------------------------------------------------
TQGroupBox *creditsGroup = new TQGroupBox(0, TQt::Horizontal, i18n("Credit and Copyright"), parent);
TQGridLayout* grid2 = new TQGridLayout( creditsGroup->layout(), 2, 1, KDialog::spacingHint());
TQLabel *label3 = new TQLabel(i18n("Credit:"), creditsGroup);
d->creditEdit = new KLineEdit(creditsGroup);
d->creditEdit->setValidator(asciiValidator);
d->creditEdit->setMaxLength(32);
label3->setBuddy(d->creditEdit);
grid2->addMultiCellWidget(label3, 0, 0, 0, 0);
grid2->addMultiCellWidget(d->creditEdit, 0, 0, 1, 1);
TQWhatsThis::add( d->creditEdit, i18n("<p>(synonymous to Provider): Use the Provider field to identify who is providing the photograph. "
"This does not necessarily have to be the author. If a photographer is working for a news agency "
"such as Reuters or the Associated Press, these organizations could be listed here as they are "
"\"providing\" the image for use by others. If the image is a stock photograph, then the group "
"(agency) involved in supplying the image should be listed here. "
"\nThis field is limited to 32 ASCII characters.</p>"));
TQLabel *label4 = new TQLabel(i18n("Source:"), creditsGroup);
d->sourceEdit = new KLineEdit(creditsGroup);
d->sourceEdit->setValidator(asciiValidator);
d->sourceEdit->setMaxLength(32);
label4->setBuddy(d->sourceEdit);
grid2->addMultiCellWidget(label4, 1, 1, 0, 0);
grid2->addMultiCellWidget(d->sourceEdit, 1, 1, 1, 1);
TQWhatsThis::add( d->sourceEdit, i18n("<p>The Source field should be used to identify the original owner or copyright holder of the "
"photograph. The value of this field should never be changed after the information is entered "
"following the image's creation. While not yet enforced by the custom panels, you should consider "
"this to be a \"write-once\" field. The source could be an individual, an agency, or a "
"member of an agency. To aid in later searches, it is suggested to separate any slashes "
"\"/\" with a blank space. Use the form \"photographer / agency\" rather than "
"\"photographer/agency.\" Source may also be different from Creator and from the names "
"listed in the Copyright Notice.\nThis field is limited to 32 ASCII characters.</p>"));
TQLabel *label5 = new TQLabel(i18n("Copyright:"), creditsGroup);
d->copyrightEdit = new KLineEdit(creditsGroup);
d->copyrightEdit->setValidator(asciiValidator);
d->copyrightEdit->setMaxLength(128);
label5->setBuddy(d->copyrightEdit);
grid2->addMultiCellWidget(label5, 2, 2, 0, 0);
grid2->addMultiCellWidget(d->copyrightEdit, 2, 2, 1, 1);
TQWhatsThis::add( d->copyrightEdit, i18n("<p>The Copyright Notice should contain any necessary copyright notice for claiming the intellectual "
"property, and should identify the current owner(s) of the copyright for the photograph. Usually, "
"this would be the photographer, but if the image was done by an employee or as work-for-hire, "
"then the agency or company should be listed. Use the form appropriate to your country. USA: "
"© {date of first publication} name of copyright owner, as in \"©2005 John Doe.\" "
"Note, the word \"copyright\" or the abbreviation \"copr\" may be used in place of the © symbol. "
"In some foreign countries only the copyright symbol is recognized and the abbreviation does not work. "
"Furthermore the copyright symbol must be a full circle with a \"c\" inside; using something like (c) "
"where the parentheses form a partial circle is not sufficient. For additional protection worldwide, "
"use of the phrase, \"all rights reserved\" following the notice above is encouraged. \nIn Europe "
"you would use: Copyright {Year} {Copyright owner}, all rights reserved. \nIn Japan, for maximum "
"protection, the following three items should appear in the copyright field of the IPTC Core: "
"(a) the word, Copyright; (b) year of the first publication; and (c) name of the author. "
"You may also wish to include the phrase \"all rights reserved.\"\n"
"This field is limited to 128 ASCII characters.</p>"));
// --------------------------------------------------------
KActiveLabel *note = new KActiveLabel(i18n("<b>Note: These informations are used to set "
"<b><a href='http://en.wikipedia.org/wiki/IPTC'>IPTC</a></b> tags contents. "
"IPTC text tags only support the printable "
"<b><a href='http://en.wikipedia.org/wiki/Ascii'>ASCII</a></b> "
"characters set and limit strings size. "
"Use contextual help for details.</b>"), parent);
// --------------------------------------------------------
layout->addWidget(photographerIdGroup);
layout->addWidget(creditsGroup);
layout->addWidget(note);
layout->addStretch();
readSettings();
}
SetupIdentity::~SetupIdentity()
{
delete d;
}
void SetupIdentity::applySettings()
{
AlbumSettings* settings = AlbumSettings::instance();
if (!settings) return;
settings->setIptcAuthor(d->authorEdit->text());
settings->setIptcAuthorTitle(d->authorTitleEdit->text());
settings->setIptcCredit(d->creditEdit->text());
settings->setIptcSource(d->sourceEdit->text());
settings->setIptcCopyright(d->copyrightEdit->text());
settings->saveSettings();
}
void SetupIdentity::readSettings()
{
AlbumSettings* settings = AlbumSettings::instance();
if (!settings) return;
d->authorEdit->setText(settings->getIptcAuthor());
d->authorTitleEdit->setText(settings->getIptcAuthorTitle());
d->creditEdit->setText(settings->getIptcCredit());
d->sourceEdit->setText(settings->getIptcSource());
d->copyrightEdit->setText(settings->getIptcCopyright());
}
} // namespace Digikam
|