[Digikam-devel] [Bug 145227] change ratings via short-cuts in the light-table
Gilles Caulier
caulier.gilles at gmail.com
Thu May 10 12:32:05 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 13:32 -------
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:
More information about the Digikam-devel
mailing list