[Marble-commits] KDE/kdeedu/marble/src

Bastian Holst bastianholst at gmx.de
Sun Oct 3 21:20:40 CEST 2010


SVN commit 1182203 by bholst:

Marble's MapView is shown as a dialog in the small screen version now.

 M  +16 -16    QtMainWindow.cpp  
 M  +4 -2      QtMainWindow.h  


--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1182202:1182203
@@ -40,6 +40,7 @@
 
 #include "BookmarkInfoDialog.h"
 //#include "EditBookmarkDialog.h"
+#include "MapViewWidget.h"
 #include "MarbleDirs.h"
 #include "MarbleAboutDialog.h"
 #include "QtMarbleConfigDialog.h"
@@ -73,7 +74,8 @@
         m_timeControlDialog( 0 ),
         m_downloadRegionDialog( 0 ),
         m_downloadRegionAction( 0 ),
-        m_osmEditAction( 0 )
+        m_osmEditAction( 0 ),
+        m_mapViewDialog( 0 )
 {
     setUpdatesEnabled( false );
 
@@ -272,10 +274,9 @@
         //menuBar()->addAction( m_fullScreenAct );
         menuBar()->addAction( m_downloadRegionAction );
 
-        m_toggleMapViewTabAction = menuBar()->addAction( tr( "Map View" ) );
-        m_toggleMapViewTabAction->setCheckable( true );
-        connect( m_toggleMapViewTabAction, SIGNAL( triggered( bool ) ),
-                 this, SLOT( showMapViewTab( bool ) ) );
+        m_showMapViewDialogAction = menuBar()->addAction( tr( "Map View" ) );
+        connect( m_showMapViewDialogAction, SIGNAL( triggered( bool ) ),
+                 this, SLOT( showMapViewDialog() ) );
         m_toggleLegendTabAction = menuBar()->addAction( tr( "Legend" ) );
         m_toggleLegendTabAction->setCheckable( true );
         connect( m_toggleLegendTabAction, SIGNAL( triggered( bool ) ),
@@ -1110,21 +1111,21 @@
 #endif
 }
 
-void MainWindow::showMapViewTab( bool enabled )
+void MainWindow::showMapViewDialog()
 {
-    m_toggleLegendTabAction->setChecked( false );
-    m_toggleRoutingTabAction->setChecked( false );
-    m_controlView->marbleControl()->setNavigationTabShown( false );
-    m_controlView->marbleControl()->setLegendTabShown( false );
-    m_controlView->marbleControl()->setMapViewTabShown( true );
-    m_controlView->marbleControl()->setCurrentLocationTabShown( false );
-    m_controlView->marbleControl()->setRoutingTabShown( false );
-    m_controlView->setSideBarShown( enabled );
+    if( !m_mapViewDialog ) {
+        m_mapViewDialog = new QDialog( this );
+        MapViewWidget *mapViewWidget = new MapViewWidget( m_mapViewDialog );
+        mapViewWidget->setMarbleWidget( m_controlView->marbleWidget() );
 }
 
+    m_mapViewDialog->show();
+    m_mapViewDialog->raise();
+    m_mapViewDialog->activateWindow();
+}
+
 void MainWindow::showLegendTab( bool enabled )
 {
-    m_toggleMapViewTabAction->setChecked( false );
     m_toggleRoutingTabAction->setChecked( false );
     m_controlView->marbleControl()->setNavigationTabShown( false );
     m_controlView->marbleControl()->setLegendTabShown( true );
@@ -1136,7 +1137,6 @@
 
 void MainWindow::showRoutingTab( bool enabled )
 {
-    m_toggleMapViewTabAction->setChecked( false );
     m_toggleLegendTabAction->setChecked( false );
     m_controlView->marbleControl()->setNavigationTabShown( false );
     m_controlView->marbleControl()->setLegendTabShown( false );
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.h #1182202:1182203
@@ -116,7 +116,7 @@
     void  downloadRegion();
 
     // Small screen devices specific slots
-    void showMapViewTab( bool enabled );
+    void showMapViewDialog();
     void showLegendTab( bool enabled );
     void showRoutingTab( bool enabled );
 
@@ -188,9 +188,11 @@
     QAction *m_addBookmarkFolderAct;
 
     // Small screen devices
-    QAction *m_toggleMapViewTabAction;
+    QAction *m_showMapViewDialogAction;
     QAction *m_toggleLegendTabAction;
     QAction *m_toggleRoutingTabAction;
+
+    QDialog *m_mapViewDialog;
 };
 
 } // namespace Marble


More information about the Marble-commits mailing list