[Digikam-devel] extragear/graphics/digikam

Gilles Caulier caulier.gilles at free.fr
Mon Mar 20 13:52:06 GMT 2006


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 at 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.



More information about the Digikam-devel mailing list