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
|
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2004-11-17
* Description : a tab to display metadata information of images
*
* Copyright (C) 2004-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 <tqfile.h>
#include <tqlabel.h>
#include <tqpixmap.h>
#include <tqfileinfo.h>
#include <tqwhatsthis.h>
// KDE includes.
#include <tdelocale.h>
#include <tdeapplication.h>
#include <tdeconfig.h>
#include <kdialogbase.h>
#include <tdefileitem.h>
#include <ktabwidget.h>
// Local includes.
#include "ddebug.h"
#include "dmetadata.h"
#include "exifwidget.h"
#include "makernotewidget.h"
#include "iptcwidget.h"
#include "gpswidget.h"
#include "navigatebarwidget.h"
#include "imagepropertiesmetadatatab.h"
#include "imagepropertiesmetadatatab.moc"
namespace Digikam
{
class ImagePropertiesMetadataTabPriv
{
public:
enum MetadataTab
{
EXIF=0,
MAKERNOTE,
IPTC,
GPS
};
ImagePropertiesMetadataTabPriv()
{
exifWidget = 0;
makernoteWidget = 0;
iptcWidget = 0;
gpsWidget = 0;
tab = 0;
}
KTabWidget *tab;
ExifWidget *exifWidget;
MakerNoteWidget *makernoteWidget;
IptcWidget *iptcWidget;
GPSWidget *gpsWidget;
};
ImagePropertiesMetaDataTab::ImagePropertiesMetaDataTab(TQWidget* parent, bool navBar)
: NavigateBarTab(parent)
{
d = new ImagePropertiesMetadataTabPriv;
setupNavigateBar(navBar);
d->tab = new KTabWidget(this);
m_navigateBarLayout->addWidget(d->tab);
// Exif tab area -----------------------------------------------------
d->exifWidget = new ExifWidget(d->tab);
d->tab->insertTab(d->exifWidget, i18n("EXIF"), ImagePropertiesMetadataTabPriv::EXIF);
// Makernote tab area -----------------------------------------------------
d->makernoteWidget = new MakerNoteWidget(d->tab);
d->tab->insertTab(d->makernoteWidget, i18n("Makernote"), ImagePropertiesMetadataTabPriv::MAKERNOTE);
// IPTC tab area ---------------------------------------
d->iptcWidget = new IptcWidget(d->tab);
d->tab->insertTab(d->iptcWidget, i18n("IPTC"), ImagePropertiesMetadataTabPriv::IPTC);
// GPS tab area ---------------------------------------
d->gpsWidget = new GPSWidget(d->tab);
d->tab->insertTab(d->gpsWidget, i18n("GPS"), ImagePropertiesMetadataTabPriv::GPS);
// -- read config ---------------------------------------------------------
TDEConfig* config = kapp->config();
config->setGroup("Image Properties SideBar");
d->tab->setCurrentPage(config->readNumEntry("ImagePropertiesMetaData Tab",
ImagePropertiesMetadataTabPriv::EXIF));
d->exifWidget->setMode(config->readNumEntry("EXIF Level", ExifWidget::SIMPLE));
d->makernoteWidget->setMode(config->readNumEntry("MAKERNOTE Level", MakerNoteWidget::SIMPLE));
d->iptcWidget->setMode(config->readNumEntry("IPTC Level", IptcWidget::SIMPLE));
d->gpsWidget->setMode(config->readNumEntry("GPS Level", GPSWidget::SIMPLE));
d->exifWidget->setCurrentItemByKey(config->readEntry("Current EXIF Item", TQString()));
d->makernoteWidget->setCurrentItemByKey(config->readEntry("Current MAKERNOTE Item", TQString()));
d->iptcWidget->setCurrentItemByKey(config->readEntry("Current IPTC Item", TQString()));
d->gpsWidget->setCurrentItemByKey(config->readEntry("Current GPS Item", TQString()));
d->gpsWidget->setWebGPSLocator(config->readNumEntry("Current Web GPS Locator", GPSWidget::MapQuest));
}
ImagePropertiesMetaDataTab::~ImagePropertiesMetaDataTab()
{
TDEConfig* config = kapp->config();
config->setGroup("Image Properties SideBar");
config->writeEntry("ImagePropertiesMetaData Tab", d->tab->currentPageIndex());
config->writeEntry("EXIF Level", d->exifWidget->getMode());
config->writeEntry("MAKERNOTE Level", d->makernoteWidget->getMode());
config->writeEntry("IPTC Level", d->iptcWidget->getMode());
config->writeEntry("GPS Level", d->gpsWidget->getMode());
config->writeEntry("Current EXIF Item", d->exifWidget->getCurrentItemKey());
config->writeEntry("Current MAKERNOTE Item", d->makernoteWidget->getCurrentItemKey());
config->writeEntry("Current IPTC Item", d->iptcWidget->getCurrentItemKey());
config->writeEntry("Current GPS Item", d->gpsWidget->getCurrentItemKey());
config->writeEntry("Current Web GPS Locator", d->gpsWidget->getWebGPSLocator());
config->sync();
delete d;
}
void ImagePropertiesMetaDataTab::setCurrentURL(const KURL& url)
{
if (url.isEmpty())
{
d->exifWidget->loadFromURL(url);
d->makernoteWidget->loadFromURL(url);
d->iptcWidget->loadFromURL(url);
d->gpsWidget->loadFromURL(url);
setEnabled(false);
return;
}
setEnabled(true);
DMetadata metadata(url.path());
TQByteArray exifData = metadata.getExif();
TQByteArray iptcData = metadata.getIptc();
d->exifWidget->loadFromData(url.filename(), exifData);
d->makernoteWidget->loadFromData(url.filename(), exifData);
d->iptcWidget->loadFromData(url.filename(), iptcData);
d->gpsWidget->loadFromData(url.filename(), exifData);
}
void ImagePropertiesMetaDataTab::setCurrentData(const TQByteArray& exifData,
const TQByteArray& iptcData,
const TQString& filename)
{
if (exifData.isEmpty() && iptcData.isEmpty())
{
d->exifWidget->loadFromData(filename, exifData);
d->makernoteWidget->loadFromData(filename, exifData);
d->iptcWidget->loadFromData(filename, iptcData);
d->gpsWidget->loadFromData(filename, exifData);
setEnabled(false);
return;
}
setEnabled(true);
d->exifWidget->loadFromData(filename, exifData);
d->makernoteWidget->loadFromData(filename, exifData);
d->iptcWidget->loadFromData(filename, iptcData);
d->gpsWidget->loadFromData(filename, exifData);
}
} // NameSpace Digikam
|