Summary: | change ratings via short-cuts in the light-table | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Arnd Baecker <arnd.baecker> |
Component: | LightTable-Workflow | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Debian stable | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.2 | |
Sentry Crash Report: |
Description
Arnd Baecker
2007-05-09 15:32:38 UTC
I think the fact that the sidebar is open is not very intuitive. I suggest to highlight the selected images using some color in the thumbar and to highlight the master image using another color. Changes are applied to the master image. The master image could also be framed using some color. Here is how this problem is solved in iphoto : In iphoto the lighttable is presented like this : - This is not a separate window. - When in full screen mode, a list of thumbnails is displayed on the top of the screen. - When several thumbnails are selected using shift-click then the lighttable mode is activated. The lighttable is splitted according to the number of pictures to be compared. One on these pictures is "selected". When browsing the pictures (either by cliking on thumnails or by pressing left right keys), only the selected picture is changed. This allows to compare a set of given pictures with the other pictures. The selected thumbnails are shown on a grey background. SVN commit 663144 by cgilles: digikam from trunk : Light Table : Highlight the current image selected in thumbbar to right or left panel used a color frame around the preview. The current color scheme theme is used to draw the frame border. CCBUGS: 145227 M +37 -30 libs/themeengine/themeengine.cpp M +6 -2 libs/themeengine/themeengine.h M +1 -1 utilities/lighttable/lighttablebar.h M +21 -0 utilities/lighttable/lighttablepreview.cpp M +3 -0 utilities/lighttable/lighttablepreview.h M +35 -3 utilities/lighttable/lighttableview.cpp M +2 -0 utilities/lighttable/lighttableview.h M +16 -2 utilities/lighttable/lighttablewindow.cpp M +5 -2 utilities/lighttable/lighttablewindow.h --- trunk/extragear/graphics/digikam/libs/themeengine/themeengine.cpp #663143:663144 @@ -6,7 +6,8 @@ * Date : 2004-08-02 * Description : theme engine methods * - * Copyright (C) 2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2006-2007 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 @@ -50,6 +51,7 @@ #include "theme.h" #include "texture.h" #include "themeengine.h" +#include "themeengine.moc" namespace Digikam { @@ -201,40 +203,40 @@ t->textSpecialRegColor = QColor("#0000EF"); t->textSpecialSelColor = cg.highlightedText(); - t->bannerColor = cg.highlight(); - t->bannerColorTo = cg.highlight().dark(120); - t->bannerBevel = Theme::FLAT; - t->bannerGrad = Theme::SOLID; - t->bannerBorder = false; - t->bannerBorderColor = Qt::black; + t->bannerColor = cg.highlight(); + t->bannerColorTo = cg.highlight().dark(120); + t->bannerBevel = Theme::FLAT; + t->bannerGrad = Theme::SOLID; + t->bannerBorder = false; + t->bannerBorderColor = Qt::black; - t->thumbRegColor = cg.base(); - t->thumbRegColorTo = cg.base(); - t->thumbRegBevel = Theme::FLAT; - t->thumbRegGrad = Theme::SOLID; - t->thumbRegBorder = true; + t->thumbRegColor = cg.base(); + t->thumbRegColorTo = cg.base(); + t->thumbRegBevel = Theme::FLAT; + t->thumbRegGrad = Theme::SOLID; + t->thumbRegBorder = true; t->thumbRegBorderColor = QColor("#E0E0EF"); - t->thumbSelColor = cg.highlight(); - t->thumbSelColorTo = cg.highlight(); - t->thumbSelBevel = Theme::FLAT; - t->thumbSelGrad = Theme::SOLID; - t->thumbSelBorder = true; + t->thumbSelColor = cg.highlight(); + t->thumbSelColorTo = cg.highlight(); + t->thumbSelBevel = Theme::FLAT; + t->thumbSelGrad = Theme::SOLID; + t->thumbSelBorder = true; t->thumbSelBorderColor = QColor("#E0E0EF"); - t->listRegColor = cg.base(); - t->listRegColorTo = cg.base(); - t->listRegBevel = Theme::FLAT; - t->listRegGrad = Theme::SOLID; - t->listRegBorder = false; - t->listRegBorderColor = Qt::black; + t->listRegColor = cg.base(); + t->listRegColorTo = cg.base(); + t->listRegBevel = Theme::FLAT; + t->listRegGrad = Theme::SOLID; + t->listRegBorder = false; + t->listRegBorderColor = Qt::black; - t->listSelColor = cg.highlight(); - t->listSelColorTo = cg.highlight(); - t->listSelBevel = Theme::FLAT; - t->listSelGrad = Theme::SOLID; - t->listSelBorder = true; - t->listSelBorderColor = Qt::black; + t->listSelColor = cg.highlight(); + t->listSelColorTo = cg.highlight(); + t->listSelBevel = Theme::FLAT; + t->listSelGrad = Theme::SOLID; + t->listSelBorder = true; + t->listSelBorderColor = Qt::black; } void ThemeEngine::loadTheme() @@ -530,6 +532,11 @@ return d->currTheme->baseColor; } +QColor ThemeEngine::thumbSelColor() const +{ + return d->currTheme->thumbSelColor; +} + QColor ThemeEngine::textRegColor() const { return d->currTheme->textRegColor; @@ -592,4 +599,4 @@ } // NameSpace Digikam -#include "themeengine.moc" + --- trunk/extragear/graphics/digikam/libs/themeengine/themeengine.h #663143:663144 @@ -6,7 +6,8 @@ * Date : 2004-08-02 * Description : theme engine methods * - * Copyright (C) 2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2006-2007 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 @@ -56,11 +57,14 @@ void setCurrentTheme(const QString& name); Theme* getCurrentTheme(); - QColor baseColor() const; + QColor baseColor() const; + QColor thumbSelColor() const; + QColor textRegColor() const; QColor textSelColor() const; QColor textSpecialRegColor() const; QColor textSpecialSelColor() const; + QPixmap bannerPixmap(int w, int h); QPixmap thumbRegPixmap(int w, int h); QPixmap thumbSelPixmap(int w, int h); --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #663143:663144 @@ -80,7 +80,7 @@ private slots: - void slotItemSelected(ThumbBarItem* i); + void slotItemSelected(ThumbBarItem*); private: --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablepreview.cpp #663143:663144 @@ -31,6 +31,7 @@ #include <qtoolbutton.h> #include <qtooltip.h> #include <qpixmap.h> +#include <qdrawutil.h> // KDE includes. @@ -89,12 +90,14 @@ imageInfo = 0; hasPrev = false; hasNext = false; + selected = false; currentFitWindowZoom = 0; previewSize = 1024; } bool hasPrev; bool hasNext; + bool selected; int previewSize; @@ -143,6 +146,9 @@ QToolTip::add(d->cornerButton, i18n("Pan the image")); setCornerWidget(d->cornerButton); + setLineWidth(4); + setSelected(false); + // ------------------------------------------------------------ connect(d->cornerButton, SIGNAL(pressed()), @@ -514,6 +520,7 @@ void LightTablePreview::slotThemeChanged() { setBackgroundColor(ThemeEngine::instance()->baseColor()); + frameChanged(); } void LightTablePreview::slotCornerButtonPressed() @@ -698,4 +705,18 @@ } } +void LightTablePreview::setSelected(bool sel) +{ + d->selected = sel; + frameChanged(); +} + +void LightTablePreview::drawFrame(QPainter *p) +{ + if (d->selected) + qDrawPlainRect(p, frameRect(), ThemeEngine::instance()->thumbSelColor(), lineWidth()); + else + qDrawPlainRect(p, frameRect(), colorGroup().background(), lineWidth()); +} + } // NameSpace Digikam --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablepreview.h #663143:663144 @@ -66,6 +66,8 @@ void setImagePath(const QString& path=QString()); void setPreviousNextPaths(const QString& previous, const QString &next); + void setSelected(bool sel); + signals: void signalDroppedItems(const ImageInfoList&); @@ -77,6 +79,7 @@ protected: void resizeEvent(QResizeEvent* e); + void drawFrame(QPainter *p); private slots: --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.cpp #663143:663144 @@ -69,11 +69,11 @@ { d = new LightTableViewPriv; - setFrameStyle(QFrame::GroupBoxPanel|QFrame::Plain); + setFrameStyle(QFrame::NoFrame); setMargin(0); - setLineWidth(1); + setLineWidth(0); - d->grid = new QGridLayout(this, 1, 1, 0, KDialogBase::spacingHint()); + d->grid = new QGridLayout(this, 1, 1, 0, 1); d->leftPreview = new LightTablePreview(this); d->rightPreview = new LightTablePreview(this); @@ -346,5 +346,37 @@ emit signalToggleOnSyncPreview(d->syncPreview); } +void LightTableView::checkForSelection(ImageInfo* info) +{ + if (!info) + { + d->leftPreview->setSelected(false); + d->rightPreview->setSelected(false); + return; + } + + if (d->leftPreview->getImageInfo()) + { + KURL url1 = d->leftPreview->getImageInfo()->kurl(); + KURL url2 = info->kurl(); + + if (url1 == url2) + d->leftPreview->setSelected(true); + else + d->leftPreview->setSelected(false); + } + + if (d->rightPreview->getImageInfo()) + { + KURL url1 = d->rightPreview->getImageInfo()->kurl(); + KURL url2 = info->kurl(); + + if (url1 == url2) + d->rightPreview->setSelected(true); + else + d->rightPreview->setSelected(false); + } +} + } // namespace Digikam --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.h #663143:663144 @@ -61,6 +61,8 @@ void setLeftZoomFactor(double z); void setRightZoomFactor(double z); + void checkForSelection(ImageInfo* info); + double leftZoomMax(); double leftZoomMin(); --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #663143:663144 @@ -341,10 +341,10 @@ this, SLOT(slotToggleOnSyncPreview(bool))); connect(d->previewView, SIGNAL(signalLeftPreviewLoaded(bool)), - d->leftZoomBar, SLOT(setEnabled(bool))); + this, SLOT(slotLeftPreviewLoaded(bool))); connect(d->previewView, SIGNAL(signalRightPreviewLoaded(bool)), - d->rightZoomBar, SLOT(setEnabled(bool))); + this, SLOT(slotRightPreviewLoaded(bool))); ImageAttributesWatch *watch = ImageAttributesWatch::instance(); @@ -523,6 +523,18 @@ } } +void LightTableWindow::slotLeftPreviewLoaded(bool b) +{ + d->leftZoomBar->setEnabled(b); + d->previewView->checkForSelection(d->barView->currentItemImageInfo()); +} + +void LightTableWindow::slotRightPreviewLoaded(bool b) +{ + d->rightZoomBar->setEnabled(b); + d->previewView->checkForSelection(d->barView->currentItemImageInfo()); +} + void LightTableWindow::slotFileMetadataChanged(const KURL &/*url*/) { // TODO ??? @@ -544,6 +556,8 @@ d->removeItemAction->setEnabled(false); d->clearListAction->setEnabled(false); } + + d->previewView->checkForSelection(info); } void LightTableWindow::slotLeftDroppedItems(const ImageInfoList& list) --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.h #663143:663144 @@ -92,14 +92,17 @@ void slotLeftDroppedItems(const ImageInfoList&); void slotRightDroppedItems(const ImageInfoList&); + void slotLeftPreviewLoaded(bool); + void slotRightPreviewLoaded(bool); + void slotLeftZoomFactorChanged(double); void slotRightZoomFactorChanged(double); void slotToggleOnSyncPreview(bool); void slotToggleSyncPreview(); - void slotEditItem(ImageInfo* info); - void slotDeleteItem(ImageInfo* info); + void slotEditItem(ImageInfo*); + void slotDeleteItem(ImageInfo*); void slotItemSelected(ImageInfo*); void slotClearItemsList(); SVN commit 663163 by cgilles: digikam from trunk : Light Table : add an icon over the thumbbar icon to indicate the position of image on Left or Right panel. CCBUGS: 145227 M +76 -9 lighttablebar.cpp M +12 -1 lighttablebar.h M +10 -0 lighttablewindow.cpp --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.cpp #663162:663163 @@ -107,6 +107,36 @@ } } +void LightTableBar::setOnLeftPanel(const ImageInfo* info) +{ + if (!info) return; + + for (ThumbBarItem *item = firstItem(); item; item = item->next()) + { + KURL url1 = item->url(); + KURL url2 = info->kurl(); + LightTableBarItem *ltItem = static_cast<LightTableBarItem*>(item); + ltItem->setOnLeftPanel(url1 == url2); + } + + triggerUpdate(); +} + +void LightTableBar::setOnRightPanel(const ImageInfo* info) +{ + if (!info) return; + + for (ThumbBarItem *item = firstItem(); item; item = item->next()) + { + KURL url1 = item->url(); + KURL url2 = info->kurl(); + LightTableBarItem *ltItem = static_cast<LightTableBarItem*>(item); + ltItem->setOnRightPanel(url1 == url2); + } + + triggerUpdate(); +} + void LightTableBar::slotItemSelected(ThumbBarItem* i) { if (i) @@ -148,18 +178,20 @@ LightTableBarItem* LightTableBar::findItemByInfo(const ImageInfo* info) const { - for (ThumbBarItem *item = firstItem(); item; item = item->next()) + if (info) { - KURL url1 = item->url(); - KURL url2 = info->kurl(); - - if (url1 == url2) + for (ThumbBarItem *item = firstItem(); item; item = item->next()) { - LightTableBarItem *ltItem = static_cast<LightTableBarItem*>(item); - return ltItem; + KURL url1 = item->url(); + KURL url2 = info->kurl(); + + if (url1 == url2) + { + LightTableBarItem *ltItem = static_cast<LightTableBarItem*>(item); + return ltItem; + } } } - return 0; } @@ -281,6 +313,19 @@ int x = (tile.width() - pix.width())/2; int y = (tile.height()- pix.height())/2; bitBlt(&tile, x, y, &pix); + + LightTableBarItem *ltItem = static_cast<LightTableBarItem*>(item); + + if (ltItem->getOnLeftPanel()) + { + QPixmap lPix = SmallIcon("previous"); + bitBlt(&tile, getMargin(), getMargin(), &lPix); + } + if (ltItem->getOnRightPanel()) + { + QPixmap rPix = SmallIcon("next"); + bitBlt(&tile, tile.width() - getMargin() - rPix.width(), getMargin(), &rPix); + } } bitBlt(&bgPix, item->position() - cx, 0, &tile); @@ -381,7 +426,9 @@ LightTableBarItem::LightTableBarItem(LightTableBar *view, ImageInfo *info) : ThumbBarItem(view, info->kurl()) { - m_info = info; + m_info = info; + m_onLeftPanel = false; + m_onRightPanel = false; } LightTableBarItem::~LightTableBarItem() @@ -393,6 +440,26 @@ return m_info; } +void LightTableBarItem::setOnLeftPanel(bool on) +{ + m_onLeftPanel = on; +} + +void LightTableBarItem::setOnRightPanel(bool on) +{ + m_onRightPanel = on; +} + +bool LightTableBarItem::getOnLeftPanel() const +{ + return m_onLeftPanel; +} + +bool LightTableBarItem::getOnRightPanel() const +{ + return m_onRightPanel; +} + // ------------------------------------------------------------------------- LightTableBarToolTip::LightTableBarToolTip(ThumbBarView* parent) --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #663162:663163 @@ -63,6 +63,9 @@ /** Read tool tip settings from Album Settings instance */ void readToolTipSettings(); + void setOnLeftPanel(const ImageInfo* info); + void setOnRightPanel(const ImageInfo* info); + signals: void signalLightTableBarItemSelected(ImageInfo*); @@ -101,10 +104,18 @@ ~LightTableBarItem(); ImageInfo* info(); + + void setOnLeftPanel(bool on); + void setOnRightPanel(bool on); + bool getOnLeftPanel() const; + bool getOnRightPanel() const; private: - ImageInfo *m_info; + bool m_onLeftPanel; + bool m_onRightPanel; + + ImageInfo *m_info; friend class LightTableBar; }; --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #663162:663163 @@ -527,12 +527,22 @@ { d->leftZoomBar->setEnabled(b); d->previewView->checkForSelection(d->barView->currentItemImageInfo()); + d->barView->setOnLeftPanel(d->previewView->leftImageInfo()); + + LightTableBarItem *item = d->barView->findItemByInfo(d->previewView->leftImageInfo()); + if (item) item->setOnLeftPanel(true); + d->barView->update(); } void LightTableWindow::slotRightPreviewLoaded(bool b) { d->rightZoomBar->setEnabled(b); d->previewView->checkForSelection(d->barView->currentItemImageInfo()); + d->barView->setOnRightPanel(d->previewView->rightImageInfo()); + + LightTableBarItem *item = d->barView->findItemByInfo(d->previewView->rightImageInfo()); + if (item) item->setOnRightPanel(true); + d->barView->update(); } void LightTableWindow::slotFileMetadataChanged(const KURL &/*url*/) SVN commit 663170 by cgilles: digikam from trunk : Light Table : to be abble to display rating information over over the thumbbar icons. CCBUGS: 145227 M +8 -8 project/digikam.kdevelop M +66 -1 utilities/lighttable/lighttablebar.cpp M +7 -2 utilities/lighttable/lighttablebar.h --- trunk/extragear/graphics/digikam/project/digikam.kdevelop #663169:663170 @@ -12,7 +12,7 @@ </keywords> <projectdirectory>./</projectdirectory> <absoluteprojectpath>false</absoluteprojectpath> - <description></description> + <description/> <ignoreparts/> <projectname>digikam</projectname> <defaultencoding/> @@ -74,11 +74,11 @@ <kdevdebugger> <general> <dbgshell>libtool</dbgshell> - <programargs></programargs> - <gdbpath></gdbpath> - <configGdbScript></configGdbScript> - <runShellScript></runShellScript> - <runGdbScript></runGdbScript> + <programargs/> + <gdbpath/> + <configGdbScript/> + <runShellScript/> + <runGdbScript/> <breakonloadinglibs>true</breakonloadinglibs> <separatetty>false</separatetty> <floatingtoolbar>false</floatingtoolbar> @@ -114,7 +114,7 @@ <directoryradio>build</directoryradio> <customdirectory>/</customdirectory> <mainprogram>digikam/digikam/digikam</mainprogram> - <programargs></programargs> + <programargs/> <terminal>false</terminal> <autocompile>false</autocompile> <envvars/> @@ -192,7 +192,7 @@ <includePaths>.;</includePaths> </codecompletion> <creategettersetter> - <prefixGet></prefixGet> + <prefixGet/> <prefixSet>set</prefixSet> <prefixVariable>m_,_</prefixVariable> <parameterName>theValue</parameterName> --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.cpp #663169:663170 @@ -32,6 +32,8 @@ #include <klocale.h> #include <kpopupmenu.h> #include <kiconloader.h> +#include <kglobal.h> +#include <kstandarddirs.h> // Local includes. @@ -39,6 +41,7 @@ #include "album.h" #include "albumsettings.h" #include "dragobjects.h" +#include "imageattributeswatch.h" #include "themeengine.h" #include "lighttablebar.h" #include "lighttablebar.moc" @@ -57,7 +60,27 @@ this, SLOT(slotUpdate())); connect(this, SIGNAL(signalItemSelected(ThumbBarItem*)), - this, SLOT(slotItemSelected(ThumbBarItem*))); + this, SLOT(slotItemSelected(ThumbBarItem*))); + + // -- Load rating Pixmap ------------------------------------------ + + KGlobal::dirs()->addResourceType("digikam_rating", KGlobal::dirs()->kde_default("data") + + "digikam/data"); + QString ratingPixPath = KGlobal::dirs()->findResourceDir("digikam_rating", "rating.png"); + ratingPixPath += "/rating.png"; + m_ratingPixmap = QPixmap(ratingPixPath); + + QPainter painter(&m_ratingPixmap); + painter.fillRect(0, 0, m_ratingPixmap.width(), m_ratingPixmap.height(), + ThemeEngine::instance()->textSpecialRegColor()); + painter.end(); + + // ---------------------------------------------------------------- + + ImageAttributesWatch *watch = ImageAttributesWatch::instance(); + + connect(watch, SIGNAL(signalImageRatingChanged(Q_LLONG)), + this, SLOT(slotImageRatingChanged(Q_LLONG))); } LightTableBar::~LightTableBar() @@ -65,6 +88,19 @@ delete m_toolTip; } +void LightTableBar::slotImageRatingChanged(Q_LLONG imageId) +{ + for (ThumbBarItem *item = firstItem(); item; item = item->next()) + { + LightTableBarItem *ltItem = static_cast<LightTableBarItem*>(item); + if (ltItem->info()->id() == imageId) + { + triggerUpdate(); + return; + } + } +} + void LightTableBar::contentsMouseReleaseEvent(QMouseEvent *e) { if (!e) return; @@ -286,6 +322,27 @@ int x = (tile.width() - pix.width())/2; int y = (tile.height() - pix.height())/2; bitBlt(&tile, x, y, &pix); + + LightTableBarItem *ltItem = static_cast<LightTableBarItem*>(item); + + if (ltItem->getOnLeftPanel()) + { + QPixmap lPix = SmallIcon("previous"); + bitBlt(&tile, getMargin(), getMargin(), &lPix); + } + if (ltItem->getOnRightPanel()) + { + QPixmap rPix = SmallIcon("next"); + bitBlt(&tile, tile.width() - getMargin() - rPix.width(), getMargin(), &rPix); + } + + QRect r(0, tile.height()-getMargin()-m_ratingPixmap.height(), + tile.width(), m_ratingPixmap.height()); + int rating = ltItem->info()->rating(); + int xr = (r.width() - rating * m_ratingPixmap.width())/2; + int wr = rating * m_ratingPixmap.width(); + QPainter p(&tile); + p.drawTiledPixmap(xr, r.y(), wr, r.height(), m_ratingPixmap); } bitBlt(&bgPix, 0, item->position() - cy, &tile); @@ -326,6 +383,14 @@ QPixmap rPix = SmallIcon("next"); bitBlt(&tile, tile.width() - getMargin() - rPix.width(), getMargin(), &rPix); } + + QRect r(0, tile.height()-getMargin()-m_ratingPixmap.height(), + tile.width(), m_ratingPixmap.height()); + int rating = ltItem->info()->rating(); + int xr = (r.width() - rating * m_ratingPixmap.width())/2; + int wr = rating * m_ratingPixmap.width(); + QPainter p(&tile); + p.drawTiledPixmap(xr, r.y(), wr, r.height(), m_ratingPixmap); } bitBlt(&bgPix, item->position() - cx, 0, &tile); --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #663169:663170 @@ -24,6 +24,10 @@ #ifndef LIGHTTABLEBAR_H #define LIGHTTABLEBAR_H +// Qt includes. + +#include <qpixmap.h> + // Local includes. #include "thumbbar.h" @@ -42,8 +46,6 @@ class LightTableBarItem; class LightTableBarToolTip; -class LightTableBarPriv; -class LightTableBarItemPriv; class DIGIKAM_EXPORT LightTableBar : public ThumbBarView { @@ -83,10 +85,13 @@ private slots: + void slotImageRatingChanged(Q_LLONG); void slotItemSelected(ThumbBarItem*); private: + QPixmap m_ratingPixmap; + LightTableBarToolTip *m_toolTip; private: 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: SVN commit 663179 by cgilles: digikam from trunk : Light Table : to be able to select and ensure visible the thumbbar icon associed with the Left or Right panel when user click with left mouse button on preview. CCBUGS: 145227 M +6 -0 lighttablebar.cpp M +2 -0 lighttablebar.h M +6 -0 lighttableview.cpp M +3 -0 lighttableview.h M +16 -0 lighttablewindow.cpp M +3 -0 lighttablewindow.h --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.cpp #663178:663179 @@ -242,6 +242,12 @@ return list; } +void LightTableBar::setSelected(LightTableBarItem* ltItem) +{ + ThumbBarItem *item = static_cast<ThumbBarItem*>(ltItem); + if (item) ThumbBarView::setSelected(item); +} + LightTableBarItem* LightTableBar::findItemByInfo(const ImageInfo* info) const { if (info) --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #663178:663179 @@ -59,6 +59,8 @@ ImageInfo* currentItemImageInfo() const; ImageInfoList itemsImageInfoList(); + void setSelected(LightTableBarItem* ltItem); + LightTableBarItem* findItemByInfo(const ImageInfo* info) const; LightTableBarItem* findItemByPos(const QPoint& pos) const; --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.cpp #663178:663179 @@ -127,6 +127,12 @@ connect(d->rightPreview, SIGNAL(signalPreviewLoaded(bool)), this, SLOT(slotRightPreviewLoaded(bool))); + + connect(d->leftPreview, SIGNAL(signalLeftButtonClicked()), + this, SIGNAL(signalLeftPanelLeftButtonClicked())); + + connect(d->rightPreview, SIGNAL(signalLeftButtonClicked()), + this, SIGNAL(signalRightPanelLeftButtonClicked())); } LightTableView::~LightTableView() --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.h #663178:663179 @@ -91,6 +91,9 @@ void signalLeftDroppedItems(const ImageInfoList&); void signalRightDroppedItems(const ImageInfoList&); + void signalLeftPanelLeftButtonClicked(); + void signalRightPanelLeftButtonClicked(); + void signalSlideShow(); void signalDeleteItem(ImageInfo*); void signalEditItem(ImageInfo*); --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #663178:663179 @@ -346,6 +346,12 @@ connect(d->previewView, SIGNAL(signalRightPreviewLoaded(bool)), this, SLOT(slotRightPreviewLoaded(bool))); + connect(d->previewView, SIGNAL(signalLeftPanelLeftButtonClicked()), + this, SLOT(slotLeftPanelLeftButtonClicked())); + + connect(d->previewView, SIGNAL(signalRightPanelLeftButtonClicked()), + this, SLOT(slotRightPanelLeftButtonClicked())); + ImageAttributesWatch *watch = ImageAttributesWatch::instance(); connect(watch, SIGNAL(signalFileMetadataChanged(const KURL &)), @@ -523,6 +529,16 @@ } } +void LightTableWindow::slotLeftPanelLeftButtonClicked() +{ + d->barView->setSelected(d->barView->findItemByInfo(d->previewView->leftImageInfo())); +} + +void LightTableWindow::slotRightPanelLeftButtonClicked() +{ + d->barView->setSelected(d->barView->findItemByInfo(d->previewView->rightImageInfo())); +} + void LightTableWindow::slotLeftPreviewLoaded(bool b) { d->leftZoomBar->setEnabled(b); --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.h #663178:663179 @@ -92,6 +92,9 @@ void slotLeftDroppedItems(const ImageInfoList&); void slotRightDroppedItems(const ImageInfoList&); + void slotLeftPanelLeftButtonClicked(); + void slotRightPanelLeftButtonClicked(); + void slotLeftPreviewLoaded(bool); void slotRightPreviewLoaded(bool); SVN commit 663188 by cgilles: digikam from trunk : Light Table : and finaly, to be able to assign Rating to the current selected picture in thumbbar using standard digiKam keyboard shorcuts (CTRL+0, CTRL+1, ..., CTRL+5) BUG: 145227 M +30 -0 lighttablebar.cpp M +7 -0 lighttablebar.h M +35 -0 lighttablewindow.cpp --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.cpp #663187:663188 @@ -173,6 +173,36 @@ } } +void LightTableBar::slotAssignRatingNoStar() +{ + slotAssignRating(0); +} + +void LightTableBar::slotAssignRatingOneStar() +{ + slotAssignRating(1); +} + +void LightTableBar::slotAssignRatingTwoStar() +{ + slotAssignRating(2); +} + +void LightTableBar::slotAssignRatingThreeStar() +{ + slotAssignRating(3); +} + +void LightTableBar::slotAssignRatingFourStar() +{ + slotAssignRating(4); +} + +void LightTableBar::slotAssignRatingFiveStar() +{ + slotAssignRating(5); +} + void LightTableBar::setOnLeftPanel(const ImageInfo* info) { if (!info) return; --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #663187:663188 @@ -89,6 +89,13 @@ void slotImageRatingChanged(Q_LLONG); void slotItemSelected(ThumbBarItem*); + + void slotAssignRatingNoStar(); + void slotAssignRatingOneStar(); + void slotAssignRatingTwoStar(); + void slotAssignRatingThreeStar(); + void slotAssignRatingFourStar(); + void slotAssignRatingFiveStar(); void slotAssignRating(int); private: --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #663187:663188 @@ -79,6 +79,12 @@ fullScreen = false; removeFullScreenButton = false; cancelSlideShow = false; + star0 = 0; + star1 = 0; + star2 = 0; + star3 = 0; + star4 = 0; + star5 = 0; accelerators = 0; leftSidebar = 0; rightSidebar = 0; @@ -116,6 +122,14 @@ QSplitter *hSplitter; QSplitter *vSplitter; + // Rating actions. + KAction *star0; + KAction *star1; + KAction *star2; + KAction *star3; + KAction *star4; + KAction *star5; + KAction *setItemLeftAction; KAction *setItemRightAction; KAction *clearListAction; @@ -447,6 +461,27 @@ // Provides a menu entry that allows showing/hiding the statusbar createStandardStatusBarAction(); + // -- Rating actions --------------------------------------------------------------- + + d->star0 = new KAction(i18n("Assign Rating \"No Star\""), CTRL+Key_0, + d->barView, SLOT(slotAssignRatingNoStar()), + actionCollection(), "lighttable_ratenostar"); + d->star1 = new KAction(i18n("Assign Rating \"One Star\""), CTRL+Key_1, + d->barView, SLOT(slotAssignRatingOneStar()), + actionCollection(), "lighttable_rateonestar"); + d->star2 = new KAction(i18n("Assign Rating \"Two Stars\""), CTRL+Key_2, + d->barView, SLOT(slotAssignRatingTwoStar()), + actionCollection(), "lighttable_ratetwostar"); + d->star3 = new KAction(i18n("Assign Rating \"Three Stars\""), CTRL+Key_3, + d->barView, SLOT(slotAssignRatingThreeStar()), + actionCollection(), "lighttable_ratethreestar"); + d->star4 = new KAction(i18n("Assign Rating \"Four Stars\""), CTRL+Key_4, + d->barView, SLOT(slotAssignRatingFourStar()), + actionCollection(), "lighttable_ratefourstar"); + d->star5 = new KAction(i18n("Assign Rating \"Five Stars\""), CTRL+Key_5, + d->barView, SLOT(slotAssignRatingFiveStar()), + actionCollection(), "lighttable_ratefivestar"); + // --------------------------------------------------------------------------------- createGUI("lighttablewindowui.rc", false); |