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 | /* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-07-18
* Description : setup Metadata tab.
*
* SPDX-FileCopyrightText: 2009-2025 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* ============================================================ */
#include "showfotosetupmetadata.h"
// Qt includes
#include <QButtonGroup>
#include <QCheckBox>
#include <QFrame>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QVBoxLayout>
#include <QTabWidget>
#include <QApplication>
#include <QStyle>
#include <QStandardPaths>
#include <QFontDatabase>
#include <QTimer>
// KDE includes
#include <klocalizedstring.h>
// Local includes
#include "digikam_globals.h"
#include "metaengine.h"
#include "metadatapanel.h"
#include "metaenginesettings.h"
#include "dactivelabel.h"
#include "exiftoolconfpanel.h"
using namespace Digikam;
namespace ShowFoto
{
class Q_DECL_HIDDEN ShowfotoSetupMetadata::Private
{
public:
Private() = default;
QCheckBox* exifRotateBox = nullptr;
QCheckBox* exifSetOrientationBox = nullptr;
QTabWidget* tab = nullptr;
MetadataPanel* tagsCfgPanel = nullptr;
ExifToolConfPanel* exifToolView = nullptr;
};
ShowfotoSetupMetadata::ShowfotoSetupMetadata(QWidget* const parent)
: QScrollArea(parent),
d (new Private)
{
d->tab = new QTabWidget(viewport());
setWidget(d->tab);
setWidgetResizable(true);
const int spacing = layoutSpacing();
QWidget* const panel = new QWidget(d->tab);
QVBoxLayout* const mainLayout = new QVBoxLayout(panel);
// --------------------------------------------------------
QGroupBox* const rotationAdvGroup = new QGroupBox(panel);
QGridLayout* const rotationAdvLayout = new QGridLayout(rotationAdvGroup);
QLabel* const rotationAdvExpl = new QLabel(i18nc("@label", "Rotate actions"));
QLabel* const rotationAdvIcon = new QLabel;
rotationAdvIcon->setPixmap(QIcon::fromTheme(QLatin1String("configure")).pixmap(32));
d->exifRotateBox = new QCheckBox(rotationAdvGroup);
d->exifRotateBox->setText(i18nc("@option:check", "Show images/thumbnails &rotated according to orientation tag."));
d->exifSetOrientationBox = new QCheckBox(rotationAdvGroup);
d->exifSetOrientationBox->setText(i18nc("@option:check", "Set orientation tag to normal after rotate/flip."));
rotationAdvLayout->addWidget(rotationAdvIcon, 0, 0, 1, 1);
rotationAdvLayout->addWidget(rotationAdvExpl, 0, 1, 1, 1);
rotationAdvLayout->addWidget(d->exifRotateBox, 1, 0, 1, 3);
rotationAdvLayout->addWidget(d->exifSetOrientationBox, 2, 0, 1, 3);
rotationAdvLayout->setColumnStretch(2, 10);
rotationAdvGroup->setLayout(rotationAdvLayout);
// --------------------------------------------------------
QFrame* const box = new QFrame(panel);
QGridLayout* const grid = new QGridLayout(box);
box->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
QLabel* const explanation = new QLabel(box);
explanation->setOpenExternalLinks(true);
explanation->setWordWrap(true);
QString txt;
txt.append(QString::fromUtf8("<p><a href='https://en.wikipedia.org/wiki/Exif'>Exif</a> - %1</p>")
.arg(i18nc("@info", "a standard used by most digital cameras today to store technical "
"information (like aperture and shutter speed) about an image.")));
txt.append(QString::fromUtf8("<p><a href='https://en.wikipedia.org/wiki/IPTC_Information_Interchange_Model'>IPTC</a> - %1</p>")
.arg(i18nc("@info", "an older standard used in digital photography to store "
"photographer information in images.")));
if (Digikam::MetaEngine::supportXmp())
{
txt.append(QString::fromUtf8("<p><a href='https://en.wikipedia.org/wiki/Extensible_Metadata_Platform'>XMP</a> - %1</p>")
.arg(i18nc("@info", "a new standard used in digital photography, designed to replace IPTC.")));
}
explanation->setText(txt);
explanation->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
grid->addWidget(explanation, 0, 0, 1, 1);
grid->setColumnStretch(0, 10);
grid->setRowStretch(0, 10);
grid->setContentsMargins(spacing, spacing, spacing, spacing);
grid->setSpacing(0);
// --------------------------------------------------------
mainLayout->setContentsMargins(QMargins());
mainLayout->setSpacing(spacing);
mainLayout->addWidget(rotationAdvGroup);
mainLayout->addSpacing(spacing);
mainLayout->addWidget(box);
mainLayout->addStretch();
d->tab->insertTab(Behavior, panel, i18nc("@title:tab", "Behavior"));
// --------------------------------------------------------
d->tagsCfgPanel = new MetadataPanel(d->tab);
// --------------------------------------------------------
d->exifToolView = new ExifToolConfPanel(d->tab);
d->tab->insertTab(ExifTool, d->exifToolView, i18nc("@title:tab", "ExifTool"));
// --------------------------------------------------------
readSettings();
QTimer::singleShot(0, d->exifToolView, SLOT(slotStartFoundExifTool()));
}
ShowfotoSetupMetadata::~ShowfotoSetupMetadata()
{
delete d;
}
void ShowfotoSetupMetadata::setActiveTab(MetadataTab tab)
{
d->tab->setCurrentIndex(tab);
}
ShowfotoSetupMetadata::MetadataTab ShowfotoSetupMetadata::activeTab() const
{
return (MetadataTab)d->tab->currentIndex();
}
void ShowfotoSetupMetadata::applySettings()
{
MetaEngineSettings* const mSettings = MetaEngineSettings::instance();
if (!mSettings)
{
return;
}
MetaEngineSettingsContainer set;
set.exifRotate = d->exifRotateBox->isChecked();
set.exifSetOrientation = d->exifSetOrientationBox->isChecked();
set.exifToolPath = d->exifToolView->exifToolDirectory();
mSettings->setSettings(set);
d->tagsCfgPanel->applySettings();
}
void ShowfotoSetupMetadata::readSettings()
{
MetaEngineSettings* const mSettings = MetaEngineSettings::instance();<--- Variable 'mSettings' can be declared as pointer to const
if (!mSettings)
{
return;
}
MetaEngineSettingsContainer set = mSettings->settings();
d->exifRotateBox->setChecked(set.exifRotate);
d->exifSetOrientationBox->setChecked(set.exifSetOrientation);
d->exifToolView->setExifToolDirectory(set.exifToolPath);
}
} // namespace ShowFoto
#include "moc_showfotosetupmetadata.cpp"
|