Bug 123646 - rating image with a keyboard shortcut
Summary: rating image with a keyboard shortcut
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Usability-Keyboard (show other bugs)
Version: 0.8.1
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-15 04:36 UTC by Paulo Eduardo Neves
Modified: 2017-08-02 17:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.0
Sentry Crash Report:


Attachments
Rating By Shortcut patch (4.57 KB, patch)
2006-03-17 10:07 UTC, Loïc Brarda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Eduardo Neves 2006-03-15 04:36:22 UTC
Version:           0.8.1 (using KDE 3.4.3, Gentoo)
Compiler:          gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.12-gentoo-r10

I'd like to be able to rate the images with a keyboard shortcut. It would be even better to do it during a slide show. Just press a key to select a photo as a good one.
Comment 1 Chris Peikert 2006-03-15 15:53:43 UTC
A way to rate pictures in more viewing environments would be very nice.  As it is, I can't even rate my pictures when viewing them in the external window.  This is very inconvenient -- the only way to tell if the picture is good is by viewing it in a large size, but then I have to go back to the thumbnail to rate it.  Thanks!
Comment 2 caulier.gilles 2006-03-15 21:46:07 UTC
I think that the sidebar in Image editor will solve this problem. This will done with digiKam 0.9.0.

Take a look here :

http://www.digikam.org/?q=image/tid/10

Gilles Caulier
Comment 3 Loïc Brarda 2006-03-17 10:07:45 UTC
Created attachment 15158 [details]
Rating By Shortcut patch
Comment 4 Loïc Brarda 2006-03-17 10:12:39 UTC
I modified Digikam 8.1 last week to do that (I had a lot of pictures I wanted to rate). I just send the patch (http://bugs.kde.org/attachment.cgi?id=15158&action=view).
The defaults shortcuts should probably be changed to use 1..5 but as 1..3 where already used to rotate the pictures, I just used free shortcuts)

You also may be interested in a new version of the jpeg kfile plugin I made which shows IPTC tags with the libiptcdata library. You can find it there :
http://lbrarda.free.fr/kfile_jpeg_iptc.html
Comment 5 Tom Albers 2006-03-17 10:17:22 UTC
I have no objections to the patch, although the shortcut should change to ctrl-1 to 5 probably. I thought rotating was 7,8,9, but maybe i'm mistaken, but if it is, then 1-5 I would prefer.
Comment 6 caulier.gilles 2006-03-20 13:05:49 UTC
SVN commit 520580 by cgilles:

digikam from trunk : Rating image using keyboard shortcuts CTRL+0/1/2/3/4/5 from main interface

TODO : 
- do the same rules under image editor
- add interraction between Image Editor and Main Interface.

CCMAIL: digikam-devel@kde.org
CCBUGS: 123646

 M  +30 -0     albumiconview.cpp  
 M  +9 -3      albumiconview.h  
 M  +21 -0     digikamapp.cpp  
 M  +50 -43    digikamapp.h  
 M  +35 -0     digikamview.cpp  
 M  +26 -15    digikamview.h  
Comment 7 caulier.gilles 2006-03-20 13:37:01 UTC
SVN commit 520584 by cgilles:

digikam from stable : Rating image using keyboard shortcuts CTRL+0/1/2/3/4/5 from main interface

CCMAIL: digikam-devel@kde.org
CCBUGS: 123646

 M  +30 -0     digikam/albumiconview.cpp  
 M  +9 -3      digikam/albumiconview.h  
 M  +21 -0     digikam/digikamapp.cpp  
 M  +7 -0      digikam/digikamapp.h  
 M  +35 -0     digikam/digikamview.cpp  
 M  +10 -1     digikam/digikamview.h  
 M  +1 -0      libs/histogram/imagehistogram.cpp  


--- branches/stable/extragear/graphics/digikam/digikam/albumiconview.cpp #520583:520584
@@ -1688,6 +1688,36 @@
     triggerUpdate();
 }
 
+void AlbumIconView::slotAssignRatingNoStar()
+{
+    slotAssignRating(0);
+}
+
+void AlbumIconView::slotAssignRatingOneStar()
+{
+    slotAssignRating(1);
+}
+
+void AlbumIconView::slotAssignRatingTwoStar()
+{
+    slotAssignRating(2);
+}
+
+void AlbumIconView::slotAssignRatingThreeStar()
+{
+    slotAssignRating(3);
+}
+
+void AlbumIconView::slotAssignRatingFourStar()
+{
+    slotAssignRating(4);
+}
+
+void AlbumIconView::slotAssignRatingFiveStar()
+{
+    slotAssignRating(5);
+}
+
 void AlbumIconView::slotDIOResult(KIO::Job* job)
 {
     if (job->error())
--- branches/stable/extragear/graphics/digikam/digikam/albumiconview.h #520583:520584
@@ -152,8 +152,6 @@
     void slotAssignTag(int tagID);
     void slotRemoveTag(int tagID);
 
-    void slotAssignRating(int rating);
-    
     void slotDIOResult(KIO::Job* job);
     
 public slots:
@@ -168,7 +166,15 @@
     void slotSetAlbumThumbnail(AlbumIconItem *iconItem);
     void slotCopy();
     void slotPaste();
-    
+
+    void slotAssignRating(int rating);
+    void slotAssignRatingNoStar();
+    void slotAssignRatingOneStar();
+    void slotAssignRatingTwoStar();
+    void slotAssignRatingThreeStar();
+    void slotAssignRatingFourStar();
+    void slotAssignRatingFiveStar();
+        
 signals:
 
     void signalItemsAdded();
--- branches/stable/extragear/graphics/digikam/digikam/digikamapp.cpp #520583:520584
@@ -588,6 +588,27 @@
                                    actionCollection(),
                                    "gamma_adjustment");
 
+    // -- Rating actions ---------------------------------------------------------------
+
+    m_0Star = new KAction(i18n("No Star"), CTRL+Key_0,
+                          mView, SLOT(slotAssignRatingNoStar()),
+                          actionCollection(), "imageview_ratenostar");
+    m_1Star = new KAction(i18n("One Star"), CTRL+Key_1,
+                          mView, SLOT(slotAssignRatingOneStar()),
+                          actionCollection(), "imageview_rateonestar");
+    m_2Star = new KAction(i18n("Two Star"), CTRL+Key_2, 
+                          mView, SLOT(slotAssignRatingTwoStar()),
+                          actionCollection(), "imageview_ratetwostar");
+    m_3Star = new KAction(i18n("Three Star"), CTRL+Key_3, 
+                          mView, SLOT(slotAssignRatingThreeStar()),
+                          actionCollection(), "imageview_ratethreestar");
+    m_4Star = new KAction(i18n("Four Star"), CTRL+Key_4, 
+                          mView, SLOT(slotAssignRatingFourStar()),
+                          actionCollection(), "imageview_ratefourstar");
+    m_5Star = new KAction(i18n("Five Star"), CTRL+Key_5, 
+                          mView, SLOT(slotAssignRatingFiveStar()),
+                          actionCollection(), "imageview_ratefivestar");
+                          
     // -----------------------------------------------------------
 
     KAction* findAction = KStdAction::find(mView, SLOT(slotNewQuickSearch()),
--- branches/stable/extragear/graphics/digikam/digikam/digikamapp.h #520583:520584
@@ -190,6 +190,13 @@
     KAction       *mThumbSizeMinusAction;
     KAction       *mFullScreenAction;
 
+    KAction               *m_0Star;
+    KAction               *m_1Star;
+    KAction               *m_2Star;
+    KAction               *m_3Star;
+    KAction               *m_4Star;
+    KAction               *m_5Star;
+
     // Application Actions
     KAction       *mQuitAction;
     KAction       *mTipAction;
--- branches/stable/extragear/graphics/digikam/digikam/digikamview.cpp #520583:520584
@@ -682,4 +682,39 @@
     mSearchFolderView->setActive(w == mSearchFolderView);
 }
 
+void DigikamView::slotAssignRating(int rating)
+{
+    mIconView->slotAssignRating(rating);
+}
+
+void DigikamView::slotAssignRatingNoStar()
+{
+    mIconView->slotAssignRatingNoStar();
+}
+
+void DigikamView::slotAssignRatingOneStar()
+{
+    mIconView->slotAssignRatingOneStar();
+}
+
+void DigikamView::slotAssignRatingTwoStar()
+{
+    mIconView->slotAssignRatingTwoStar();
+}
+
+void DigikamView::slotAssignRatingThreeStar()
+{
+    mIconView->slotAssignRatingThreeStar();
+}
+
+void DigikamView::slotAssignRatingFourStar()
+{
+    mIconView->slotAssignRatingFourStar();
+}
+
+void DigikamView::slotAssignRatingFiveStar()
+{
+    mIconView->slotAssignRatingFiveStar();
+}
+
 #include "digikamview.moc"
--- branches/stable/extragear/graphics/digikam/digikam/digikamview.h #520583:520584
@@ -133,7 +133,16 @@
     void slotSortImages(int order);
 
     void slot_albumSelected(Album* album);
-    
+
+    // Image Rating slots
+    void slotAssignRating(int rating);
+    void slotAssignRatingNoStar();
+    void slotAssignRatingOneStar();
+    void slotAssignRatingTwoStar();
+    void slotAssignRatingThreeStar();
+    void slotAssignRatingFourStar();
+    void slotAssignRatingFiveStar();
+        
 private slots:
 
     void slotAllAlbumsLoaded();
--- branches/stable/extragear/graphics/digikam/libs/histogram/imagehistogram.cpp #520583:520584
@@ -110,6 +110,7 @@
        postProgress(true, false);
         
     m_histogram = new double_packet[256];
+    memset(m_histogram, 0, 256*sizeof(double_packet));
     
     if ( !m_histogram )
        {
Comment 8 caulier.gilles 2006-03-20 14:52:31 UTC
SVN commit 520603 by cgilles:

digikam from trunk : Rating image using keyboard shortcuts CTRL+0/1/2/3/4/5 from Image Editor

CCMAIL: digikam-devel@kde.org
CCBUGS: 123646

 M  +7 -7      digikam/digikamview.cpp  
 M  +2 -2      digikam/ratingwidget.cpp  
 M  +8 -3      libs/imageproperties/imagedescedittab.cpp  
 M  +2 -1      libs/imageproperties/imagedescedittab.h  
 M  +35 -0     libs/imageproperties/imagepropertiessidebardb.cpp  
 M  +9 -1      libs/imageproperties/imagepropertiessidebardb.h  
 M  +23 -0     utilities/imageeditor/editor/imagewindow.cpp  
 M  +8 -0      utilities/imageeditor/editor/imagewindow.h  


--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #520602:520603
@@ -746,37 +746,37 @@
 
 void DigikamView::slotAssignRating(int rating)
 {
-    mIconView->slotAssignRating(rating);
+    mRightSidebar->slotAssignRating(rating);
 }
 
 void DigikamView::slotAssignRatingNoStar()
 {
-    mIconView->slotAssignRatingNoStar();
+    mRightSidebar->slotAssignRating(0);
 }
 
 void DigikamView::slotAssignRatingOneStar()
 {
-    mIconView->slotAssignRatingOneStar();
+    mRightSidebar->slotAssignRating(1);
 }
 
 void DigikamView::slotAssignRatingTwoStar()
 {
-    mIconView->slotAssignRatingTwoStar();
+    mRightSidebar->slotAssignRating(2);
 }
 
 void DigikamView::slotAssignRatingThreeStar()
 {
-    mIconView->slotAssignRatingThreeStar();
+    mRightSidebar->slotAssignRating(3);
 }
 
 void DigikamView::slotAssignRatingFourStar()
 {
-    mIconView->slotAssignRatingFourStar();
+    mRightSidebar->slotAssignRating(4);
 }
 
 void DigikamView::slotAssignRatingFiveStar()
 {
-    mIconView->slotAssignRatingFiveStar();
+    mRightSidebar->slotAssignRating(5);
 }
 
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/digikam/ratingwidget.cpp #520602:520603
@@ -37,7 +37,7 @@
 {
 
 RatingWidget::RatingWidget(QWidget* parent)
-    : QWidget(parent)
+            : QWidget(parent)
 {
     m_rating = 0;    
 
@@ -69,12 +69,12 @@
 
 RatingWidget::~RatingWidget()
 {
-    
 }
 
 void RatingWidget::setRating(int val)
 {
     m_rating = val;
+    emit signalRatingChanged(m_rating);
     update();
 }
 
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #520602:520603
@@ -275,7 +275,7 @@
 
 ImageDescEditTab::~ImageDescEditTab()
 {
-    applyChanges();
+    applyAllChanges();
     
     /*
     AlbumList tList = AlbumManager::instance()->allTAlbums();
@@ -355,8 +355,13 @@
     d->modified = true;
 }
 
-void ImageDescEditTab::applyChanges()
+void ImageDescEditTab::assignRating(int rating)
 {
+    d->ratingWidget->setRating(rating);
+}
+
+void ImageDescEditTab::applyAllChanges()
+{
     if (!d->modified)
         return;
     
@@ -404,7 +409,7 @@
 
 void ImageDescEditTab::setItem(AlbumIconItem* currItem, int itemType)
 {
-    applyChanges();
+    applyAllChanges();
     
     if (!currItem)
     {
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h #520602:520603
@@ -68,6 +68,7 @@
     ImageDescEditTab(QWidget *parent, bool navBar=true);
     ~ImageDescEditTab();
 
+    void assignRating(int rating);
     void setItem(AlbumIconItem* currItem=0, int itemType=0);
     void populateTags();
         
@@ -84,7 +85,7 @@
 
 private:    
 
-    void applyChanges();
+    void applyAllChanges();
 
     void tagNew(TAlbum* parAlbum);
     void tagEdit(TAlbum* album);
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp #520602:520603
@@ -221,6 +221,41 @@
     setCursor( KCursor::arrowCursor() );
 }
 
+void ImagePropertiesSideBarDB::slotAssignRating(int rating)
+{
+    d->desceditTab->assignRating(rating);
+}
+
+void ImagePropertiesSideBarDB::slotAssignRatingNoStar()
+{
+    d->desceditTab->assignRating(0);
+}
+
+void ImagePropertiesSideBarDB::slotAssignRatingOneStar()
+{
+    d->desceditTab->assignRating(1);
+}
+
+void ImagePropertiesSideBarDB::slotAssignRatingTwoStar()
+{
+    d->desceditTab->assignRating(2);
+}
+
+void ImagePropertiesSideBarDB::slotAssignRatingThreeStar()
+{
+    d->desceditTab->assignRating(3);
+}
+
+void ImagePropertiesSideBarDB::slotAssignRatingFourStar()
+{
+    d->desceditTab->assignRating(4);
+}
+
+void ImagePropertiesSideBarDB::slotAssignRatingFiveStar()
+{
+    d->desceditTab->assignRating(5);
+}
+
 }  // NameSpace Digikam
 
 #include "imagepropertiessidebardb.moc"
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.h #520602:520603
@@ -68,7 +68,15 @@
                                    
 public slots:
 
-    virtual void slotNoCurrentItem(void);                               
+    void slotAssignRating(int rating);
+    void slotAssignRatingNoStar();
+    void slotAssignRatingOneStar();
+    void slotAssignRatingTwoStar();
+    void slotAssignRatingThreeStar();
+    void slotAssignRatingFourStar();
+    void slotAssignRatingFiveStar();
+    
+    virtual void slotNoCurrentItem(void);
 
 private slots:
 
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #520602:520603
@@ -216,6 +216,29 @@
 {
     setupStandardActions();
 
+    // -- Rating actions ---------------------------------------------------------------
+
+    m_0Star = new KAction(i18n("No Star"), CTRL+Key_0,
+                          m_rightSidebar, SLOT(slotAssignRatingNoStar()),
+                          actionCollection(), "imageview_ratenostar");
+    m_1Star = new KAction(i18n("One Star"), CTRL+Key_1,
+                          m_rightSidebar, SLOT(slotAssignRatingOneStar()),
+                          actionCollection(), "imageview_rateonestar");
+    m_2Star = new KAction(i18n("Two Star"), CTRL+Key_2, 
+                          m_rightSidebar, SLOT(slotAssignRatingTwoStar()),
+                          actionCollection(), "imageview_ratetwostar");
+    m_3Star = new KAction(i18n("Three Star"), CTRL+Key_3, 
+                          m_rightSidebar, SLOT(slotAssignRatingThreeStar()),
+                          actionCollection(), "imageview_ratethreestar");
+    m_4Star = new KAction(i18n("Four Star"), CTRL+Key_4, 
+                          m_rightSidebar, SLOT(slotAssignRatingFourStar()),
+                          actionCollection(), "imageview_ratefourstar");
+    m_5Star = new KAction(i18n("Five Star"), CTRL+Key_5, 
+                          m_rightSidebar, SLOT(slotAssignRatingFiveStar()),
+                          actionCollection(), "imageview_ratefivestar");
+
+    // ---------------------------------------------------------------------------------
+
     createGUI("digikamimagewindowui.rc", false);
 
     setupStandardAccelerators();
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.h #520602:520603
@@ -76,6 +76,14 @@
     
     KURL::List                m_urlList;
     KURL                      m_urlCurrent;
+
+    // Rating actions.
+    KAction                  *m_0Star;
+    KAction                  *m_1Star;
+    KAction                  *m_2Star;
+    KAction                  *m_3Star;
+    KAction                  *m_4Star;
+    KAction                  *m_5Star;
     
     // Allow to use Image properties and
     // Comments/Tags dialogs from main window.
Comment 9 caulier.gilles 2006-04-03 15:50:05 UTC
Features implemented. I close this file.

Gilles Caulier