本文整理汇总了C++中KPMetadata::getIptc方法的典型用法代码示例。如果您正苦于以下问题:C++ KPMetadata::getIptc方法的具体用法?C++ KPMetadata::getIptc怎么用?C++ KPMetadata::getIptc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPMetadata
的用法示例。
在下文中一共展示了KPMetadata::getIptc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyMetadata
void IPTCSubjects::applyMetadata(QByteArray& iptcData)
{
KPMetadata meta;
meta.setIptc(iptcData);
QStringList newSubjects = subjectsList();
if (m_subjectsCheck->isChecked())
meta.setIptcSubjects(meta.getIptcSubjects(), newSubjects);
else
meta.setIptcSubjects(meta.getIptcSubjects(), QStringList());
iptcData = meta.getIptc();
}
示例2: applyMetadata
void IPTCKeywords::applyMetadata(QByteArray& iptcData)
{
KPMetadata meta;
meta.setIptc(iptcData);
QStringList newKeywords;
for (int i = 0 ; i < d->keywordsBox->count(); ++i)
{
QListWidgetItem* item = d->keywordsBox->item(i);
newKeywords.append(item->text());
}
if (d->keywordsCheck->isChecked())
meta.setIptcKeywords(d->oldKeywords, newKeywords);
else
meta.setIptcKeywords(d->oldKeywords, QStringList());
iptcData = meta.getIptc();
}
示例3: slotItemChanged
void XMPEditWidget::slotItemChanged()
{
KPMetadata meta;
meta.load((*d->dlg->currentItem()).path());
#if KEXIV2_VERSION >= 0x010000
d->exifData = meta.getExifEncoded();
#else
d->exifData = meta.getExif();
#endif
d->iptcData = meta.getIptc();
d->xmpData = meta.getXmp();
d->contentPage->readMetadata(d->xmpData);
d->originPage->readMetadata(d->xmpData);
d->subjectsPage->readMetadata(d->xmpData);
d->keywordsPage->readMetadata(d->xmpData);
d->categoriesPage->readMetadata(d->xmpData);
d->creditsPage->readMetadata(d->xmpData);
d->statusPage->readMetadata(d->xmpData);
d->propertiesPage->readMetadata(d->xmpData);
d->isReadOnly = !KPMetadata::canWriteXmp((*d->dlg->currentItem()).path());
emit signalSetReadOnly(d->isReadOnly);
d->page_content->setEnabled(!d->isReadOnly);
d->page_origin->setEnabled(!d->isReadOnly);
d->page_subjects->setEnabled(!d->isReadOnly);
d->page_keywords->setEnabled(!d->isReadOnly);
d->page_categories->setEnabled(!d->isReadOnly);
d->page_credits->setEnabled(!d->isReadOnly);
d->page_status->setEnabled(!d->isReadOnly);
d->page_properties->setEnabled(!d->isReadOnly);
}
示例4: applyMetadata
//.........这里部分代码省略.........
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
{
meta.removeIptcTag("Iptc.Envelope.TimeSent");
}
meta.setImageProgramId(QString("Kipi-plugins"), QString(kipiplugins_version));
iptcData = meta.getIptc();
}
示例5: updateMetadataImageMagick
bool Utils::updateMetadataImageMagick(const QString& src, QString& err)
{
QFileInfo finfo(src);
if (src.isEmpty() || !finfo.isReadable())
{
err = i18n("unable to open source file");
return false;
}
QImage img(src);
QImage iptcPreview = img.scaled(1280, 1024, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QImage exifThumbnail = iptcPreview.scaled(160, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation);
KPMetadata meta;
meta.load(src);
meta.setImageOrientation(KPMetadata::ORIENTATION_NORMAL);
meta.setImageProgramId(QString("Kipi-plugins"), QString(kipiplugins_version));
meta.setImageDimensions(img.size());
meta.setExifThumbnail(exifThumbnail);
meta.setImagePreview(iptcPreview);
#if KEXIV2_VERSION >= 0x010000
QByteArray exifData = meta.getExifEncoded(true);
#else
QByteArray exifData = meta.getExif(true);
#endif
QByteArray iptcData = meta.getIptc(true);
QByteArray xmpData = meta.getXmp();
KTemporaryFile exifTemp;
exifTemp.setSuffix(QString("kipipluginsexif.app1"));
exifTemp.setAutoRemove(true);
if ( !exifTemp.open() )
{
err = i18n("unable to open temp file");
return false;
}
QString exifFile = exifTemp.fileName();
QDataStream streamExif( &exifTemp );
streamExif.writeRawData(exifData.data(), exifData.size());
exifTemp.close();
KTemporaryFile iptcTemp;
iptcTemp.setSuffix(QString("kipipluginsiptc.8bim"));
iptcTemp.setAutoRemove(true);
iptcTemp.open();
if ( !iptcTemp.open() )
{
err = i18n("Cannot rotate: unable to open temp file");
return false;
}
QString iptcFile = iptcTemp.fileName();
QDataStream streamIptc( &iptcTemp );
streamIptc.writeRawData(iptcData.data(), iptcData.size());
iptcTemp.close();
KTemporaryFile xmpTemp;
xmpTemp.setSuffix(QString("kipipluginsxmp.xmp"));
xmpTemp.setAutoRemove(true);
if ( !xmpTemp.open() )
{
err = i18n("unable to open temp file");
return false;
}
QString xmpFile = xmpTemp.fileName();
QDataStream streamXmp( &xmpTemp );
streamXmp.writeRawData(xmpData.data(), xmpData.size());
xmpTemp.close();
KProcess process;
process.clearProgram();
process << "mogrify";
process << "-profile";
process << exifFile;
process << "-profile";
process << iptcFile;
process << "-profile";
process << xmpFile;
process << src + QString("[0]");
kDebug() << "ImageMagick Command line: " << process.program();
process.start();
if (!process.waitForFinished())
return false;
if (process.exitStatus() != QProcess::NormalExit)
return false;
switch (process.exitCode())
{
case 0: // Process finished successfully !
{
return true;
//.........这里部分代码省略.........