本文整理汇总了C++中KPMetadata::setIptcTagString方法的典型用法代码示例。如果您正苦于以下问题:C++ KPMetadata::setIptcTagString方法的具体用法?C++ KPMetadata::setIptcTagString怎么用?C++ KPMetadata::setIptcTagString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPMetadata
的用法示例。
在下文中一共展示了KPMetadata::setIptcTagString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyMetadata
void IPTCEnvelope::applyMetadata(QByteArray& iptcData)
{
KPMetadata meta;
meta.setIptc(iptcData);
if (d->destinationCheck->isChecked())
{
meta.setIptcTagString("Iptc.Envelope.Destination", d->destinationEdit->toPlainText());
}
else
{
meta.removeIptcTag("Iptc.Envelope.Destination");
}
if (d->envelopeIDCheck->isChecked())
{
meta.setIptcTagString("Iptc.Envelope.EnvelopeNumber", d->envelopeIDEdit->text());
}
else
{
meta.removeIptcTag("Iptc.Envelope.EnvelopeNumber");
}
if (d->serviceIDCheck->isChecked())
{
meta.setIptcTagString("Iptc.Envelope.ServiceId", d->serviceIDEdit->text());
}
else
{
meta.removeIptcTag("Iptc.Envelope.ServiceId");
}
if (d->unoIDCheck->isChecked())
{
meta.setIptcTagString("Iptc.Envelope.UNO", d->unoIDEdit->text());
}
else
{
meta.removeIptcTag("Iptc.Envelope.UNO");
}
if (d->productIDCheck->isChecked())
{
meta.setIptcTagString("Iptc.Envelope.ProductId", d->productIDEdit->text());
}
else
{
meta.removeIptcTag("Iptc.Envelope.ProductId");
}
if (d->priorityCheck->isChecked())
{
meta.setIptcTagString("Iptc.Envelope.EnvelopePriority", QString::number(d->priorityCB->currentIndex()));
}
else if (d->priorityCheck->isValid())
{
meta.removeIptcTag("Iptc.Envelope.EnvelopePriority");
}
if (d->formatCheck->isChecked())
{
QString key;
int i = 0;
for (IPTCEnvelopePriv::FileFormatMap::Iterator it = d->fileFormatMap.begin();
it != d->fileFormatMap.end(); ++it)
{
if (i == d->formatCB->currentIndex()) key = it.key();
i++;
}
QString format = key.section('-', 0, 0);
QString version = key.section('-', -1);
meta.setIptcTagString("Iptc.Envelope.FileFormat", format);
meta.setIptcTagString("Iptc.Envelope.FileVersion", version);
}
else if (d->priorityCheck->isValid())
{
meta.removeIptcTag("Iptc.Envelope.FileFormat");
meta.removeIptcTag("Iptc.Envelope.FileVersion");
}
if (d->dateSentCheck->isChecked())
{
meta.setIptcTagString("Iptc.Envelope.DateSent",
d->dateSentSel->date().toString(Qt::ISODate));
}
else
{
meta.removeIptcTag("Iptc.Envelope.DateSent");
}
if (d->timeSentCheck->isChecked())
{
meta.setIptcTagString("Iptc.Envelope.TimeSent",
d->timeSentSel->time().toString(Qt::ISODate) +
d->zoneSentSel->getTimeZone());
}
else
{
//.........这里部分代码省略.........
示例2: 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();
//.........这里部分代码省略.........