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

Thibaut Gridel tgridel at free.fr
Sat Dec 25 09:33:37 CET 2010


SVN commit 1209154 by tgridel:

Maemo: Tracking dialog

 M  +27 -0     QtMainWindow.cpp  
 M  +3 -0      QtMainWindow.h  
 M  +11 -5     lib/CurrentLocationWidget.cpp  
 M  +13 -0     lib/CurrentLocationWidget.ui  


--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1209153:1209154
@@ -41,6 +41,7 @@
 #include <QtNetwork/QNetworkProxy>
 
 #include "BookmarkInfoDialog.h"
+#include "CurrentLocationWidget.h"
 //#include "EditBookmarkDialog.h"
 #include "MapViewWidget.h"
 #include "MarbleDirs.h"
@@ -92,6 +93,7 @@
         m_osmEditAction( 0 ),
         m_mapViewDialog( 0 ),
         m_routingDialog( 0 ),
+        m_trackingDialog( 0 ),
         m_routingWidget( 0 )
 {
     setUpdatesEnabled( false );
@@ -298,6 +300,9 @@
         m_toggleRoutingTabAction = menuBar()->addAction( tr( "Routing" ) );
         connect( m_toggleRoutingTabAction, SIGNAL( triggered( bool ) ),
                  this, SLOT( showRoutingDialog() ) );
+        m_showTrackingDialogAction = menuBar()->addAction( tr( "Tracking" ) );
+        connect( m_showTrackingDialogAction, SIGNAL( triggered()),
+                 this, SLOT( showTrackingDialog()) );
 
         m_controlView->marbleControl()->setNavigationTabShown( false );
         m_controlView->marbleControl()->setLegendTabShown( false );
@@ -1268,7 +1273,29 @@
     m_routingDialog->activateWindow();
 }
 
+void MainWindow::showTrackingDialog()
+{
+    if( !m_trackingDialog ) {
+        m_trackingDialog = new QDialog( this );
+        m_trackingDialog->setWindowTitle( tr( "Tracking - Marble" ) );
+        CurrentLocationWidget *trackingWidget = new CurrentLocationWidget( m_trackingDialog );
+        trackingWidget->setMarbleWidget( m_controlView->marbleWidget() );
 
+        QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok, Qt::Vertical, m_trackingDialog );
+        connect(buttonBox, SIGNAL( accepted() ), m_trackingDialog, SLOT( accept() ) );
+
+        QHBoxLayout* layout = new QHBoxLayout;
+        layout->addWidget( trackingWidget );
+        layout->addWidget( buttonBox );
+        m_trackingDialog->setLayout( layout );
+        m_trackingDialog->resize( 640, 420 );
+    }
+
+    m_trackingDialog->show();
+    m_trackingDialog->raise();
+    m_trackingDialog->activateWindow();
+}
+
 void MainWindow::updateMapEditButtonVisibility( const QString &mapTheme )
 {
     Q_ASSERT( m_osmEditAction );
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.h #1209153:1209154
@@ -120,6 +120,7 @@
     void showMapViewDialog();
     void showLegendTab( bool enabled );
     void showRoutingDialog();
+    void showTrackingDialog();
 
  private:
     void setupZoomButtons();
@@ -194,9 +195,11 @@
     QAction *m_showMapViewDialogAction;
     QAction *m_toggleLegendTabAction;
     QAction *m_toggleRoutingTabAction;
+    QAction *m_showTrackingDialogAction;
 
     QDialog *m_mapViewDialog;
     QDialog *m_routingDialog;
+    QDialog *m_trackingDialog;
 
     RoutingWidget *m_routingWidget;
 };
--- trunk/KDE/kdeedu/marble/src/lib/CurrentLocationWidget.cpp #1209153:1209154
@@ -67,11 +67,15 @@
 
     d->m_locale = MarbleGlobal::getInstance()->locale();
 
-    connect( d->m_currentLocationUi.recenterComboBox, SIGNAL ( highlighted( int ) ),
+    connect( d->m_currentLocationUi.recenterComboBox, SIGNAL ( currentIndexChanged( int ) ),
             this, SLOT( setRecenterMode( int ) ) );
 
     connect( d->m_currentLocationUi.autoZoomCheckBox, SIGNAL( clicked( bool ) ),
              this, SLOT( setAutoZoom( bool ) ) );
+
+    bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
+    d->m_currentLocationUi.positionTrackingComboBox->setVisible( !smallScreen );
+    d->m_currentLocationUi.locationLabel->setVisible( !smallScreen );
 }
 
 CurrentLocationWidget::~CurrentLocationWidget()
@@ -128,6 +132,7 @@
     connect( d->m_widget->model()->positionTracking(),
              SIGNAL( positionProviderPluginChanged( PositionProviderPlugin* ) ),
              this, SLOT( updateActivePositionProvider( PositionProviderPlugin* ) ) );
+    d->updateActivePositionProvider( d->m_widget->model()->positionTracking()->positionProviderPlugin() );
     connect( d->m_currentLocationUi.positionTrackingComboBox, SIGNAL( currentIndexChanged( QString ) ),
              this, SLOT( changePositionProvider( QString ) ) );
     connect( d->m_currentLocationUi.locationLabel, SIGNAL( linkActivated( QString ) ),
@@ -196,6 +201,10 @@
         }
     }
     m_currentLocationUi.positionTrackingComboBox->blockSignals( false );
+    m_currentLocationUi.recenterLabel->setEnabled( plugin );
+    m_currentLocationUi.recenterComboBox->setEnabled( plugin );
+    m_currentLocationUi.autoZoomCheckBox->setEnabled( plugin );
+
 }
 
 void CurrentLocationWidget::receiveGpsCoordinates( const GeoDataCoordinates &position, qreal speed )
@@ -249,9 +258,6 @@
 void CurrentLocationWidgetPrivate::changePositionProvider( const QString &provider )
 {
     bool hasProvider = ( provider != QObject::tr("Disabled") );
-    m_currentLocationUi.recenterLabel->setEnabled( hasProvider );
-    m_currentLocationUi.recenterComboBox->setEnabled( hasProvider );
-    m_currentLocationUi.autoZoomCheckBox->setEnabled( hasProvider );
 
     if ( hasProvider ) {
         foreach( PositionProviderPlugin* plugin, m_positionProviderPlugins ) {
@@ -302,7 +308,7 @@
 void CurrentLocationWidgetPrivate::saveTrack()
 {
     QString fileName = QFileDialog::getSaveFileName(m_widget, QObject::tr("Save Track"), // krazy:exclude=qclasses
-                            QDir::homePath().append('/' + QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss") + ".kml"),
+                                                    QDir::homePath().append('/' + QDateTime::currentDateTime().toString("yyyy-MM-dd_hhmmss") + ".kml"),
                             QObject::tr("KML File (*.kml)"));
 
     m_widget->model()->positionTracking()->saveTrack( fileName );
--- trunk/KDE/kdeedu/marble/src/lib/CurrentLocationWidget.ui #1209153:1209154
@@ -95,6 +95,19 @@
     </widget>
    </item>
    <item>
+    <spacer name="trackRecenterVerticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
     <widget class="QLabel" name="recenterLabel">
      <property name="enabled">
       <bool>false</bool>


More information about the Marble-commits mailing list