~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to core/libs/database/faces/facetags.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
{
46
46
public:
47
47
 
48
 
    static QString  tagPath(const QString& name, int parentId);
49
 
    static void     makeFaceTag(int tagId, const QString& fullName);
50
 
    static int      findFirstTagWithProperty(const QString& property, const QString& value = QString());
51
 
    static int      tagForName(const QString& name, int tagId, int parentId,
52
 
                        const QString& givenFullName, bool convert, bool create);
 
48
    static QString tagPath(const QString& name, int parentId);
 
49
    static void    makeFaceTag(int tagId, const QString& fullName);
 
50
    static int     findFirstTagWithProperty(const QString& property, const QString& value = QString());
 
51
    static int     tagForName(const QString& name, int tagId, int parentId,
 
52
                              const QString& givenFullName, bool convert, bool create);
53
53
};
54
54
 
55
55
// --- Private methods ---
86
86
}
87
87
 
88
88
int FaceTagsHelper::tagForName(const QString& name, int tagId, int parentId, const QString& givenFullName,
89
 
                          bool convert, bool create)
 
89
                               bool convert, bool create)
90
90
{
91
91
    if (name.isEmpty() && givenFullName.isEmpty() && !tagId)
92
92
    {
119
119
 
120
120
    // First attempt: Find by full name in "person" attribute
121
121
    QList<int> candidates = TagsCache::instance()->tagsWithProperty(TagPropertyName::person(), fullName);
 
122
 
122
123
    foreach(int id, candidates)
123
124
    {
124
125
        kDebug() << "Candidate with set full name:" << id << fullName;
275
276
{
276
277
    // check default
277
278
    QString i18nName = i18nc("People on your photos", "People");
278
 
    int tagId = TagsCache::instance()->tagForPath(i18nName);
 
279
    int tagId        = TagsCache::instance()->tagForPath(i18nName);
 
280
 
279
281
    if (tagId)
280
282
    {
281
283
        return tagId;
283
285
 
284
286
    // employ a heuristic
285
287
    QList<int> personTags = allPersonTags();
 
288
 
286
289
    if (!personTags.isEmpty())
287
290
    {
288
291
        // we find the most toplevel parent tag of a person tag
312
315
        return ids.first();
313
316
    }
314
317
 
315
 
    int unknownPersonTagId = TagsCache::instance()->getOrCreateTag(FaceTagsHelper::tagPath(
316
 
          i18nc("The list of detected faces from the collections but not recognized", "Unknown"),
317
 
          personParentTag())
318
 
        );
 
318
    int unknownPersonTagId = TagsCache::instance()->getOrCreateTag(
 
319
                                        FaceTagsHelper::tagPath(
 
320
                                        i18nc("The list of detected faces from the collections but not recognized", "Unknown"),
 
321
                                        personParentTag()));
319
322
    TagProperties props(unknownPersonTagId);
320
 
    props.setProperty(TagPropertyName::person(), QString()); // no name associated
 
323
    props.setProperty(TagPropertyName::person(), QString());        // no name associated
321
324
    props.setProperty(TagPropertyName::unknownPerson(), QString()); // special property
322
325
 
323
326
    return unknownPersonTagId;
324
327
}
325
328
 
326
 
 
327
329
} // Namespace Digikam