本文整理汇总了C++中KPMetadata::setXmpTagString方法的典型用法代码示例。如果您正苦于以下问题:C++ KPMetadata::setXmpTagString方法的具体用法?C++ KPMetadata::setXmpTagString怎么用?C++ KPMetadata::setXmpTagString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPMetadata
的用法示例。
在下文中一共展示了KPMetadata::setXmpTagString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyMetadata
void XMPContent::applyMetadata(QByteArray& exifData, QByteArray& xmpData)
{
KPMetadata meta;
meta.setExif(exifData);
meta.setXmp(xmpData);
if (d->headlineCheck->isChecked())
meta.setXmpTagString("Xmp.photoshop.Headline", d->headlineEdit->text());
else
meta.removeXmpTag("Xmp.photoshop.Headline");
KPMetadata::AltLangMap oldAltLangMap, newAltLangMap;
if (d->captionEdit->getValues(oldAltLangMap, newAltLangMap))
{
meta.setXmpTagStringListLangAlt("Xmp.dc.description", newAltLangMap, false);
if (syncEXIFCommentIsChecked())
meta.setExifComment(getXMPCaption());
if (syncJFIFCommentIsChecked())
meta.setComments(getXMPCaption().toUtf8());
}
else if (d->captionEdit->isValid())
meta.removeXmpTag("Xmp.dc.description");
if (d->writerCheck->isChecked())
meta.setXmpTagString("Xmp.photoshop.CaptionWriter", d->writerEdit->text());
else
meta.removeXmpTag("Xmp.photoshop.CaptionWriter");
if (d->copyrightEdit->getValues(oldAltLangMap, newAltLangMap))
meta.setXmpTagStringListLangAlt("Xmp.dc.rights", newAltLangMap, false);
else if (d->copyrightEdit->isValid())
meta.removeXmpTag("Xmp.dc.rights");
#if KEXIV2_VERSION >= 0x010000
exifData = meta.getExifEncoded();
#else
exifData = meta.getExif();
#endif
xmpData = meta.getXmp();
}
示例2: applyMetadata
void XMPOrigin::applyMetadata(QByteArray& exifData, QByteArray& xmpData)
{
KPMetadata meta;
meta.setExif(exifData);
meta.setXmp(xmpData);
if (d->dateCreatedCheck->isChecked())
{
meta.setXmpTagString("Xmp.photoshop.DateCreated",
getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
meta.setXmpTagString("Xmp.xmp.CreateDate",
getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
meta.setXmpTagString("Xmp.exif.DateTimeCreated",
getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
meta.setXmpTagString("Xmp.exif.DateTimeOriginal",
getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
meta.setXmpTagString("Xmp.tiff.DateTime",
getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
meta.setXmpTagString("Xmp.xmp.ModifyDate",
getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
meta.setXmpTagString("Xmp.xmp.MetadataDate",
getXMPCreationDate().toString("yyyy:MM:dd hh:mm:ss"));
if (syncEXIFDateIsChecked())
{
meta.setExifTagString("Exif.Image.DateTime",
getXMPCreationDate().toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
}
}
else
{
meta.removeXmpTag("Xmp.photoshop.DateCreated");
meta.removeXmpTag("Xmp.xmp.CreateDate");
meta.removeXmpTag("Xmp.exif.DateTimeCreated");
meta.removeXmpTag("Xmp.exif.DateTimeOriginal");
meta.removeXmpTag("Xmp.tiff.DateTime");
meta.removeXmpTag("Xmp.xmp.ModifyDate");
meta.removeXmpTag("Xmp.xmp.MetadataDate");
}
if (d->dateDigitalizedCheck->isChecked())
meta.setXmpTagString("Xmp.exif.DateTimeDigitized",
d->dateDigitalizedSel->dateTime().toString("yyyy:MM:dd hh:mm:ss"));
else
meta.removeXmpTag("Xmp.exif.DateTimeDigitized");
if (d->cityCheck->isChecked())
meta.setXmpTagString("Xmp.photoshop.City", d->cityEdit->text());
else
meta.removeXmpTag("Xmp.photoshop.City");
if (d->sublocationCheck->isChecked())
meta.setXmpTagString("Xmp.iptc.Location", d->sublocationEdit->text());
else
meta.removeXmpTag("Xmp.iptc.Location");
if (d->provinceCheck->isChecked())
meta.setXmpTagString("Xmp.photoshop.State", d->provinceEdit->text());
else
meta.removeXmpTag("Xmp.photoshop.State");
if (d->countryCheck->isChecked())
{
QString countryName = d->countryCB->currentText().mid(6);
QString countryCode = d->countryCB->currentText().left(3);
meta.setXmpTagString("Xmp.iptc.CountryCode", countryCode);
meta.setXmpTagString("Xmp.photoshop.Country", countryName);
}
else if (d->countryCheck->isValid())
{
meta.removeXmpTag("Xmp.iptc.CountryCode");
meta.removeXmpTag("Xmp.photoshop.Country");
}
#if KEXIV2_VERSION >= 0x010000
exifData = meta.getExifEncoded();
#else
exifData = meta.getExif();
#endif
xmpData = meta.getXmp();
}
示例3: run
void SaveImgThread::run()
{
// Perform saving ---------------------------------------------------------------
QImage prev = d->img.scaled(1280, 1024, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QImage thumb = d->img.scaled(160, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QByteArray prof = KPWriteImage::getICCProfilFromFile(RawDecodingSettings::SRGB);
KPMetadata meta;
meta.setImageProgramId(QString("Kipi-plugins"), QString(kipiplugins_version));
meta.setImageDimensions(d->img.size());
if (d->format != QString("JPEG"))
meta.setImagePreview(prev);
meta.setExifThumbnail(thumb);
meta.setExifTagString("Exif.Image.DocumentName", QString("Scanned Image")); // not i18n
meta.setExifTagString("Exif.Image.Make", d->make);
meta.setXmpTagString("Xmp.tiff.Make", d->make);
meta.setExifTagString("Exif.Image.Model", d->model);
meta.setXmpTagString("Xmp.tiff.Model", d->model);
meta.setImageDateTime(QDateTime::currentDateTime());
meta.setImageOrientation(KPMetadata::ORIENTATION_NORMAL);
meta.setImageColorWorkSpace(KPMetadata::WORKSPACE_SRGB);
KPWriteImage wImageIface;
if (d->frmt != KSaneIface::KSaneWidget::FormatRGB_16_C)
{
QByteArray data((const char*)d->img.bits(), d->img.numBytes());
wImageIface.setImageData(data, d->img.width(), d->img.height(), false, true, prof, meta);
}
else
{
// 16 bits color depth image.
wImageIface.setImageData(d->ksaneData, d->width, d->height, true, false, prof, meta);
}
bool ret = false;
QString path;
if(d->newUrl.isLocalFile())
path = d->newUrl.toLocalFile();
else
path = d->newUrl.path();
if (d->format == QString("JPEG"))
{
ret = wImageIface.write2JPEG(path);
}
else if (d->format == QString("PNG"))
{
ret = wImageIface.write2PNG(path);
}
else if (d->format == QString("TIFF"))
{
ret = wImageIface.write2TIFF(path);
}
else
{
ret = d->img.save(path, d->format.toAscii().data());
}
emit signalComplete(d->newUrl, ret);
}
示例4: run
void Task::run()
{
if (d->cancel) return;
QDateTime dt = d->itemsMap.value(d->url);
if (!dt.isValid()) return;
emit signalProcessStarted(d->url);
bool metadataChanged = d->settings.updEXIFModDate || d->settings.updEXIFOriDate ||
d->settings.updEXIFDigDate || d->settings.updEXIFThmDate ||
d->settings.updIPTCDate || d->settings.updXMPDate;
int status = MyImageList::NOPROCESS_ERROR;
if (metadataChanged)
{
bool ret = true;
KPMetadata meta;
ret &= meta.load(d->url.path());
if (ret)
{
if (meta.canWriteExif(d->url.path()))
{
if (d->settings.updEXIFModDate)
{
ret &= meta.setExifTagString("Exif.Image.DateTime",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
}
if (d->settings.updEXIFOriDate)
{
ret &= meta.setExifTagString("Exif.Photo.DateTimeOriginal",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
}
if (d->settings.updEXIFDigDate)
{
ret &= meta.setExifTagString("Exif.Photo.DateTimeDigitized",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
}
if (d->settings.updEXIFThmDate)
{
ret &= meta.setExifTagString("Exif.Image.PreviewDateTime",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
}
}
else if (d->settings.updEXIFModDate || d->settings.updEXIFOriDate ||
d->settings.updEXIFDigDate || d->settings.updEXIFThmDate)
{
ret = false;
}
if (d->settings.updIPTCDate)
{
if (meta.canWriteIptc(d->url.path()))
{
ret &= meta.setIptcTagString("Iptc.Application2.DateCreated",
dt.date().toString(Qt::ISODate));
ret &= meta.setIptcTagString("Iptc.Application2.TimeCreated",
dt.time().toString(Qt::ISODate));
}
else
{
ret = false;
}
}
if (d->settings.updXMPDate)
{
if (meta.supportXmp() && meta.canWriteXmp(d->url.path()))
{
ret &= meta.setXmpTagString("Xmp.exif.DateTimeOriginal",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
ret &= meta.setXmpTagString("Xmp.photoshop.DateCreated",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
ret &= meta.setXmpTagString("Xmp.tiff.DateTime",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
ret &= meta.setXmpTagString("Xmp.xmp.CreateDate",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
ret &= meta.setXmpTagString("Xmp.xmp.MetadataDate",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
ret &= meta.setXmpTagString("Xmp.xmp.ModifyDate",
dt.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii());
}
else
{
ret = false;
}
}
ret &= meta.save(d->url.path());
if (!ret)
{
kDebug() << "Failed to update metadata in file " << d->url.fileName();
//.........这里部分代码省略.........