summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Caulier <[email protected]>2015-09-25 00:47:25 +0200
committerGilles Caulier <[email protected]>2015-09-25 00:47:25 +0200
commit708ae1d5e4abb122a0e0af4a368bf60e0d442f5d (patch)
tree8ec47ae409a88b92ffbbbe3f74e501d6ac525ce6
parentb80b1a3badaacb95b886aa66b34fba91ca1ac8a5 (diff)
backport commit #eb371412c6f05802a8f8af0ae9a77676b8f5605a from git/master to frameworks branch
-rw-r--r--src/kexiv2.cpp2
-rw-r--r--src/kexiv2_p.cpp48
-rw-r--r--src/kexiv2xmp.cpp57
3 files changed, 57 insertions, 50 deletions
diff --git a/src/kexiv2.cpp b/src/kexiv2.cpp
index 69247eb..15a7f1f 100644
--- a/src/kexiv2.cpp
+++ b/src/kexiv2.cpp
@@ -381,7 +381,7 @@ bool KExiv2::save(const QString& imageFilePath) const
if (givenFileInfo.isSymLink())
{
qCDebug(LIBKEXIV2_LOG) << "filePath" << imageFilePath << "is a symlink."
- << "Using target" << givenFileInfo.canonicalPath();
+ << "Using target" << givenFileInfo.canonicalPath();
regularFilePath = givenFileInfo.canonicalPath();// Walk all the symlinks
}
diff --git a/src/kexiv2_p.cpp b/src/kexiv2_p.cpp
index 7191463..6542d06 100644
--- a/src/kexiv2_p.cpp
+++ b/src/kexiv2_p.cpp
@@ -371,7 +371,7 @@ void KExiv2::Private::printExiv2ExceptionError(const QString& msg, Exiv2::Error&
{
std::string s(e.what());
qCCritical(LIBKEXIV2_LOG) << msg.toLatin1().constData() << " (Error #"
- << e.code() << ": " << s.c_str();
+ << e.code() << ": " << s.c_str();
}
void KExiv2::Private::printExiv2MessageHandler(int lvl, const char* msg)
@@ -460,7 +460,6 @@ QString KExiv2::Private::detectEncodingAndDecode(const std::string& value) const
return QString::fromLocal8Bit(value.c_str());
}
-
bool KExiv2::Private::isUtf8(const char* const buffer) const
{
int i, n;
@@ -582,24 +581,45 @@ done:
int KExiv2::Private::getXMPTagsListFromPrefix(const QString& pf, KExiv2::TagsMap& tagsMap) const
{
- QList<const Exiv2::XmpPropertyInfo*> tags;
- tags << Exiv2::XmpProperties::propertyList(pf.toLatin1().data());
int i = 0;
- for (QList<const Exiv2::XmpPropertyInfo*>::iterator it = tags.begin(); it != tags.end(); ++it)
+#ifdef _XMP_SUPPORT_
+
+ try
{
- while ( (*it) && !QString::fromLatin1((*it)->name_).isNull() )
+ QList<const Exiv2::XmpPropertyInfo*> tags;
+ tags << Exiv2::XmpProperties::propertyList(pf.toLatin1().data());
+
+ for (QList<const Exiv2::XmpPropertyInfo*>::iterator it = tags.begin(); it != tags.end(); ++it)
{
- QString key = QLatin1String( Exiv2::XmpKey( pf.toLatin1().data(), (*it)->name_ ).key().c_str() );
- QStringList values;
- values << QString::fromLatin1((*it)->name_)
- << QString::fromLatin1((*it)->title_)
- << QString::fromLatin1((*it)->desc_);
- tagsMap.insert(key, values);
- ++(*it);
- i++;
+ while ( (*it) && !QString::fromLatin1((*it)->name_).isNull() )
+ {
+ QString key = QLatin1String( Exiv2::XmpKey( pf.toLatin1().data(), (*it)->name_ ).key().c_str() );
+ QStringList values;
+ values << QString::fromLatin1((*it)->name_)
+ << QString::fromLatin1((*it)->title_)
+ << QString::fromLatin1((*it)->desc_);
+ tagsMap.insert(key, values);
+ ++(*it);
+ i++;
+ }
}
}
+ catch( Exiv2::Error& e )
+ {
+ printExiv2ExceptionError(QString::fromLatin1("Cannot get Xmp tags list using Exiv2 "), e);
+ }
+ catch(...)
+ {
+ qCCritical(LIBKEXIV2_LOG) << "Default exception from Exiv2";
+ }
+
+#else
+
+ Q_UNUSED(pf);
+ Q_UNUSED(tagsMap);
+
+#endif // _XMP_SUPPORT_
return i;
}
diff --git a/src/kexiv2xmp.cpp b/src/kexiv2xmp.cpp
index f4db280..52c01ad 100644
--- a/src/kexiv2xmp.cpp
+++ b/src/kexiv2xmp.cpp
@@ -1200,41 +1200,28 @@ bool KExiv2::removeXmpSubjects(const QStringList& subjectsToRemove, bool setProg
KExiv2::TagsMap KExiv2::getXmpTagsList() const
{
- try
- {
- TagsMap tagsMap;
- d->getXMPTagsListFromPrefix(QString::fromLatin1("dc"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("digiKam"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("xmp"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpRights"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpMM"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpBJ"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpTPg"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpDM"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("MicrosoftPhoto"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("pdf"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("photoshop"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("crs"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("tiff"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("exif"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("aux"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("iptc"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("iptcExt"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("plus"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("mwg-rs"), tagsMap);
- d->getXMPTagsListFromPrefix(QString::fromLatin1("dwc"), tagsMap);
- return tagsMap;
- }
- catch( Exiv2::Error& e )
- {
- d->printExiv2ExceptionError(QString::fromLatin1("Cannot get Xmp Tags list using Exiv2 "), e);
- }
- catch(...)
- {
- qCCritical(LIBKEXIV2_LOG) << "Default exception from Exiv2";
- }
-
- return TagsMap();
+ TagsMap tagsMap;
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("dc"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("digiKam"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("xmp"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpRights"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpMM"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpBJ"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpTPg"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("xmpDM"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("MicrosoftPhoto"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("pdf"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("photoshop"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("crs"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("tiff"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("exif"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("aux"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("iptc"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("iptcExt"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("plus"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("mwg-rs"), tagsMap);
+ d->getXMPTagsListFromPrefix(QString::fromLatin1("dwc"), tagsMap);
+ return tagsMap;
}
} // NameSpace KExiv2Iface