本文整理汇总了C++中DMetadata::save方法的典型用法代码示例。如果您正苦于以下问题:C++ DMetadata::save方法的具体用法?C++ DMetadata::save怎么用?C++ DMetadata::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DMetadata
的用法示例。
在下文中一共展示了DMetadata::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toolOperations
bool AssignTemplate::toolOperations()
{
DMetadata meta;
if (image().isNull())
{
if (!meta.load(inputUrl().toLocalFile()))
{
return false;
}
}
else
{
meta.setData(image().getMetadata());
}
QString title = settings()[QLatin1String("TemplateTitle")].toString();
if (title == Template::removeTemplateTitle())
{
meta.removeMetadataTemplate();
}
else if (title.isEmpty())
{
// Nothing to do.
}
else
{
Template t = TemplateManager::defaultManager()->findByTitle(title);
meta.removeMetadataTemplate();
meta.setMetadataTemplate(t);
}
bool ret = true;
if (image().isNull())
{
QFile::remove(outputUrl().toLocalFile());
ret = QFile::copy(inputUrl().toLocalFile(), outputUrl().toLocalFile());
if (ret && !title.isEmpty())
{
ret = meta.save(outputUrl().toLocalFile());
}
}
else
{
if (!title.isEmpty())
{
image().setMetadata(meta.data());
}
ret = savefromDImg();
}
return ret;
}
示例2: apply
void IPTCEditWidget::apply()
{
if (d->modified && !d->isReadOnly)
{
d->contentPage->applyMetadata(d->exifData, d->iptcData);
d->originPage->applyMetadata(d->exifData, d->iptcData);
d->creditsPage->applyMetadata(d->iptcData);
d->subjectsPage->applyMetadata(d->iptcData);
d->keywordsPage->applyMetadata(d->iptcData);
d->categoriesPage->applyMetadata(d->iptcData);
d->statusPage->applyMetadata(d->iptcData);
d->propertiesPage->applyMetadata(d->iptcData);
d->envelopePage->applyMetadata(d->iptcData);
DMetadata meta;
meta.load((*d->dlg->currentItem()).path());
meta.setExif(d->exifData);
meta.setIptc(d->iptcData);
meta.save((*d->dlg->currentItem()).path());
d->modified = false;
}
}
示例3: run
//.........这里部分代码省略.........
!meta.getXmpTagString("Xmp.video.DateTimeOriginal").isEmpty())
{
ret &= meta.setXmpTagString("Xmp.video.DateTimeOriginal",
dt.toString(xmpDateTimeFormat));
}
if (!d->settings.updIfAvailable ||
!meta.getXmpTagString("Xmp.video.DateTimeDigitized").isEmpty())
{
ret &= meta.setXmpTagString("Xmp.video.DateTimeDigitized",
dt.toString(xmpDateTimeFormat));
}
if (!d->settings.updIfAvailable ||
!meta.getXmpTagString("Xmp.video.ModificationDate").isEmpty())
{
ret &= meta.setXmpTagString("Xmp.video.ModificationDate",
dt.toString(xmpDateTimeFormat));
}
if (!d->settings.updIfAvailable ||
!meta.getXmpTagString("Xmp.video.DateUTC").isEmpty())
{
ret &= meta.setXmpTagString("Xmp.video.DateUTC",
dt.toUTC().toString(xmpDateTimeFormat));
}
}
else
{
ret = false;
}
}
ret &= meta.save(d->url.toLocalFile());
if (!ret)
{
qCDebug(DIGIKAM_DPLUGIN_GENERIC_LOG) << "Failed to update metadata in file " << d->url.fileName();
}
}
else
{
qCDebug(DIGIKAM_DPLUGIN_GENERIC_LOG) << "Failed to load metadata from file " << d->url.fileName();
}
if (!ret)
{
status |= TimeAdjustList::META_TIME_ERROR;
}
}
if (d->settings.updFileModDate)
{
// Since QFileInfo does not support timestamp updates,
// we have to use the utime() system call.
int modtime;
QDateTime unixDate;
unixDate.setDate(QDate(1970, 1, 1));
unixDate.setTime(QTime(0, 0, 0, 0));
if (dt < unixDate)
modtime = -(dt.secsTo(unixDate) + (60 * 60));
else
modtime = dt.toTime_t();