[Digikam-devel] [Bug 220545] Cannot write XMP sidecar files
Gilles Caulier
caulier.gilles at gmail.com
Tue Aug 31 13:50:20 BST 2010
https://bugs.kde.org/show_bug.cgi?id=220545
--- Comment #64 from Gilles Caulier <caulier gilles gmail com> 2010-08-31 14:50:18 ---
SVN commit 1170286 by cgilles:
use new API from libkexiv2 from trunk to deal with XMP sidecar
M +3 -2 digikam/metadatahub.cpp
M +1 -1 digikam/metadatahub.h
M +2 -1 digikam/metadatamanager.cpp
M +13 -3 libs/dmetadata/metadatasettingscontainer.cpp
M +3 -1 libs/dmetadata/metadatasettingscontainer.h
M +6 -2 utilities/kipiiface/kipiinterface.cpp
M +29 -19 utilities/setup/setupmetadata.cpp
--- branches/extragear/graphics/digikam/digikam/metadatahub.cpp
#1170285:1170286
@@ -203,9 +203,10 @@
}
}
-bool MetadataHub::load(const QString& filePath)
+bool MetadataHub::load(const QString& filePath, const
MetadataSettingsContainer& settings)
{
DMetadata metadata;
+ metadata.setUseXMPSidecar4Reading(settings.useXMPSidecar4Reading);
bool success = metadata.load(filePath);
load(metadata); // increments count
return success;
@@ -453,7 +454,7 @@
bool dirty = false;
metadata.setWriteRawFiles(settings.writeRawFiles);
- metadata.setUseXMPSidecar(settings.useXMPSidecar);
+ metadata.setMetadataWritingMode(settings.metadataWritingMode);
#if KEXIV2_VERSION >= 0x000600
metadata.setUpdateFileTimeStamp(settings.updateFileTimeStamp);
--- branches/extragear/graphics/digikam/digikam/metadatahub.h #1170285:1170286
@@ -142,7 +142,7 @@
(Uses DMetadata, QFileInfo)
@returns True if the metadata could be loaded
*/
- bool load(const QString& filePath);
+ bool load(const QString& filePath, const MetadataSettingsContainer&
settings = MetadataSettingsContainer());
// --------------------------------------------------
--- branches/extragear/graphics/digikam/digikam/metadatamanager.cpp
#1170285:1170286
@@ -474,7 +474,8 @@
DMetadata::ImageOrientation o =
(DMetadata::ImageOrientation)orientation;
metadata.setImageOrientation(o);
metadata.setWriteRawFiles(MetadataSettings::instance()->settings().writeRawFiles);
-
metadata.setUseXMPSidecar(MetadataSettings::instance()->settings().useXMPSidecar);
+
metadata.setUseXMPSidecar4Reading(MetadataSettings::instance()->settings().useXMPSidecar4Reading);
+
metadata.setMetadataWritingMode(MetadataSettings::instance()->settings().metadataWritingMode);
if (!metadata.applyChanges())
{
---
branches/extragear/graphics/digikam/libs/dmetadata/metadatasettingscontainer.cpp
#1170285:1170286
@@ -27,10 +27,17 @@
#include <kconfiggroup.h>
+
+// LibKExiv2 includes
+
+#include <libkexiv2/kexiv2.h>
+
// Local includes
#include "metadatasettings.h"
+using namespace KExiv2Iface;
+
namespace Digikam
{
@@ -44,7 +51,8 @@
saveTemplate = false;
saveTags = false;
writeRawFiles = false;
- useXMPSidecar = false;
+ useXMPSidecar4Reading = false;
+ metadataWritingMode = KExiv2::WRITETOIMAGEONLY;
updateFileTimeStamp = false;
}
@@ -61,7 +69,8 @@
saveRating = group.readEntry("Save Rating", false);
writeRawFiles = group.readEntry("Write RAW Files", false);
- useXMPSidecar = group.readEntry("Use XMP Sidecar", false);
+ useXMPSidecar4Reading = group.readEntry("Use XMP Sidecar For Reading",
false);
+ metadataWritingMode = group.readEntry("Metadata Writing Mode",
(int)KExiv2::WRITETOIMAGEONLY);
updateFileTimeStamp = group.readEntry("Update File Timestamp", false);
}
@@ -78,7 +87,8 @@
group.writeEntry("Save Rating", saveRating);
group.writeEntry("Write RAW Files", writeRawFiles);
- group.writeEntry("Use XMP Sidecar", useXMPSidecar);
+ group.writeEntry("Use XMP Sidecar For Reading", useXMPSidecar4Reading);
+ group.writeEntry("Metadata Writing Mode", metadataWritingMode);
group.writeEntry("Update File Timestamp", updateFileTimeStamp);
}
---
branches/extragear/graphics/digikam/libs/dmetadata/metadatasettingscontainer.h
#1170285:1170286
@@ -66,8 +66,10 @@
bool saveTags;
bool writeRawFiles;
- bool useXMPSidecar;
bool updateFileTimeStamp;
+ bool useXMPSidecar4Reading;
+
+ int metadataWritingMode;
};
} // namespace Digikam
--- branches/extragear/graphics/digikam/utilities/kipiiface/kipiinterface.cpp
#1170285:1170286
@@ -303,10 +303,14 @@
{
return (set.writeRawFiles);
}
- else if (settingName == QString("UseXMPSidecar"))
+ else if (settingName == QString("UseXMPSidecar4Reading"))
{
- return (set.useXMPSidecar);
+ return (set.useXMPSidecar4Reading);
}
+ else if (settingName == QString("MetadataWritingMode"))
+ {
+ return (set.metadataWritingMode);
+ }
else if (settingName == QString("FileExtensions"))
{
// do not save this into a local variable, as this
--- branches/extragear/graphics/digikam/utilities/setup/setupmetadata.cpp
#1170285:1170286
@@ -48,6 +48,8 @@
#include <ktoolinvocation.h>
#include <kurllabel.h>
#include <kvbox.h>
+#include <khbox.h>
+#include <kcombobox.h>
// LibKExiv2 includes
@@ -61,6 +63,8 @@
#include "metadatapanel.h"
#include "metadatasettings.h"
+using namespace KExiv2Iface;
+
namespace Digikam
{
@@ -86,6 +90,7 @@
resyncButton = 0;
tagsCfgPanel = 0;
tab = 0;
+ writingModeCombo = 0;
}
bool exifAutoRotateAsChanged;
@@ -106,6 +111,7 @@
QCheckBox* readFromNepomukBox;
QToolButton* resyncButton;
+ KComboBox* writingModeCombo;
KTabWidget* tab;
MetadataPanel* tagsCfgPanel;
@@ -174,35 +180,37 @@
d->writeRawFilesBox->setWhatsThis( i18n("Turn on this option to write
metadata into RAW TIFF/EP files. "
"This feature requires the Exiv2
shared library, version >= 0.18.0. It is still "
"experimental, and is disabled by
default."));
-
d->writeRawFilesBox->setEnabled(KExiv2Iface::KExiv2::supportMetadataWritting("image/x-raw"));
+
d->writeRawFilesBox->setEnabled(KExiv2::supportMetadataWritting("image/x-raw"));
- d->useXMPSidecarBox = new QCheckBox(commonGroup);
- d->useXMPSidecarBox->setText(i18n("&Read metadata from and write metadata
to XMP sidecar files"));
- d->useXMPSidecarBox->setWhatsThis( i18n("Turn on this option to write
metadata into XMP sidecar files, "
- "and prefer metadata from XMP
sidecar files when reading metadata."
- "This feature requires the Exiv2
shared library, version >= 0.18.0. It is still "
- "experimental, and is disabled by
default."));
- // TODO: Should perhaps do some testing for XMP sidecar support in
libkexiv2
- //
d->useXMPSidecarBox->setEnabled(KExiv2Iface::KExiv2::supportXMPSidecar());
-
d->updateFileTimeStampBox = new QCheckBox(commonGroup);
d->updateFileTimeStampBox->setText(i18n("&Update file timestamp when
metadata are saved"));
d->updateFileTimeStampBox->setWhatsThis( i18n("Turn on this option to
update file timestamps when metadata are saved."));
-#if KEXIV2_VERSION >= 0x000600
- d->updateFileTimeStampBox->show();
-#else
- d->updateFileTimeStampBox->hide();
-#endif
+ d->useXMPSidecarBox = new QCheckBox(commonGroup);
+ d->useXMPSidecarBox->setText(i18n("&Read metadata from XMP sidecar
files"));
+ d->useXMPSidecarBox->setWhatsThis( i18n("Turn on this option to prefer
metadata from XMP sidecar files when reading metadata."));
+ d->useXMPSidecarBox->setEnabled(KExiv2::supportXmp());
+ KHBox* hbox = new KHBox(commonGroup);
+ QLabel* writingModeLabel = new QLabel(i18n("Metadata Writting Mode:"),
hbox);
+ writingModeLabel->setEnabled(KExiv2::supportXmp());
+ d->writingModeCombo = new KComboBox(hbox);
+ d->writingModeCombo->addItem(i18n("Write to image only"),
KExiv2::WRITETOIMAGEONLY);
+ d->writingModeCombo->addItem(i18n("Write to XMP sidecar only"),
KExiv2::WRITETOSIDECARONLY);
+ d->writingModeCombo->addItem(i18n("Write to image and XMP Sidecar"),
KExiv2::WRITETOSIDECARANDIMAGE);
+ d->writingModeCombo->addItem(i18n("Write to XMP sidecar for read-only
image only"), KExiv2::WRITETOSIDECARONLY4READONLYFILES);
+ d->writingModeCombo->setToolTip(i18n("Choose there how to write
metadata."));
+ d->writingModeCombo->setEnabled(KExiv2::supportXmp());
+
gLayout2->addWidget(d->saveTagsBox);
gLayout2->addWidget(d->saveTemplateBox);
gLayout2->addWidget(d->saveCommentsBox);
gLayout2->addWidget(d->saveDateTimeBox);
gLayout2->addWidget(d->saveRatingBox);
+ gLayout2->addWidget(d->updateFileTimeStampBox);
gLayout2->addWidget(d->writeRawFilesBox);
gLayout2->addWidget(d->useXMPSidecarBox);
- gLayout2->addWidget(d->updateFileTimeStampBox);
+ gLayout2->addWidget(hbox);
gLayout2->setMargin(KDialog::spacingHint());
gLayout2->setSpacing(0);
@@ -231,7 +239,7 @@
"an older standard used in digital photography to store "
"photographer information in images.</p>"));
- if (KExiv2Iface::KExiv2::supportXmp())
+ if (KExiv2::supportXmp())
txt.append(i18n("<p><a
href='http://en.wikipedia.org/wiki/Extensible_Metadata_Platform'>XMP</a> - "
"a new standard used in digital photography, designed
to replace IPTC.</p>"));
@@ -387,7 +395,8 @@
set.saveTags = d->saveTagsBox->isChecked();
set.saveTemplate = d->saveTemplateBox->isChecked();
set.writeRawFiles = d->writeRawFilesBox->isChecked();
- set.useXMPSidecar = d->useXMPSidecarBox->isChecked();
+ set.useXMPSidecar4Reading = d->useXMPSidecarBox->isChecked();
+ set.metadataWritingMode = d->writingModeCombo->currentIndex();
set.updateFileTimeStamp = d->updateFileTimeStampBox->isChecked();
mSettings->setSettings(set);
@@ -421,7 +430,8 @@
d->saveTagsBox->setChecked(set.saveTags);
d->saveTemplateBox->setChecked(set.saveTemplate);
d->writeRawFilesBox->setChecked(set.writeRawFiles);
- d->useXMPSidecarBox->setChecked(set.useXMPSidecar);
+ d->useXMPSidecarBox->setChecked(set.useXMPSidecar4Reading);
+ d->writingModeCombo->setCurrentIndex(set.metadataWritingMode);
d->updateFileTimeStampBox->setChecked(set.updateFileTimeStamp);
#ifdef HAVE_NEPOMUK
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Digikam-devel
mailing list