[Kde-imaging] extragear/libs/kipi-plugins/metadataedit
Gilles Caulier
caulier.gilles at free.fr
Fri Oct 13 09:20:02 CEST 2006
SVN commit 595026 by cgilles:
kipiplugins from trunk : MetadataEdit plugin:
"Et Voila"... The IPTC metadata can be changed/set from pictures. The IPTC data set to edit is not yet complete, but a more complete edit dialog coming soon...
CCMAIL: digikam-devel at kde.org, kde-imaging at kde.org
CCBUGS: 91812, 133276, 103255
M +17 -4 iptccaption.cpp
M +18 -2 iptccredits.cpp
M +1 -1 iptceditdialog.cpp
M +5 -5 metadataeditdialog.cpp
M +16 -7 metadataitem.cpp
--- trunk/extragear/libs/kipi-plugins/metadataedit/iptccaption.cpp #595025:595026
@@ -36,6 +36,7 @@
// Local includes.
+#include "exiv2iface.h"
#include "iptccaption.h"
#include "iptccaption.moc"
@@ -127,8 +128,7 @@
vlay->addStretch();
// --------------------------------------------------------
-
-
+
readMetadata(iptcData);
}
@@ -137,12 +137,25 @@
delete d;
}
-void IPTCCaption::applyMetadata(QByteArray& iptcData)
+void IPTCCaption::readMetadata(QByteArray& iptcData)
{
+ KIPIPlugins::Exiv2Iface exiv2Iface;
+ exiv2Iface.setIptc(iptcData);
+ d->captionEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Caption", false));
+ d->writerEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Writer", false));
+ d->headlineEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Headline", false));
+ d->specialInstructionEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.SpecialInstructions", false));
}
-void IPTCCaption::readMetadata(QByteArray& iptcData)
+void IPTCCaption::applyMetadata(QByteArray& iptcData)
{
+ KIPIPlugins::Exiv2Iface exiv2Iface;
+ exiv2Iface.setIptc(iptcData);
+ exiv2Iface.setIptcTagString("Iptc.Application2.Caption", d->captionEdit->text());
+ exiv2Iface.setIptcTagString("Iptc.Application2.Writer", d->writerEdit->text());
+ exiv2Iface.setIptcTagString("Iptc.Application2.Headline", d->headlineEdit->text());
+ exiv2Iface.setIptcTagString("Iptc.Application2.SpecialInstructions", d->specialInstructionEdit->text());
+ iptcData = exiv2Iface.getIptc();
}
} // namespace KIPIMetadataEditPlugin
--- trunk/extragear/libs/kipi-plugins/metadataedit/iptccredits.cpp #595025:595026
@@ -35,6 +35,7 @@
// Local includes.
+#include "exiv2iface.h"
#include "iptccredits.h"
#include "iptccredits.moc"
@@ -148,12 +149,27 @@
delete d;
}
-void IPTCCredits::applyMetadata(QByteArray& iptcData)
+void IPTCCredits::readMetadata(QByteArray& iptcData)
{
+ KIPIPlugins::Exiv2Iface exiv2Iface;
+ exiv2Iface.setIptc(iptcData);
+ d->copyrightEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Copyright", false));
+ d->bylineEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Byline", false));
+ d->bylineTitleEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.BylineTitle", false));
+ d->creditEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Credit", false));
+ d->sourceEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Source", false));
}
-void IPTCCredits::readMetadata(QByteArray& iptcData)
+void IPTCCredits::applyMetadata(QByteArray& iptcData)
{
+ KIPIPlugins::Exiv2Iface exiv2Iface;
+ exiv2Iface.setIptc(iptcData);
+ exiv2Iface.setIptcTagString("Iptc.Application2.Copyright", d->copyrightEdit->text());
+ exiv2Iface.setIptcTagString("Iptc.Application2.Byline", d->bylineEdit->text());
+ exiv2Iface.setIptcTagString("Iptc.Application2.BylineTitle", d->bylineTitleEdit->text());
+ exiv2Iface.setIptcTagString("Iptc.Application2.Credit", d->creditEdit->text());
+ exiv2Iface.setIptcTagString("Iptc.Application2.Source", d->sourceEdit->text());
+ iptcData = exiv2Iface.getIptc();
}
} // namespace KIPIMetadataEditPlugin
--- trunk/extragear/libs/kipi-plugins/metadataedit/iptceditdialog.cpp #595025:595026
@@ -128,7 +128,7 @@
QByteArray IPTCEditDialog::getIPTCInfo()
{
- return QByteArray();
+ return d->iptcData;
}
void IPTCEditDialog::slotOk()
--- trunk/extragear/libs/kipi-plugins/metadataedit/metadataeditdialog.cpp #595025:595026
@@ -382,24 +382,24 @@
void MetadataEditDialog::slotApply()
{
-/* KURL::List images;
+ KURL::List images;
QListViewItemIterator it( d->listView );
while ( it.current() )
{
- GPSListViewItem *item = (GPSListViewItem*) it.current();
+ MetadataItem *item = (MetadataItem*)it.current();
d->listView->setSelected(item, true);
d->listView->ensureItemVisible(item);
- item->writeGPSInfoToFile();
+ item->writeMetadataToFile();
images.append(item->getUrl());
- // TODO : new libkipi method to store GPS info in host database.
+ // TODO : add libkipi method call to please the host to re-read metadata from pictures.
++it;
kapp->processEvents();
}
- d->interface->refreshImages(images);*/
+ d->interface->refreshImages(images);
}
} // NameSpace KIPIMetadataEditPlugin
--- trunk/extragear/libs/kipi-plugins/metadataedit/metadataitem.cpp #595025:595026
@@ -173,25 +173,34 @@
{
if (isEnabled() && isDirty())
{
-/* setPixmap(1, SmallIcon("run"));
+ setPixmap(1, SmallIcon("run"));
KIPIPlugins::Exiv2Iface exiv2Iface;
bool ret = exiv2Iface.load(d->url.path());
- if (d->erase)
- ret &= exiv2Iface.removeGPSInfo();
+ if (d->eraseExif)
+ {
+ // ret &= exiv2Iface.removeExif();
+ }
else
{
- ret &= exiv2Iface.setGPSInfo(d->gpsData.altitude(),
- d->gpsData.latitude(),
- d->gpsData.longitude());
+ ret &= exiv2Iface.setExif(d->exifData);
}
+ if (d->eraseIptc)
+ {
+ // ret &= exiv2Iface.removeIptc();
+ }
+ else
+ {
+ ret &= exiv2Iface.setIptc(d->iptcData);
+ }
+
ret &= exiv2Iface.save(d->url.path());
if (ret)
setPixmap(1, SmallIcon("ok"));
else
- setPixmap(1, SmallIcon("cancel"));*/
+ setPixmap(1, SmallIcon("cancel"));
d->dirty = false;
}
More information about the Kde-imaging
mailing list