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


C++ DMetadata::setImageTagsPath方法代码示例

本文整理汇总了C++中DMetadata::setImageTagsPath方法的典型用法代码示例。如果您正苦于以下问题:C++ DMetadata::setImageTagsPath方法的具体用法?C++ DMetadata::setImageTagsPath怎么用?C++ DMetadata::setImageTagsPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DMetadata的用法示例。


在下文中一共展示了DMetadata::setImageTagsPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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       = QLatin1String("|");
    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(QLatin1String(DM_TAG_CONTAINER)).clear();
    dmsettings.getWriteMapping(QLatin1String(DM_TAG_CONTAINER))
             << tagNs3;

    dmeta.setImageTagsPath(tagSet1, dmsettings);

    readResult = dmeta.getXmpTagStringBag("Xmp.lr.hierarchicalSubject", false);

    expected   = tagSet1;
    expected   = expected.replaceInStrings(QLatin1String("/"),QLatin1String("|"));

    QCOMPARE(readResult, expected);
}
开发者ID:KDE,项目名称:digikam,代码行数:32,代码来源:tagsreadwritetest.cpp

示例2: testSimpleReadAfterWrite

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

    dmeta.setImageTagsPath(this->tagSet1);
    dmeta.getImageTagsPath(tagPaths2);

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

示例3: 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     = QLatin1String("/");
    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       = QLatin1String("|");
    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(QLatin1String(DM_TAG_CONTAINER)).clear();
    dmsettings.getWriteMapping(QLatin1String(DM_TAG_CONTAINER))
             << tagNs2
             << tagNs3;

    dmeta.setImageTagsPath(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:KDE,项目名称:digikam,代码行数:46,代码来源:tagsreadwritetest.cpp

示例4: writeTags

bool MetadataHub::writeTags(DMetadata& metadata, bool saveTags)
{
    qCDebug(DIGIKAM_GENERAL_LOG) << "Writting tags";
    bool dirty = false;

    if (saveTags)
    {
        // Store tag paths as Iptc keywords tags.

        // DatabaseMode == ManagedTags is assumed.
        // To fix this constraint (not needed currently), an oldKeywords parameter is needed

        // create list of keywords to be added and to be removed
        QStringList tagsPathList, newKeywords;

        QList<int> keys = d->tags.keys();

        foreach (int tagId, keys)
        {
            if (!TagsCache::instance()->canBeWrittenToMetadata(tagId))
            {
                continue;
            }

            // WARNING: Do not use write(QFilePath ...) when multiple image info are loaded
            // otherwise disjoint tags will not be used, use writeToMetadata(ImageInfo...)
            if (d->tags.value(tagId) == MetadataAvailable)
            {
                // This works for single and multiple selection.
                // In both situations, tags which had originally been loaded
                // have explicitly been removed with setTag.
                QString tagName = TagsCache::instance()->tagName(tagId);
                QString tagPath = TagsCache::instance()->tagPath(tagId, TagsCache::NoLeadingSlash);

                if (!tagsPathList.contains(tagPath))
                {
                    tagsPathList << tagPath;
                }

                if (!tagName.isEmpty())
                {
                    newKeywords << tagName;
                }
            }
        }

        tagsPathList = cleanupTags(tagsPathList);
        newKeywords = cleanupTags(newKeywords);

        if (!newKeywords.isEmpty())
        {
            qCDebug(DIGIKAM_GENERAL_LOG) << "-------------------------- New Keywords" << newKeywords;
            // NOTE: See bug #175321 : we remove all old keyword from IPTC and XMP before to
            // synchronize metadata, else contents is not coherent.

            // We set Iptc keywords using tags name.
            // dirty |= metadata.setIptcKeywords(metadata.getIptcKeywords(), newKeywords);

            // We add Xmp keywords using tags name.
            // dirty |= metadata.removeXmpKeywords(metadata.getXmpKeywords());
            // dirty |= metadata.setXmpKeywords(newKeywords);

            // We set Tags Path list in digiKam Xmp private namespace using tags path.
            dirty |= metadata.setImageTagsPath(tagsPathList);
        }
        else
        {
            qCDebug(DIGIKAM_GENERAL_LOG) << "Delete all keywords";
            // Delete all IPTC and XMP keywords
            // dirty |= metadata.setIptcKeywords(metadata.getIptcKeywords(), QStringList());
            // dirty |= metadata.removeXmpKeywords(metadata.getXmpKeywords());
            dirty |= metadata.setImageTagsPath(QStringList());
        }
    }

    return dirty;
}
开发者ID:,项目名称:,代码行数:77,代码来源:


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