[Digikam-devel] extragear/graphics/digikam
Gilles Caulier
caulier.gilles at kdemail.net
Fri Feb 2 08:47:37 GMT 2007
SVN commit 629287 by cgilles:
digiKam from trunk : factorize source code about rating pop-up menu available into Album Icon View, Preview Mode, and Image Editor
CCMAIL: digikam-devel at kde.org
M +1 -0 digikam/Makefile.am
M +5 -23 digikam/albumiconview.cpp
M +7 -40 digikam/imagepreviewview.cpp
AM digikam/ratingpopupmenu.cpp [License: GPL]
AM digikam/ratingpopupmenu.h [License: GPL]
M +6 -38 utilities/imageeditor/editor/imagewindow.cpp
--- trunk/extragear/graphics/digikam/digikam/Makefile.am #629286:629287
@@ -76,6 +76,7 @@
mediaplayerview.cpp \
monthwidget.cpp \
pixmapmanager.cpp \
+ ratingpopupmenu.cpp \
ratingwidget.cpp \
scanlib.cpp \
searchadvanceddialog.cpp \
--- trunk/extragear/graphics/digikam/digikam/albumiconview.cpp #629286:629287
@@ -99,12 +99,13 @@
#include "dio.h"
#include "albumlister.h"
#include "albumfiletip.h"
-#include "tagspopupmenu.h"
#include "albumsettings.h"
#include "imagewindow.h"
#include "thumbnailsize.h"
#include "themeengine.h"
#include "dpopupmenu.h"
+#include "tagspopupmenu.h"
+#include "ratingpopupmenu.h"
#include "pixmapmanager.h"
#include "cameradragobject.h"
#include "dragobjects.h"
@@ -188,11 +189,9 @@
// -- Load rating Pixmap ------------------------------------------
- KGlobal::dirs()->addResourceType("digikam_rating",
- KGlobal::dirs()->kde_default("data")
+ KGlobal::dirs()->addResourceType("digikam_rating", KGlobal::dirs()->kde_default("data")
+ "digikam/data");
- QString ratingPixPath = KGlobal::dirs()->findResourceDir("digikam_rating",
- "rating.png");
+ QString ratingPixPath = KGlobal::dirs()->findResourceDir("digikam_rating", "rating.png");
ratingPixPath += "/rating.png";
d->ratingPixmap = QPixmap(ratingPixPath);
@@ -576,28 +575,11 @@
// Assign Star Rating -------------------------------------------
- QPopupMenu ratingMenu;
+ RatingPopupMenu ratingMenu;
connect(&ratingMenu, SIGNAL(activated(int)),
this, SLOT(slotAssignRating(int)));
- ratingMenu.insertItem(i18n("None"), 0);
-
- for (int i = 1 ; i <= 5 ; i++)
- {
- QPixmap pix(d->ratingPixmap.width() * 5,
- d->ratingPixmap.height());
- pix.fill(ratingMenu.colorGroup().background());
-
- QPainter painter(&pix);
- painter.drawTiledPixmap(0, 0,
- i*d->ratingPixmap.width(),
- pix.height(),
- d->ratingPixmap);
- painter.end();
- ratingMenu.insertItem(pix, i);
- }
-
popmenu.insertItem(i18n("Assign Rating"), &ratingMenu);
popmenu.insertSeparator();
--- trunk/extragear/graphics/digikam/digikam/imagepreviewview.cpp #629286:629287
@@ -32,9 +32,8 @@
#include <kservice.h>
#include <krun.h>
#include <ktrader.h>
-#include <kstandarddirs.h>
-#include <kiconloader.h>
#include <kmimetype.h>
+#include <kiconloader.h>
// Local includes.
@@ -43,9 +42,10 @@
#include "albummanager.h"
#include "albumsettings.h"
#include "imageinfo.h"
-#include "dpopupmenu.h"
#include "dmetadata.h"
+#include "dpopupmenu.h"
#include "tagspopupmenu.h"
+#include "ratingpopupmenu.h"
#include "themeengine.h"
#include "imagepreviewview.h"
#include "imagepreviewview.moc"
@@ -63,8 +63,6 @@
imageInfo = 0;
}
- QPixmap ratingPixmap;
-
ImageInfo *imageInfo;
ImagePreviewWidget *imagePreviewWidget;
@@ -80,21 +78,6 @@
setMargin(0);
setLineWidth(1);
- // -- 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";
- d->ratingPixmap = QPixmap(ratingPixPath);
-
- QPainter painter(&d->ratingPixmap);
- painter.fillRect(0, 0, d->ratingPixmap.width(), d->ratingPixmap.height(),
- ThemeEngine::instance()->textSpecialRegColor());
- painter.end();
-
// ----------------------------------------------------------------
connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
@@ -136,9 +119,9 @@
{
if (e->button() == Qt::RightButton)
{
- QPopupMenu *ratingMenu = 0;
- TagsPopupMenu *assignTagsMenu = 0;
- TagsPopupMenu *removeTagsMenu = 0;
+ RatingPopupMenu *ratingMenu = 0;
+ TagsPopupMenu *assignTagsMenu = 0;
+ TagsPopupMenu *removeTagsMenu = 0;
if (!d->imageInfo)
return;
@@ -205,27 +188,11 @@
// Assign Star Rating -------------------------------------------
- ratingMenu = new QPopupMenu();
+ ratingMenu = new RatingPopupMenu();
connect(ratingMenu, SIGNAL(activated(int)),
this, SLOT(slotAssignRating(int)));
- ratingMenu->insertItem(i18n("None"), 0);
-
- for (int i = 1 ; i <= 5 ; i++)
- {
- QPixmap pix(d->ratingPixmap.width() * 5, d->ratingPixmap.height());
- pix.fill(ratingMenu->colorGroup().background());
-
- QPainter painter(&pix);
- painter.drawTiledPixmap(0, 0,
- i*d->ratingPixmap.width(),
- pix.height(),
- d->ratingPixmap);
- painter.end();
- ratingMenu->insertItem(pix, i);
- }
-
popmenu.insertItem(i18n("Assign Rating"), ratingMenu);
// --------------------------------------------------------
** trunk/extragear/graphics/digikam/digikam/ratingpopupmenu.cpp #property svn:eol-style
+ native
** trunk/extragear/graphics/digikam/digikam/ratingpopupmenu.h #property svn:eol-style
+ native
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #629286:629287
@@ -60,7 +60,6 @@
// Local includes.
#include "ddebug.h"
-#include "dpopupmenu.h"
#include "canvas.h"
#include "dimginterface.h"
#include "themeengine.h"
@@ -79,7 +78,9 @@
#include "albumiconitem.h"
#include "imageinfo.h"
#include "imagepropertiessidebardb.h"
+#include "dpopupmenu.h"
#include "tagspopupmenu.h"
+#include "ratingpopupmenu.h"
#include "setup.h"
#include "setupimgplugins.h"
#include "iccsettingscontainer.h"
@@ -121,8 +122,6 @@
// image cannot be saved.
bool allowSaving;
- QPixmap ratingPixmap;
-
KURL::List urlList;
KURL urlCurrent;
@@ -168,21 +167,6 @@
d = new ImageWindowPriv;
m_instance = this;
- // -- 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";
- d->ratingPixmap = QPixmap(ratingPixPath);
-
- QPainter painter(&d->ratingPixmap);
- painter.fillRect(0, 0, d->ratingPixmap.width(), d->ratingPixmap.height(),
- ThemeEngine::instance()->textSpecialRegColor());
- painter.end();
-
// -- Build the GUI -------------------------------
setupUserArea();
@@ -554,9 +538,9 @@
{
if (d->contextMenu)
{
- QPopupMenu *ratingMenu = 0;
- TagsPopupMenu *assignTagsMenu = 0;
- TagsPopupMenu *removeTagsMenu = 0;
+ RatingPopupMenu *ratingMenu = 0;
+ TagsPopupMenu *assignTagsMenu = 0;
+ TagsPopupMenu *removeTagsMenu = 0;
int separatorID1 = -1;
int separatorID2 = -1;
@@ -590,27 +574,11 @@
// Assign Star Rating -------------------------------------------
- ratingMenu = new QPopupMenu();
+ ratingMenu = new RatingPopupMenu();
connect(ratingMenu, SIGNAL(activated(int)),
this, SLOT(slotAssignRating(int)));
- ratingMenu->insertItem(i18n("None"), 0);
-
- for (int i = 1 ; i <= 5 ; i++)
- {
- QPixmap pix(d->ratingPixmap.width() * 5, d->ratingPixmap.height());
- pix.fill(ratingMenu->colorGroup().background());
-
- QPainter painter(&pix);
- painter.drawTiledPixmap(0, 0,
- i*d->ratingPixmap.width(),
- pix.height(),
- d->ratingPixmap);
- painter.end();
- ratingMenu->insertItem(pix, i);
- }
-
d->contextMenu->insertItem(i18n("Assign Rating"), ratingMenu);
}
More information about the Digikam-devel
mailing list