本文整理汇总了C++中DMetadata类的典型用法代码示例。如果您正苦于以下问题:C++ DMetadata类的具体用法?C++ DMetadata怎么用?C++ DMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMetadata
void ImagePropertiesGPSTab::setMetadata(const DMetadata& meta, const KUrl& url)
{
double lat, lng;
const bool haveCoordinates = meta.getGPSLatitudeNumber(&lat) && meta.getGPSLongitudeNumber(&lng);
if (haveCoordinates)
{
double alt;
const bool haveAlt = meta.getGPSAltitude(&alt);
KGeoMap::GeoCoordinates coordinates(lat, lng);
if (haveAlt)
{
coordinates.setAlt(alt);
}
GPSImageInfo gpsInfo;
gpsInfo.coordinates = coordinates;
gpsInfo.dateTime = meta.getImageDateTime();
gpsInfo.rating = meta.getImageRating();
gpsInfo.url = url;
setGPSInfoList(GPSImageInfo::List() << gpsInfo);
}
else
{
clearGPSInfo();
}
}
示例2: testTagSeparatorWrite
void TagsReadWriteTest::testTagSeparatorWrite()
{
DMetadata dmeta;
DMetadataSettingsContainer dmsettings;
QStringList readResult;
QStringList expected;
NamespaceEntry tagNs3;
tagNs3.namespaceName = QLatin1String("Xmp.lr.hierarchicalSubject");
tagNs3.tagPaths = NamespaceEntry::TAGPATH;
tagNs3.separator = QLatin1Char('|');
tagNs3.nsType = NamespaceEntry::TAGS;
tagNs3.index = 2;
tagNs3.specialOpts = NamespaceEntry::TAG_XMPBAG;
tagNs3.subspace = NamespaceEntry::XMP;
tagNs3.alternativeName = QLatin1String("Xmp.lr.HierarchicalSubject");
tagNs3.secondNameOpts = NamespaceEntry::TAG_XMPSEQ;
dmsettings.getWriteMapping(QString::fromUtf8(DM_TAG_CONTAINER)).clear();
dmsettings.getWriteMapping(QString::fromUtf8(DM_TAG_CONTAINER))
<< tagNs3;
dmeta.setItemTagsPath(tagSet1, dmsettings);
readResult = dmeta.getXmpTagStringBag("Xmp.lr.hierarchicalSubject", false);
expected = tagSet1;
expected = expected.replaceInStrings(QLatin1String("/"), QLatin1String("|"));
QCOMPARE(readResult, expected);
}
示例3: applyChangeNotifications
bool MetadataHub::write(DImg& image, WriteComponent writeMode, bool ignoreLazySync, const MetadataSettingsContainer& settings)
{
applyChangeNotifications();
// if no DMetadata object is needed at all, don't construct one
if (!willWriteMetadata(writeMode, settings))
{
return false;
}
// See DImgLoader::readMetadata() and saveMetadata()
DMetadata metadata;
metadata.setData(image.getMetadata());
QString filePath = image.originalFilePath();
if (filePath.isEmpty())
{
filePath = image.lastSavedFilePath();
}
if (!ignoreLazySync && settings.useLazySync && !filePath.isEmpty())
{
ImageInfo info = ImageInfo::fromLocalFile(filePath);
MetadataHubMngr::instance()->addPending(info);
return true;
}
if (!filePath.isEmpty())
{
writeToBaloo(filePath);
}
return write(metadata, writeMode, settings);
}
示例4: main
int main (int /*argc*/, char** /*argv*/)
{
DMetadata meta;
qDebug() << "-- Standard Exif Tags -------------------------------------------------------------";
DMetadata::TagsMap exiftags = meta.getStdExifTagsList();
for (DMetadata::TagsMap::const_iterator it = exiftags.constBegin(); it != exiftags.constEnd(); ++it )
{
QString key = it.key();
QStringList values = it.value();
QString name = values[0];
QString title = values[1];
QString desc = values[2];
qDebug() << key << " :: " << name << " :: " << title << " :: " << desc;
}
qDebug() << "-- Makernote Tags -----------------------------------------------------------------";
DMetadata::TagsMap mntags = meta.getMakernoteTagsList();
for (DMetadata::TagsMap::const_iterator it = mntags.constBegin(); it != mntags.constEnd(); ++it )
{
QString key = it.key();
QStringList values = it.value();
QString name = values[0];
QString title = values[1];
QString desc = values[2];
qDebug() << key << " :: " << name << " :: " << title << " :: " << desc;
}
qDebug() << "-- Standard Iptc Tags -----------------------------------------------------------------";
DMetadata::TagsMap iptctags = meta.getIptcTagsList();
for (DMetadata::TagsMap::const_iterator it = iptctags.constBegin(); it != iptctags.constEnd(); ++it )
{
QString key = it.key();
QStringList values = it.value();
QString name = values[0];
QString title = values[1];
QString desc = values[2];
qDebug() << key << " :: " << name << " :: " << title << " :: " << desc;
}
qDebug() << "-- Standard Xmp Tags -----------------------------------------------------------------";
DMetadata::TagsMap xmptags = meta.getXmpTagsList();
for (DMetadata::TagsMap::const_iterator it = xmptags.constBegin(); it != xmptags.constEnd(); ++it )
{
QString key = it.key();
QStringList values = it.value();
QString name = values[0];
QString title = values[1];
QString desc = values[2];
qDebug() << key << " :: " << name << " :: " << title << " :: " << desc;
}
return 0;
}
示例5: testSimpleReadAfterWrite
void TagsReadWriteTest::testSimpleReadAfterWrite()
{
DMetadata dmeta;
QStringList tagPaths2;
dmeta.setItemTagsPath(this->tagSet1);
dmeta.getItemTagsPath(tagPaths2);
QCOMPARE(tagSet1, tagPaths2);
}
示例6: getTagTitle
QString MakerNoteWidget::getTagTitle(const QString& key)
{
DMetadata metadataIface;
QString title = metadataIface.getExifTagTitle(key.toLatin1().constData());
if (title.isEmpty())
{
return key.section(QLatin1Char('.'), -1);
}
return title;
}
示例7: getTagDescription
QString MakerNoteWidget::getTagDescription(const QString& key)
{
DMetadata metadataIface;
QString desc = metadataIface.getExifTagDescription(key.toLatin1().constData());
if (desc.isEmpty())
{
return i18n("No description available");
}
return desc;
}
示例8: switch
/**
* @brief Gets the coordinates of a marker found at current model index.
* @param index Current model index.
* @param coordinates Here will be returned the coordinates of the current marker.
* @return True, if the marker has coordinates.
*/
bool MapViewModelHelper::itemCoordinates(const QModelIndex& index, GeoIface::GeoCoordinates* const coordinates) const
{
switch (d->application)
{
case MapWidgetView::ApplicationDigikam:
{
const ImageInfo info = d->model->imageInfo(index);
if (info.isNull() || !info.hasCoordinates())
{
return false;
}
*coordinates = GeoIface::GeoCoordinates(info.latitudeNumber(), info.longitudeNumber());
break;
}
case MapWidgetView::ApplicationImportUI:
{
const CamItemInfo info = d->importModel->camItemInfo(index);
if (info.isNull())
{
return false;
}
const DMetadata meta(info.url().toLocalFile());
double lat, lng;
const bool haveCoordinates = meta.getGPSLatitudeNumber(&lat) && meta.getGPSLongitudeNumber(&lng);
if (!haveCoordinates)
{
return false;
}
GeoIface::GeoCoordinates tmpCoordinates(lat, lng);
double alt;
const bool haveAlt = meta.getGPSAltitude(&alt);
if (haveAlt)
{
tmpCoordinates.setAlt(alt);
}
*coordinates = tmpCoordinates;
break;
}
}
return true;
}
示例9: getMetadata
bool MakerNoteWidget::decodeMetadata()
{
DMetadata data = getMetadata();
if (!data.hasExif())
{
return false;
}
// Update all metadata contents.
setMetadataMap(data.getExifTagsDataList(m_keysFilter, true));
return true;
}
示例10: 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);
}
示例11: applyMetadata
void XMPSubjects::applyMetadata(QByteArray& xmpData)
{
DMetadata meta;
meta.setXmp(xmpData);
QStringList newSubjects = subjectsList();
// We remove in first all existing subjects.
meta.removeXmpTag("Xmp.iptc.SubjectCode");
// And add new list if necessary.
if (m_subjectsCheck->isChecked())
meta.setXmpSubjects(newSubjects);
xmpData = meta.getXmp();
}
示例12: 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;
}
示例13: testWriteToDisabledNamespaces
void TagsReadWriteTest::testWriteToDisabledNamespaces()
{
DMetadata dmeta;
DMetadataSettingsContainer dmsettings;
QStringList empty;
QStringList secondNamespace;
NamespaceEntry tagNs2;
tagNs2.namespaceName = QLatin1String("Xmp.MicrosoftPhoto.LastKeywordXMP");
tagNs2.tagPaths = NamespaceEntry::TAGPATH;
tagNs2.separator = QLatin1Char('/');
tagNs2.nsType = NamespaceEntry::TAGS;
tagNs2.index = 1;
tagNs2.specialOpts = NamespaceEntry::TAG_XMPBAG;
tagNs2.subspace = NamespaceEntry::XMP;
tagNs2.isDisabled = true;
NamespaceEntry tagNs3;
tagNs3.namespaceName = QLatin1String("Xmp.lr.hierarchicalSubject");
tagNs3.tagPaths = NamespaceEntry::TAGPATH;
tagNs3.separator = QLatin1Char('|');
tagNs3.nsType = NamespaceEntry::TAGS;
tagNs3.index = 2;
tagNs3.specialOpts = NamespaceEntry::TAG_XMPBAG;
tagNs3.subspace = NamespaceEntry::XMP;
tagNs3.alternativeName = QLatin1String("Xmp.lr.HierarchicalSubject");
tagNs3.secondNameOpts = NamespaceEntry::TAG_XMPSEQ;
dmsettings.getWriteMapping(QString::fromUtf8(DM_TAG_CONTAINER)).clear();
dmsettings.getWriteMapping(QString::fromUtf8(DM_TAG_CONTAINER))
<< tagNs2
<< tagNs3;
dmeta.setItemTagsPath(tagSet1, dmsettings);
empty = dmeta.getXmpTagStringBag("Xmp.MicrosoftPhoto.LastKeywordXMP", false);
QCOMPARE(empty, QStringList());
secondNamespace = dmeta.getXmpTagStringBag("Xmp.lr.hierarchicalSubject", false);
secondNamespace = secondNamespace.replaceInStrings(QLatin1String("|"), QLatin1String("/"));
QCOMPARE(secondNamespace, tagSet1);
}
示例14: 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;
}
示例15: applyMetadata
void IPTCKeywords::applyMetadata(QByteArray& iptcData)
{
DMetadata meta;
meta.setIptc(iptcData);
QStringList newKeywords;
for (int i = 0 ; i < d->keywordsBox->count(); ++i)
{
QListWidgetItem* const 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();
}