1
/* ============================================================
3
* This file is a part of kipi-plugins project
4
* http://www.digikam.org
7
* Description : Integration of the Photivo RAW-Processor.
9
* Copyright (C) 2012 by Dominic Lyons <domlyons at googlemail 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) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* ============================================================ */
31
namespace KIPIPhotivoIntegrationPlugin
34
// public /////////////////////////////////////////////////////////////////////
36
void XmpMM::load(const KPMetadata& meta)
38
// Check if XMP is available at all
41
KExiv2::MetaDataMap mmMap = meta.getXmpTagsDataList(QStringList("xmpMM"));
42
kDebug() << "mmMap.size():" << mmMap.size();
46
//TODO: loadDerivedFrom()
50
// ----------------------------------------------------------------------------
52
QString XmpMM::pureID (const QString& id) const
54
int split = id.lastIndexOf (':');
56
if (split < 0) //no ':' found => no prefix
59
else //split prefix and id after last ':'
60
return id.mid(split + 1);
63
// private ////////////////////////////////////////////////////////////////////
65
void XmpMM::loadHistory(const KExiv2::MetaDataMap& mmMap)
67
// KPMetadata/KExiv2 can't tell how many elements an array has,
68
// so we try to access the next element in a loop until we fail.
70
while (mmMap.contains(QString("Xmp.xmpMM.History[%1]").arg(++i)))
73
QString node = QString("Xmp.xmpMM.History[%1]/stEvt:").arg(i);
75
// Missing key/value pairs will result as an empty string
76
hist.action = mmMap[node + "action"];
77
hist.instanceID = mmMap[node + "instanceID"];
78
hist.when = mmMap[node + "when"];
79
history.push_back(hist);
81
kDebug() << "history.size():" << history.size();
84
// ----------------------------------------------------------------------------
86
void XmpMM::loadIDs(const KExiv2::MetaDataMap& mmMap)
88
// Missing key/value pairs will result as an empty string
89
documentID = mmMap["Xmp.xmpMM.DocumentID"];
90
instanceID = mmMap["Xmp.xmpMM.InstanceID"];
91
originalDocumentID = mmMap["Xmp.xmpMM.OriginalDocumentID"];
94
} // namespace KIPIPhotivoIntegrationPlugin