[Digikam-devel] [Bug 152424] Workflow organizing : use Color Label Tags over icon view items

Gilles Caulier caulier.gilles at gmail.com
Tue Feb 1 08:49:08 CET 2011


https://bugs.kde.org/show_bug.cgi?id=152424





--- Comment #47 from Gilles Caulier <caulier gilles gmail com>  2011-02-01 08:49:05 ---
SVN commit 1218197 by cgilles:

2 new methods to handle Color Label information from digiKam XMP namespace


 M  +56 -2     dmetadata.cpp
 M  +5 -2      dmetadata.h


--- branches/extragear/graphics/digikam/core/libs/dmetadata/dmetadata.cpp
#1218196:1218197
@@ -6,8 +6,8 @@
 * Date        : 2006-02-23
 * Description : image metadata interface
 *
- * Copyright (C) 2006-2010 by Gilles Caulier <caulier dot gilles at gmail dot
com>
- * Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot
de>
+ * Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot
com>
+ * Copyright (C) 2006-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot
de>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
@@ -358,6 +358,32 @@
    return true;
 }

+int DMetadata::getImageColorLabel() const
+{
+    if (getFilePath().isEmpty())
+    {
+        return -1;
+    }
+
+    if (hasXmp())
+    {
+        QString value = getXmpTagString("Xmp.digiKam.ColorLabel", false);
+
+        if (!value.isEmpty())
+        {
+            bool ok      = false;
+            long colorId = value.toLong(&ok);
+
+            if (ok && colorId >= NoneLabel && colorId <= WhiteLabel)
+            {
+                return colorId;
+            }
+        }
+    }
+
+    return -1;
+}
+
 int DMetadata::getImageRating() const
 {
    if (getFilePath().isEmpty())
@@ -500,6 +526,34 @@
    return -1;
 }

+bool DMetadata::setImageColorLabel(int colorId) const
+{
+    if (colorId < NoneLabel || colorId > WhiteLabel)
+    {
+        kDebug() << "Color Label value to write is out of range!";
+        return false;
+    }
+
+    kDebug() << getFilePath() << " ==> Color Label: " << colorId;
+
+    if (!setProgramId())
+    {
+        return false;
+    }
+
+    // Set standard XMP rating tag.
+
+    if (supportXmp())
+    {
+        if (!setXmpTagString("Xmp.digiKam.ColorLabel",
QString::number(colorId)))
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
 bool DMetadata::setImageRating(int rating) const
 {
    // NOTE : with digiKam 0.9.x, we have used IPTC Urgency to store Rating.
--- branches/extragear/graphics/digikam/core/libs/dmetadata/dmetadata.h
#1218196:1218197
@@ -6,8 +6,8 @@
 * Date        : 2006-02-23
 * Description : image metadata interface
 *
- * Copyright (C) 2006-2010 by Gilles Caulier <caulier dot gilles at gmail dot
com>
- * Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot
de>
+ * Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot
com>
+ * Copyright (C) 2006-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot
de>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
@@ -70,6 +70,9 @@
    CaptionsMap getImageComments() const;
    bool setImageComments(const CaptionsMap& comments) const;

+    int  getImageColorLabel() const;
+    bool setImageColorLabel(int colorId) const;
+
    int  getImageRating() const;
    bool setImageRating(int rating) const;

Répondre

Transférer


Répondre
|
Gilles Caulier
 à kde-commits

afficher les détails 08:39 (Il y a 2 minutes)

SVN commit 1218198 by cgilles:

new Color Label settings to handle action to do with image metadata


 M  +4 -2      metadatasettingscontainer.cpp
 M  +2 -1      metadatasettingscontainer.h


---
branches/extragear/graphics/digikam/core/libs/dmetadata/metadatasettingscontainer.cpp
#1218197:1218198
@@ -6,7 +6,7 @@
 * Date        : 2010-08-20
 * Description : Metadata Settings Container.
 *
- * Copyright (C) 2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2010-2011 by Gilles Caulier <caulier dot gilles at gmail dot
com>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
@@ -27,7 +27,6 @@

 #include <kconfiggroup.h>

-
 // LibKExiv2 includes

 #include <libkexiv2/kexiv2.h>
@@ -47,6 +46,7 @@
    exifSetOrientation    = true;
    saveComments          = false;
    saveDateTime          = false;
+    saveColorLabel        = false;
    saveRating            = false;
    saveTemplate          = false;
    saveTags              = false;
@@ -66,6 +66,7 @@

    saveComments          = group.readEntry("Save EXIF Comments",         
false);
    saveDateTime          = group.readEntry("Save Date Time",             
false);
+    saveColorLabel        = group.readEntry("Save Color Label",           
false);
    saveRating            = group.readEntry("Save Rating",                
false);

    writeRawFiles         = group.readEntry("Write RAW Files",            
false);
@@ -84,6 +85,7 @@

    group.writeEntry("Save EXIF Comments",          saveComments);
    group.writeEntry("Save Date Time",              saveDateTime);
+    group.writeEntry("Save Color Label",            saveColorLabel);
    group.writeEntry("Save Rating",                 saveRating);

    group.writeEntry("Write RAW Files",             writeRawFiles);
---
branches/extragear/graphics/digikam/core/libs/dmetadata/metadatasettingscontainer.h
#1218197:1218198
@@ -6,7 +6,7 @@
 * Date        : 2010-08-20
 * Description : Metadata Settings Container.
 *
- * Copyright (C) 2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2010-2011 by Gilles Caulier <caulier dot gilles at gmail dot
com>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
@@ -60,6 +60,7 @@

    bool saveComments;
    bool saveDateTime;
+    bool saveColorLabel;
    bool saveRating;

    bool saveTemplate;

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Digikam-devel mailing list