[Marble-commits] KDE/kdeedu/marble/src/lib
Dennis Nienhüser
earthwings at gentoo.org
Thu Sep 30 21:34:21 CEST 2010
SVN commit 1181352 by nienhueser:
Show a special left mouse button popup on small screen devices . It contains some actions from the normal right mouse button popup (there's no right mouse button popup on Maemo).
M +36 -16 MarbleWidgetPopupMenu.cpp
M +1 -0 MarbleWidgetPopupMenu.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetPopupMenu.cpp #1181351:1181352
@@ -43,6 +43,7 @@
m_widget(widget),
m_lmbMenu( new QMenu( m_widget ) ),
m_rmbMenu( new QMenu( m_widget ) ),
+ m_smallScreenMenu( new QMenu( m_widget ) ),
m_runnerManager( 0 )
{
connect( m_lmbMenu, SIGNAL( triggered( QAction* ) ),
@@ -59,37 +60,56 @@
m_copyCoordinateAction = new QAction( tr( "0 N 0 W" ), this );
// Tool actions (Right mouse button)
+ QAction* fromHere = new QAction( tr( "Directions &from here" ), this );
+ QAction* toHere = new QAction( tr( "Directions &to here" ), this );
+ m_setHomePointAction = new QAction( tr( "&Set Home Location" ), this);
+ 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 );
+
m_rmbExtensionPoint = m_rmbMenu->addSeparator();
- m_rmbMenu->addAction( tr( "Directions &from here" ), this, SLOT( directionsFromHere() ) );
- m_rmbMenu->addAction( tr( "Directions &to here" ), this, SLOT( directionsToHere() ) );
+ m_rmbMenu->addAction( fromHere );
+ m_rmbMenu->addAction( toHere );
m_rmbMenu->addSeparator();
- m_rmbMenu->addAction( QIcon(":/icons/bookmark-new.png"), tr( "Add &Bookmark" ), this, SLOT( addBookmark() ) );
- m_setHomePointAction = new QAction( tr( "&Set Home Location" ), this);
m_rmbMenu->addAction( m_setHomePointAction );
+ m_rmbMenu->addAction( addBookmark );
m_rmbMenu->addSeparator();
-
- QAction *reloadAction = new QAction( tr( "Rel&oad Map" ), this);
m_rmbMenu->addAction( reloadAction );
m_rmbMenu->addSeparator();
-
- m_aboutDialogAction = new QAction( tr( "&About" ), this );
m_rmbMenu->addAction( m_aboutDialogAction );
- connect( m_setHomePointAction, SIGNAL( triggered() ),
- SLOT( slotSetHomePoint() ) );
- connect( m_aboutDialogAction, SIGNAL( triggered() ),
- SLOT( slotAboutDialog() ) );
- connect( m_copyCoordinateAction,SIGNAL( triggered() ),
- SLOT( slotCopyCoordinates() ) );
+ m_smallScreenMenu->addAction( fromHere );
+ m_smallScreenMenu->addAction( toHere );
+ m_smallScreenMenu->addSeparator();
+ m_smallScreenMenu->addAction( m_setHomePointAction );
+ m_smallScreenMenu->addAction( addBookmark );
+ m_smallScreenMenu->addSeparator();
+ m_smallScreenMenu->addAction( reloadAction );
+ m_smallScreenMenu->addSeparator();
+
+ connect( fromHere, SIGNAL( triggered( ) ), SLOT( directionsFromHere() ) );
+ connect( toHere, SIGNAL( triggered( ) ), SLOT( directionsToHere() ) );
+ connect( m_setHomePointAction, SIGNAL( triggered() ), SLOT( slotSetHomePoint() ) );
+ 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()));
}
void MarbleWidgetPopupMenu::showLmbMenu( int xpos, int ypos )
{
+ QPoint curpos = QPoint( xpos, ypos );
+ bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
+ if ( smallScreen ) {
+ m_setHomePointAction->setData( curpos );
+ m_smallScreenMenu->popup( m_widget->mapToGlobal( curpos ) );
+ return;
+ }
+
m_lmbMenu->clear();
-
- QPoint curpos = QPoint( xpos, ypos );
m_featurelist = m_model->whichFeatureAt( curpos );
int actionidx = 1;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetPopupMenu.h #1181351:1181352
@@ -86,6 +86,7 @@
QMenu *m_lmbMenu;
QMenu *m_rmbMenu;
+ QMenu *m_smallScreenMenu;
QAction *m_planetAction;
QAction *m_copyCoordinateAction;
More information about the Marble-commits
mailing list