本文整理汇总了C++中DMetadata::load方法的典型用法代码示例。如果您正苦于以下问题:C++ DMetadata::load方法的具体用法?C++ DMetadata::load怎么用?C++ DMetadata::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DMetadata
的用法示例。
在下文中一共展示了DMetadata::load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: slotItemChanged
void IPTCEditWidget::slotItemChanged()
{
d->page_content->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Content Information<br/>"
"<i>Use this panel to describe the visual content of the image</i></qt>")));
d->page_origin->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Origin Information<br/>"
"<i>Use this panel for formal descriptive information about the image</i></qt>")));
d->page_credits->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Credit Information<br/>"
"<i>Use this panel to record copyright information about the image</i></qt>")));
d->page_subjects->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Subject Information<br/>"
"<i>Use this panel to record subject information about the image</i></qt>")));
d->page_keywords->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Keyword Information<br/>"
"<i>Use this panel to record keywords relevant to the image</i></qt>")));
d->page_categories->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Category Information<br/>"
"<i>Use this panel to record categories relevant to the image</i></qt>")));
d->page_status->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Status Information<br/>"
"<i>Use this panel to record workflow information</i></qt>")));
d->page_properties->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Status Properties<br/>"
"<i>Use this panel to record workflow properties</i></qt>")));
d->page_envelope->setHeader(d->dlg->currentItemTitleHeader(i18n("<qt>Envelope Information<br/>"
"<i>Use this panel to record editorial details</i></qt>")));
DMetadata meta;
meta.load((*d->dlg->currentItem()).path());
d->exifData = meta.getExifEncoded();
d->iptcData = meta.getIptc();
d->contentPage->readMetadata(d->iptcData);
d->originPage->readMetadata(d->iptcData);
d->creditsPage->readMetadata(d->iptcData);
d->subjectsPage->readMetadata(d->iptcData);
d->keywordsPage->readMetadata(d->iptcData);
d->categoriesPage->readMetadata(d->iptcData);
d->statusPage->readMetadata(d->iptcData);
d->propertiesPage->readMetadata(d->iptcData);
d->envelopePage->readMetadata(d->iptcData);
d->isReadOnly = !DMetadata::canWriteIptc((*d->dlg->currentItem()).path());
emit signalSetReadOnly(d->isReadOnly);
d->page_content->setEnabled(!d->isReadOnly);
d->page_origin->setEnabled(!d->isReadOnly);
d->page_credits->setEnabled(!d->isReadOnly);
d->page_subjects->setEnabled(!d->isReadOnly);
d->page_keywords->setEnabled(!d->isReadOnly);
d->page_categories->setEnabled(!d->isReadOnly);
d->page_status->setEnabled(!d->isReadOnly);
d->page_properties->setEnabled(!d->isReadOnly);
d->page_envelope->setEnabled(!d->isReadOnly);
}
示例3: LoadImageData
MyImageData LoadImageData(const QUrl& urlToLoad)
{
MyImageData imageData;
imageData.url = urlToLoad;
// TODO: error handling!
DMetadata meta;
meta.load(urlToLoad.toLocalFile());
double lat, lon, alt;
if (meta.getGPSInfo(alt, lat, lon))
{
imageData.coordinates.setLatLon(lat, lon);
imageData.coordinates.setAlt(alt);
}
return imageData;
}
示例4: openUrls
void ShowFoto::openUrls(const QList<QUrl> &urls)
{
if (!urls.isEmpty())
{
ShowfotoItemInfoList infos;
ShowfotoItemInfo iteminfo;
DMetadata meta;
for (QList<QUrl>::const_iterator it = urls.constBegin(); it != urls.constEnd(); ++it)
{
QFileInfo fi((*it).toLocalFile());
iteminfo.name = fi.fileName();
iteminfo.mime = fi.suffix();
iteminfo.size = fi.size();
iteminfo.url = QUrl::fromLocalFile(fi.filePath());
iteminfo.folder = fi.path();
iteminfo.dtime = fi.created();
meta.load(fi.filePath());
iteminfo.ctime = meta.getImageDateTime();
iteminfo.width = meta.getImageDimensions().width();
iteminfo.height = meta.getImageDimensions().height();
iteminfo.photoInfo = meta.getPhotographInformation();
infos.append(iteminfo);
}
if (d->droppedUrls)
{
//replace the equal sign with "<<" to keep the previous pics in the list
d->infoList << infos;
}
else
{
d->infoList = infos;
d->model->clearShowfotoItemInfos();
emit signalInfoList(d->infoList);
slotOpenUrl(d->thumbBar->currentInfo());
}
}
}
示例5: 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;
}
}
示例6: run
void TimeAdjustTask::run()
{
if (m_cancel)
return;
emit signalProcessStarted(d->url);
QDateTime dt = d->itemsMap.value(d->url);
if (!dt.isValid())
{
emit signalProcessEnded(d->url, TimeAdjustList::META_TIME_ERROR);
emit signalDone();
return;
}
bool writeToSidecar = (MetaEngineSettings::instance()->settings()
.metadataWritingMode != DMetadata::WRITE_TO_FILE_ONLY);
bool metadataChanged = d->settings.updEXIFModDate || d->settings.updEXIFOriDate ||
d->settings.updEXIFDigDate || d->settings.updEXIFThmDate ||
d->settings.updIPTCDate || d->settings.updXMPVideo ||
d->settings.updXMPDate;
int status = TimeAdjustList::NOPROCESS_ERROR;
if (metadataChanged)
{
bool ret = true;
DMetadata meta;
ret &= meta.load(d->url.toLocalFile());
if (ret)
{
QString exifDateTimeFormat = QLatin1String("yyyy:MM:dd hh:mm:ss");
QString xmpDateTimeFormat = QLatin1String("yyyy:MM:ddThh:mm:ss");
if (writeToSidecar || meta.canWriteExif(d->url.toLocalFile()))
{
if (d->settings.updEXIFModDate)
{
if (!d->settings.updIfAvailable ||
!meta.getExifTagString("Exif.Image.DateTime").isEmpty())
{
ret &= meta.setExifTagString("Exif.Image.DateTime",
dt.toString(exifDateTimeFormat));
}
}
if (d->settings.updEXIFOriDate)
{
if (!d->settings.updIfAvailable ||
!meta.getExifTagString("Exif.Photo.DateTimeOriginal").isEmpty())
{
ret &= meta.setExifTagString("Exif.Photo.DateTimeOriginal",
dt.toString(exifDateTimeFormat));
}
}
if (d->settings.updEXIFDigDate)
{
if (!d->settings.updIfAvailable ||
!meta.getExifTagString("Exif.Photo.DateTimeDigitized").isEmpty())
{
ret &= meta.setExifTagString("Exif.Photo.DateTimeDigitized",
dt.toString(exifDateTimeFormat));
}
}
if (d->settings.updEXIFThmDate)
{
if (!d->settings.updIfAvailable ||
!meta.getExifTagString("Exif.Image.PreviewDateTime").isEmpty())
{
ret &= meta.setExifTagString("Exif.Image.PreviewDateTime",
dt.toString(exifDateTimeFormat));
}
}
}
else if (d->settings.updEXIFModDate || d->settings.updEXIFOriDate ||
d->settings.updEXIFDigDate || d->settings.updEXIFThmDate)
{
ret = false;
}
if (d->settings.updIPTCDate)
{
if (writeToSidecar || meta.canWriteIptc(d->url.toLocalFile()))
{
if (!d->settings.updIfAvailable ||
!meta.getIptcTagString("Iptc.Application2.DateCreated").isEmpty())
{
ret &= meta.setIptcTagString("Iptc.Application2.DateCreated",
dt.date().toString(Qt::ISODate));
}
if (!d->settings.updIfAvailable ||
!meta.getIptcTagString("Iptc.Application2.TimeCreated").isEmpty())
//.........这里部分代码省略.........
示例7: openFolder
void ShowFoto::openFolder(const QUrl& url)
{
if (!url.isValid() || !url.isLocalFile())
{
return;
}
// Parse image IO mime types registration to get files filter pattern.
QString filter;
QStringList mimeTypes = supportedImageMimeTypes(QIODevice::ReadOnly, filter);
QString patterns = filter.toLower();
patterns.append (QLatin1String(" "));
patterns.append (filter.toUpper());
qCDebug(DIGIKAM_SHOWFOTO_LOG) << "patterns=" << patterns;
// Get all image files from directory.
QDir dir(url.toLocalFile(), patterns);
dir.setFilter(QDir::Files);
if (!dir.exists())
{
return;
}
QFileInfoList fileinfolist = dir.entryInfoList();
if (fileinfolist.isEmpty())
{
//emit signalSorry();
return;
}
QFileInfoList::const_iterator fi;
ShowfotoItemInfoList infos;
ShowfotoItemInfo iteminfo;
DMetadata meta;
// And open all items in image editor.
for (fi = fileinfolist.constBegin(); fi != fileinfolist.constEnd(); ++fi)
{
iteminfo.name = (*fi).fileName();
iteminfo.mime = (*fi).suffix();
iteminfo.size = (*fi).size();
iteminfo.folder = (*fi).path();
iteminfo.url = QUrl::fromLocalFile((*fi).filePath());
iteminfo.dtime = (*fi).created();
meta.load((*fi).filePath());
iteminfo.ctime = meta.getImageDateTime();
iteminfo.width = meta.getImageDimensions().width();
iteminfo.height = meta.getImageDimensions().height();
iteminfo.photoInfo = meta.getPhotographInformation();
infos.append(iteminfo);
}
if (d->droppedUrls)
{
d->infoList << infos;
}
else
{
d->infoList = infos;
d->model->clearShowfotoItemInfos();
emit signalInfoList(d->infoList);
slotOpenUrl(d->thumbBar->currentInfo());
}
d->lastOpenedDirectory = QUrl::fromLocalFile(dir.absolutePath());
}