[Digikam-devel] [Bug 145227] change ratings via short-cuts in the light-table
Gilles Caulier
caulier.gilles at gmail.com
Thu May 10 13:01:21 BST 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=145227
------- Additional Comments From caulier.gilles gmail com 2007-05-10 14:01 -------
SVN commit 663174 by cgilles:
digikam from trunk : Light Table : to be able to assign Rating directly by thumbbar pop-up menu.
CCBUGS: 145227
M +31 -1 lighttablebar.cpp
M +1 -0 lighttablebar.h
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.cpp #663173:663174
@ -42,6 +42,8 @
#include "albumsettings.h"
#include "dragobjects.h"
#include "imageattributeswatch.h"
+#include "metadatahub.h"
+#include "ratingpopupmenu.h"
#include "themeengine.h"
#include "lighttablebar.h"
#include "lighttablebar.moc"
@ -109,15 +111,27 @
LightTableBarItem *item = findItemByPos(e->pos());
if (!item) return;
+ RatingPopupMenu *ratingMenu = 0;
+
if (e->button() == Qt::RightButton)
{
KPopupMenu popmenu(this);
popmenu.insertTitle(SmallIcon("digikam"), i18n("My Light Table"));
popmenu.insertItem(SmallIcon("previous"), i18n("Show on left panel"), 10);
popmenu.insertItem(SmallIcon("next"), i18n("Show on right panel"), 11);
- popmenu.insertSeparator(-1);
+ popmenu.insertSeparator();
popmenu.insertItem(SmallIcon("fileclose"), i18n("Remove"), 12);
+ popmenu.insertSeparator();
+ // Assign Star Rating -------------------------------------------
+
+ ratingMenu = new RatingPopupMenu();
+
+ connect(ratingMenu, SIGNAL(activated(int)),
+ this, SLOT(slotAssignRating(int)));
+
+ popmenu.insertItem(i18n("Assign Rating"), ratingMenu);
+
switch(popmenu.exec(pos))
{
case 10:
@ -141,8 +155,24 @
break;
}
}
+
+ delete ratingMenu;
}
+void LightTableBar::slotAssignRating(int rating)
+{
+ rating = QMIN(5, QMAX(0, rating));
+ ImageInfo *info = currentItemImageInfo();
+ if (info)
+ {
+ MetadataHub hub;
+ hub.load(info);
+ hub.setRating(rating);
+ hub.write(info, MetadataHub::PartialWrite);
+ hub.write(info->filePath(), MetadataHub::FullWriteIfChanged);
+ }
+}
+
void LightTableBar::setOnLeftPanel(const ImageInfo* info)
{
if (!info) return;
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #663173:663174
@ -87,6 +87,7 @
void slotImageRatingChanged(Q_LLONG);
void slotItemSelected(ThumbBarItem*);
+ void slotAssignRating(int);
private:
More information about the Digikam-devel
mailing list