1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : a widget to display Standard Exif metadata
9
* Copyright (C) 2006-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
11
* This program is free software; you can redistribute it
12
* and/or modify it under the terms of the GNU General
13
* Public License as published by the Free Software Foundation;
14
* either version 2, or (at your option)
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* ============================================================ */
24
#include "exifwidget.moc"
38
#include "dmetadata.h"
39
#include "metadatalistview.h"
44
// Standard Exif Entry list from to less important to the most important for photograph.
45
static const char* StandardExifEntryList[] =
57
ExifWidget::ExifWidget(QWidget* parent, const char* name)
58
: MetadataWidget(parent, name)
60
view()->setSortingEnabled(false);
62
for (int i=0 ; QString(StandardExifEntryList[i]) != QString("-1") ; ++i)
64
m_keysFilter << StandardExifEntryList[i];
68
ExifWidget::~ExifWidget()
72
QString ExifWidget::getMetadataTitle()
74
return i18n("Standard EXIF Tags");
77
bool ExifWidget::loadFromURL(const KUrl& url)
79
setFileName(url.toLocalFile());
88
DMetadata metadata(url.toLocalFile());
90
if (!metadata.hasExif())
97
setMetadata(metadata);
104
bool ExifWidget::decodeMetadata()
106
DMetadata data = getMetadata();
113
// Update all metadata contents.
114
setMetadataMap(data.getExifTagsDataList(m_keysFilter));
118
void ExifWidget::buildView()
120
if (getMode() == CUSTOM)
122
setIfdList(getMetadataMap(), m_keysFilter, getTagsFilter());
126
setIfdList(getMetadataMap(), m_keysFilter, QStringList() << QString("FULL"));
129
MetadataWidget::buildView();
132
QString ExifWidget::getTagTitle(const QString& key)
134
DMetadata metadataIface;
135
QString title = metadataIface.getExifTagTitle(key.toAscii());
139
return key.section('.', -1);
145
QString ExifWidget::getTagDescription(const QString& key)
147
DMetadata metadataIface;
148
QString desc = metadataIface.getExifTagDescription(key.toAscii());
152
return i18n("No description available");
158
void ExifWidget::slotSaveMetadataToFile()
160
KUrl url = saveMetadataToFile(i18n("EXIF File to Save"),
161
QString("*.exif|"+i18n("EXIF binary Files (*.exif)")));
163
#if KEXIV2_VERSION >= 0x010000
164
storeMetadataToFile(url, getMetadata().getExifEncoded());
166
storeMetadataToFile(url, getMetadata().getExif());
170
} // namespace Digikam