[Marble-commits] KDE/kdeedu/marble/src/lib
Dennis Nienhüser
earthwings at gentoo.org
Wed Mar 23 19:43:19 CET 2011
SVN commit 1225829 by nienhueser:
Add an "Info Boxes" submenu to the context menu. It can be used to toggle info box visibility. Remove the reload map action from the context menu.
REVIEW: 6528
M +18 -4 MarbleWidgetPopupMenu.cpp
M +1 -0 MarbleWidgetPopupMenu.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetPopupMenu.cpp #1225828:1225829
@@ -14,6 +14,7 @@
// Marble
#include "AbstractDataPluginItem.h"
+#include "AbstractFloatItem.h"
#include "MarbleAboutDialog.h"
#include "MarbleWidget.h"
#include "MarbleModel.h"
@@ -69,10 +70,11 @@
QAction* addBookmark = new QAction( QIcon(":/icons/bookmark-new.png"),
tr( "Add &Bookmark" ), this );
- QAction *reloadAction = new QAction( tr( "Rel&oad Map" ), this);
m_aboutDialogAction = new QAction( tr( "&About" ), this );
QAction *goToAction = new QAction( tr( "&Go to..."), this );
+ QMenu* infoBoxMenu = createInfoBoxMenu();
+
m_rmbExtensionPoint = m_rmbMenu->addSeparator();
m_rmbMenu->addAction( fromHere );
m_rmbMenu->addAction( toHere );
@@ -80,8 +82,7 @@
m_rmbMenu->addAction( m_setHomePointAction );
m_rmbMenu->addAction( addBookmark );
m_rmbMenu->addSeparator();
- m_rmbMenu->addAction( reloadAction );
- m_rmbMenu->addSeparator();
+ m_rmbMenu->addMenu( infoBoxMenu );
m_rmbMenu->addAction( m_aboutDialogAction );
m_smallScreenMenu->addAction( fromHere );
@@ -91,6 +92,7 @@
m_smallScreenMenu->addAction( addBookmark );
m_smallScreenMenu->addSeparator();
m_smallScreenMenu->addAction( goToAction );
+ m_smallScreenMenu->addMenu( infoBoxMenu );
m_smallScreenMenu->addSeparator();
connect( fromHere, SIGNAL( triggered( ) ), SLOT( directionsFromHere() ) );
@@ -99,11 +101,23 @@
connect( addBookmark, SIGNAL( triggered( ) ), SLOT( addBookmark() ) );
connect( m_aboutDialogAction, SIGNAL( triggered() ), SLOT( slotAboutDialog() ) );
connect( m_copyCoordinateAction,SIGNAL( triggered() ), SLOT( slotCopyCoordinates() ) );
- connect( reloadAction, SIGNAL(triggered()), m_widget, SLOT(reloadMap()));
connect( goToAction, SIGNAL(triggered()), this, SLOT( openGoToDialog() ) );
}
+QMenu* MarbleWidgetPopupMenu::createInfoBoxMenu()
+{
+ QMenu* menu = new QMenu( tr( "&Info Boxes" ) );
+ QList<AbstractFloatItem *> floatItemList = m_widget->floatItems();
+ QList<AbstractFloatItem *>::const_iterator iter = floatItemList.constBegin();
+ QList<AbstractFloatItem *>::const_iterator const end = floatItemList.constEnd();
+ for (; iter != end; ++iter )
+ {
+ menu->addAction( (*iter)->action() );
+ }
+ return menu;
+}
+
void MarbleWidgetPopupMenu::showLmbMenu( int xpos, int ypos )
{
QPoint curpos = QPoint( xpos, ypos );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetPopupMenu.h #1225828:1225829
@@ -76,6 +76,7 @@
*/
bool mouseCoordinates( GeoDataCoordinates* coordinates, QAction* dataContainer );
void createActions();
+ QMenu* createInfoBoxMenu();
private:
Q_DISABLE_COPY( MarbleWidgetPopupMenu )
More information about the Marble-commits
mailing list