当前位置: 首页>>代码示例>>C++>>正文


C++ DMetadata类代码示例

本文整理汇总了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();
    }
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:29,代码来源:imagepropertiesgpstab.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例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);
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例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;
}
开发者ID:Match-Yang,项目名称:digikam,代码行数:58,代码来源:printtagslist.cpp

示例5: testSimpleReadAfterWrite

void TagsReadWriteTest::testSimpleReadAfterWrite()
{
    DMetadata dmeta;
    QStringList tagPaths2;

    dmeta.setItemTagsPath(this->tagSet1);
    dmeta.getItemTagsPath(tagPaths2);

    QCOMPARE(tagSet1, tagPaths2);
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例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;
}
开发者ID:KDE,项目名称:digikam,代码行数:12,代码来源:makernotewidget.cpp

示例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;
}
开发者ID:KDE,项目名称:digikam,代码行数:12,代码来源:makernotewidget.cpp

示例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;
}
开发者ID:KDE,项目名称:digikam,代码行数:58,代码来源:mapwidgetview.cpp

示例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;
}
开发者ID:KDE,项目名称:digikam,代码行数:13,代码来源:makernotewidget.cpp

示例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);
}
开发者ID:Match-Yang,项目名称:digikam,代码行数:49,代码来源:iptceditwidget.cpp

示例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();
}
开发者ID:KDE,项目名称:digikam,代码行数:15,代码来源:xmpsubjects.cpp

示例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;
}
开发者ID:birkedal,项目名称:digikam,代码行数:57,代码来源:assigntemplate.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:46,代码来源:

示例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;
}
开发者ID:templeblock,项目名称:digikam,代码行数:18,代码来源:mainwindow.cpp

示例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();
}
开发者ID:KDE,项目名称:digikam,代码行数:19,代码来源:iptckeywords.cpp


注:本文中的DMetadata类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。