本文整理汇总了C++中KPMetadata::removeIptcTag方法的典型用法代码示例。如果您正苦于以下问题:C++ KPMetadata::removeIptcTag方法的具体用法?C++ KPMetadata::removeIptcTag怎么用?C++ KPMetadata::removeIptcTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPMetadata
的用法示例。
在下文中一共展示了KPMetadata::removeIptcTag方法的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: addPhoto
//.........这里部分代码省略.........
form.addPair("content_type", contentType, "text/plain");
url2.addQueryItem("content_type", contentType);
QString tags = "\"" + info.tags.join("\" \"") + "\"";
if (tags.length() > 0)
{
form.addPair("tags", tags, "text/plain");
url2.addQueryItem("tags", tags);
}
if (!info.title.isEmpty())
{
form.addPair("title", info.title, "text/plain");
url2.addQueryItem("title", info.title);
}
if (!info.description.isEmpty())
{
form.addPair("description", info.description, "text/plain");
url2.addQueryItem("description", info.description);
}
QString md5 = getApiSig(m_secret, url2);
form.addPair("api_sig", md5, "text/plain");
QImage image;
// Check if RAW file.
if (KPMetadata::isRawFile(photoPath))
{
KDcrawIface::KDcraw::loadDcrawPreview(image, photoPath);
}
else
{
image.load(photoPath);
}
if (!image.isNull())
{
path = KStandardDirs::locateLocal("tmp", QFileInfo(photoPath).baseName().trimmed() + ".jpg");
if (sendOriginal)
{
QFile imgFile(photoPath);
imgFile.copy(path);
}
else
{
if (rescale && (image.width() > maxDim || image.height() > maxDim))
image = image.scaled(maxDim, maxDim, Qt::KeepAspectRatio,
Qt::SmoothTransformation);
image.save(path, "JPEG", imageQuality);
}
// Restore all metadata.
KPMetadata meta;
if (meta.load(photoPath))
{
meta.setImageDimensions(image.size());
// NOTE: see B.K.O #153207: Flickr use IPTC keywords to create Tags in web interface
// As IPTC do not support UTF-8, we need to remove it.
meta.removeIptcTag("Iptc.Application2.Keywords", false);
meta.setImageProgramId(QString("Kipi-plugins"), QString(kipiplugins_version));
meta.save(path);
}
else
{
kWarning() << "(flickrExport::Image doesn't have metadata)";
}
kDebug() << "Resizing and saving to temp file: " << path;
}
if (!form.addFile("photo", path))
{
return false;
}
form.finish();
KIO::TransferJob* job = KIO::http_post(url, form.formData(), KIO::HideProgressInfo);
job->addMetaData("content-type", form.contentType());
connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
this, SLOT(data(KIO::Job*,QByteArray)));
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotResult(KJob*)));
m_state = FE_ADDPHOTO;
m_job = job;
m_buffer.resize(0);
emit signalBusy(true);
return true;
}