[Digikam-devel] extragear/graphics/digikam
Gilles Caulier
caulier.gilles at gmail.com
Tue Mar 6 06:46:30 GMT 2007
SVN commit 639836 by cgilles:
digikam from trunk : digiKam 0.9.2 continue...
- SlideShow can be started form preview, image editor, and showfoto context menu.
- Using DPopupMenu with showfoto.
- Factorization of source code about context menu in imagewindow class.
CCMAIL: digikam-devel at kde.org
M +3 -0 digikam/albumwidgetstack.cpp
M +2 -1 digikam/albumwidgetstack.h
M +3 -0 digikam/digikamview.cpp
M +7 -0 digikam/imagepreviewview.cpp
M +1 -0 digikam/imagepreviewview.h
M +8 -1 libs/widgets/common/dpopupmenu.cpp
M +3 -6 showfoto/showfoto.cpp
M +1 -11 showfoto/showfotoui.rc
M +16 -1 utilities/imageeditor/editor/editorwindow.cpp
M +3 -0 utilities/imageeditor/editor/editorwindow.h
M +12 -23 utilities/imageeditor/editor/imagewindow.cpp
--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #639835:639836
@@ -99,6 +99,9 @@
connect(d->imagePreviewView, SIGNAL(signalBack2Album()),
this, SIGNAL(signalBack2Album()));
+
+ connect(d->imagePreviewView, SIGNAL(signalSlideShow()),
+ this, SIGNAL(signalSlideShow()));
}
AlbumWidgetStack::~AlbumWidgetStack()
--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #639835:639836
@@ -75,7 +75,8 @@
void signalEditItem();
void signalDeleteItem();
void signalToggledToPreviewMode(bool);
- void signalBack2Album();
+ void signalBack2Album();
+ void signalSlideShow();
public slots:
--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #639835:639836
@@ -331,6 +331,9 @@
connect(d->albumWidgetStack, SIGNAL(signalBack2Album()),
this, SLOT(slotEscapePreview()));
+ connect(d->albumWidgetStack, SIGNAL(signalSlideShow()),
+ this, SLOT(slotSlideShowAll()));
+
// -- Selection timer ---------------
connect(d->selectionTimer, SIGNAL(timeout()),
--- trunk/extragear/graphics/digikam/digikam/imagepreviewview.cpp #639835:639836
@@ -188,6 +188,7 @@
//-- Edit actions -----------------------------------------------
popmenu.insertSeparator();
+ popmenu.insertItem(SmallIcon("slideshow"), i18n("SlideShow"), 16);
popmenu.insertItem(SmallIcon("editimage"), i18n("Edit..."), 12);
popmenu.insertItem(i18n("Open With"), &openWithMenu, 13);
@@ -297,6 +298,12 @@
break;
}
+ case 16: // SlideShow
+ {
+ emit signalSlideShow();
+ break;
+ }
+
default:
break;
}
--- trunk/extragear/graphics/digikam/digikam/imagepreviewview.h #639835:639836
@@ -57,6 +57,7 @@
void signalEditItem();
void signalPreviewLoaded();
void signalBack2Album();
+ void signalSlideShow();
private slots:
--- trunk/extragear/graphics/digikam/libs/widgets/common/dpopupmenu.cpp #639835:639836
@@ -32,7 +32,9 @@
#include <kapplication.h>
#include <kconfig.h>
#include <kiconeffect.h>
+#include <kapplication.h>
#include <kstandarddirs.h>
+#include <kaboutdata.h>
// Local includes.
@@ -60,7 +62,12 @@
if ( newColor != _dpopupmenu_sidePixmapColor_ )
{
_dpopupmenu_sidePixmapColor_ = newColor;
- _dpopupmenu_sidePixmap_.load( locate( "data","digikam/data/menusidepixmap.png" ) );
+
+ if (KApplication::kApplication()->aboutData()->appName() == QString("digikam"))
+ _dpopupmenu_sidePixmap_.load( locate( "data","digikam/data/menusidepixmap.png" ) );
+ else
+ _dpopupmenu_sidePixmap_.load( locate( "data","showfoto/menusidepixmap.png" ) );
+
KIconEffect::colorize( _dpopupmenu_sidePixmap_, newColor, 1.0 );
}
}
--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #639835:639836
@@ -68,7 +68,6 @@
#include <kglobalsettings.h>
#include <ktoolbar.h>
#include <kstatusbar.h>
-#include <kpopupmenu.h>
#include <kprogress.h>
// LibKDcraw includes.
@@ -79,6 +78,7 @@
// Local includes.
#include "ddebug.h"
+#include "dpopupmenu.h"
#include "dmetadata.h"
#include "canvas.h"
#include "thumbbar.h"
@@ -108,7 +108,6 @@
ShowFotoPriv()
{
- contextMenu = 0;
currentItem = 0;
itemsNb = 0;
splash = 0;
@@ -140,8 +139,6 @@
KActionMenu *BCGAction;
- QPopupMenu *contextMenu;
-
Digikam::ThumbBarView *thumbBar;
Digikam::ThumbBarItem *currentItem;
Digikam::ImagePropertiesSideBar *rightSidebar;
@@ -231,7 +228,7 @@
// Create context menu.
- d->contextMenu = static_cast<QPopupMenu*>(factory()->container("RMBMenu", this));
+ setupContextMenu();
// Make signals/slots connections
@@ -1091,7 +1088,7 @@
void ShowFoto::slotContextMenu()
{
- d->contextMenu->exec(QCursor::pos());
+ m_contextMenu->exec(QCursor::pos());
}
void ShowFoto::slideShow(bool startWithCurrent, Digikam::SlideShowSettings& settings)
--- trunk/extragear/graphics/digikam/showfoto/showfotoui.rc #639835:639836
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui version="12" name="showfoto" >
+<gui version="13" name="showfoto" >
<MenuBar>
@@ -107,16 +107,6 @@
<Merge />
</ToolBar>
-<Menu name="RMBMenu">
- <Action name="editorwindow_backward" />
- <Action name="editorwindow_forward" />
- <Separator/>
- <Action name="editorwindow_rotate" />
- <Action name="editorwindow_crop" />
- <Separator/>
- <Action name="editorwindow_delete" />
-</Menu>
-
<ActionProperties/>
</gui>
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #639835:639836
@@ -60,7 +60,6 @@
#include <kaccel.h>
#include <kmessagebox.h>
#include <kglobal.h>
-#include <kpopupmenu.h>
#include <kstandarddirs.h>
#include <kiconloader.h>
#include <kio/netaccess.h>
@@ -76,6 +75,7 @@
// Local includes.
#include "ddebug.h"
+#include "dpopupmenu.h"
#include "canvas.h"
#include "dimginterface.h"
#include "imageplugin.h"
@@ -105,6 +105,7 @@
{
d = new EditorWindowPriv;
+ m_contextMenu = 0;
m_canvas = 0;
m_imagePluginLoader = 0;
m_undoAction = 0;
@@ -143,6 +144,20 @@
delete d;
}
+void EditorWindow::setupContextMenu()
+{
+ m_contextMenu = new DPopupMenu(this);
+ KActionCollection *ac = actionCollection();
+ if( ac->action("editorwindow_backward") ) ac->action("editorwindow_backward")->plug(m_contextMenu);
+ if( ac->action("editorwindow_forward") ) ac->action("editorwindow_forward")->plug(m_contextMenu);
+ m_contextMenu->insertSeparator();
+ if( ac->action("editorwindow_slideshow") ) ac->action("editorwindow_slideshow")->plug(m_contextMenu);
+ if( ac->action("editorwindow_rotate") ) ac->action("editorwindow_rotate")->plug(m_contextMenu);
+ if( ac->action("editorwindow_crop") ) ac->action("editorwindow_crop")->plug(m_contextMenu);
+ m_contextMenu->insertSeparator();
+ if( ac->action("editorwindow_delete") ) ac->action("editorwindow_delete")->plug(m_contextMenu);
+}
+
void EditorWindow::setupStandardConnections()
{
// -- Canvas connections ------------------------------------------------
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #639835:639836
@@ -47,6 +47,7 @@
namespace Digikam
{
+class DPopupMenu;
class Canvas;
class ImagePluginLoader;
class IOFileSettingsContainer;
@@ -100,6 +101,7 @@
KToolBarPopupAction *m_undoAction;
KToolBarPopupAction *m_redoAction;
+ DPopupMenu *m_contextMenu;
Canvas *m_canvas;
ImagePluginLoader *m_imagePluginLoader;
StatusProgressBar *m_nameLabel;
@@ -116,6 +118,7 @@
void setupStandardActions();
void setupStandardAccelerators();
void setupStatusBar();
+ void setupContextMenu();
void toggleStandardActions(bool val);
void printImage(KURL url);
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #639835:639836
@@ -60,6 +60,7 @@
// Local includes.
#include "ddebug.h"
+#include "dpopupmenu.h"
#include "canvas.h"
#include "dimginterface.h"
#include "themeengine.h"
@@ -76,7 +77,6 @@
#include "syncjob.h"
#include "imageinfo.h"
#include "imagepropertiessidebardb.h"
-#include "dpopupmenu.h"
#include "tagspopupmenu.h"
#include "ratingpopupmenu.h"
#include "slideshow.h"
@@ -115,7 +115,6 @@
fileTrashDirectlyAction = 0;
imageInfoCurrent = 0;
rightSidebar = 0;
- contextMenu = 0;
}
// If image editor is launched by camera interface, current
@@ -142,8 +141,6 @@
ImageInfo *imageInfoCurrent;
ImagePropertiesSideBarDB *rightSidebar;
-
- DPopupMenu *contextMenu;
};
ImageWindow* ImageWindow::m_instance = 0;
@@ -180,15 +177,7 @@
// Create context menu.
- d->contextMenu = new DPopupMenu(this);
- KActionCollection *ac = actionCollection();
- if( ac->action("editorwindow_backward") ) ac->action("editorwindow_backward")->plug(d->contextMenu);
- if( ac->action("editorwindow_forward") ) ac->action("editorwindow_forward")->plug(d->contextMenu);
- d->contextMenu->insertSeparator();
- if( ac->action("editorwindow_rotate") ) ac->action("editorwindow_rotate")->plug(d->contextMenu);
- if( ac->action("editorwindow_crop") ) ac->action("editorwindow_crop")->plug(d->contextMenu);
- d->contextMenu->insertSeparator();
- if( ac->action("editorwindow_delete") ) ac->action("editorwindow_delete")->plug(d->contextMenu);
+ setupContextMenu();
// Make signals/slots connections
@@ -542,7 +531,7 @@
void ImageWindow::slotContextMenu()
{
- if (d->contextMenu)
+ if (m_contextMenu)
{
RatingPopupMenu *ratingMenu = 0;
TagsPopupMenu *assignTagsMenu = 0;
@@ -561,10 +550,10 @@
assignTagsMenu = new TagsPopupMenu(idList, 1000, TagsPopupMenu::ASSIGN);
removeTagsMenu = new TagsPopupMenu(idList, 2000, TagsPopupMenu::REMOVE);
- separatorID1 = d->contextMenu->insertSeparator();
+ separatorID1 = m_contextMenu->insertSeparator();
- d->contextMenu->insertItem(i18n("Assign Tag"), assignTagsMenu);
- int i = d->contextMenu->insertItem(i18n("Remove Tag"), removeTagsMenu);
+ m_contextMenu->insertItem(i18n("Assign Tag"), assignTagsMenu);
+ int i = m_contextMenu->insertItem(i18n("Remove Tag"), removeTagsMenu);
connect(assignTagsMenu, SIGNAL(signalTagActivated(int)),
this, SLOT(slotAssignTag(int)));
@@ -574,9 +563,9 @@
AlbumDB* db = AlbumManager::instance()->albumDB();
if (!db->hasTags( idList ))
- d->contextMenu->setItemEnabled(i, false);
+ m_contextMenu->setItemEnabled(i, false);
- separatorID2 = d->contextMenu->insertSeparator();
+ separatorID2 = m_contextMenu->insertSeparator();
// Assign Star Rating -------------------------------------------
@@ -585,15 +574,15 @@
connect(ratingMenu, SIGNAL(activated(int)),
this, SLOT(slotAssignRating(int)));
- d->contextMenu->insertItem(i18n("Assign Rating"), ratingMenu);
+ m_contextMenu->insertItem(i18n("Assign Rating"), ratingMenu);
}
- d->contextMenu->exec(QCursor::pos());
+ m_contextMenu->exec(QCursor::pos());
if (separatorID1 != -1)
- d->contextMenu->removeItem(separatorID1);
+ m_contextMenu->removeItem(separatorID1);
if (separatorID2 != -1)
- d->contextMenu->removeItem(separatorID2);
+ m_contextMenu->removeItem(separatorID2);
delete assignTagsMenu;
delete removeTagsMenu;
More information about the Digikam-devel
mailing list