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

Dennis Nienhüser earthwings at gentoo.org
Sun Aug 22 22:15:15 CEST 2010


SVN commit 1166756 by nienhueser:

Do not restrict auto zoom / re-center actions operations to the time when a position is available, but when a position provider is activated. This way one can prepare the device for navigation even when no gps fix is there yet.

 M  +12 -13    lib/CurrentLocationWidget.cpp  
 M  +1 -17     plugins/render/routing/RoutingPlugin.cpp  
 M  +0 -5      plugins/render/routing/RoutingPlugin.h  


--- trunk/KDE/kdeedu/marble/src/lib/CurrentLocationWidget.cpp #1166755:1166756
@@ -129,9 +129,6 @@
 void CurrentLocationWidgetPrivate::adjustPositionTrackingStatus( PositionProviderStatus status )
 {
     if ( status == PositionProviderStatusAvailable ) {
-        m_currentLocationUi.recenterLabel->setEnabled( true );
-        m_currentLocationUi.recenterComboBox->setEnabled( true );
-        m_currentLocationUi.autoZoomCheckBox->setEnabled( true );
         return;
     }
 
@@ -205,16 +202,12 @@
 
 void CurrentLocationWidgetPrivate::changePositionProvider( const QString &provider )
 {
-    if ( provider == QObject::tr("Disabled") ) {
-        m_currentLocationUi.locationLabel->setEnabled( false );
-        m_widget->setShowGps( false );
-        m_widget->model()->positionTracking()->setPositionProviderPlugin( 0 );
-        m_currentLocationUi.recenterLabel->setEnabled( false );
-        m_currentLocationUi.recenterComboBox->setEnabled( false );
-        m_currentLocationUi.autoZoomCheckBox->setEnabled( false );
-        m_widget->update();
-    }
-    else {
+    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 ) {
             if ( plugin->guiString() == provider ) {
                 m_currentLocationUi.locationLabel->setEnabled( true );
@@ -227,7 +220,13 @@
             }
         }
     }
+    else {
+        m_currentLocationUi.locationLabel->setEnabled( false );
+        m_widget->setShowGps( false );
+        m_widget->model()->positionTracking()->setPositionProviderPlugin( 0 );
+        m_widget->update();
 }
+}
 
 void CurrentLocationWidget::setRecenterMode( int centerMode )
 {
--- trunk/KDE/kdeedu/marble/src/plugins/render/routing/RoutingPlugin.cpp #1166755:1166756
@@ -168,8 +168,6 @@
         if( m_profiles & MarbleGlobal::SmallScreen ) {
 
             // disconnect signals
-            disconnect( m_marbleWidget->model()->positionTracking(), SIGNAL( statusChanged( PositionProviderStatus ) ),
-                         this, SLOT( setNavigationMenu( PositionProviderStatus ) ) );
             disconnect( m_marbleWidget->model()->positionTracking(), SIGNAL( positionProviderPluginChanged( PositionProviderPlugin* ) ),
                                     this, SLOT( setNavigationMenuDisabled( PositionProviderPlugin* ) ) );
             disconnect( m_routingWidgetSmall->navigationButton, SIGNAL( clicked( bool ) ),
@@ -195,8 +193,6 @@
                      this, SLOT( setAutoZoomMenu( bool ) ) );
 
 
-            connect( m_marbleWidget->model()->positionTracking(), SIGNAL( statusChanged( PositionProviderStatus ) ),
-                        this, SLOT( setNavigationMenu( PositionProviderStatus ) ) );
             connect( m_marbleWidget->model()->positionTracking(), SIGNAL( positionProviderPluginChanged( PositionProviderPlugin* ) ),
                                    this, SLOT( setNavigationMenuDisabled( PositionProviderPlugin* ) ) );
             connect( m_routingWidgetSmall->navigationButton, SIGNAL( clicked( bool ) ),
@@ -574,22 +570,10 @@
     m_adjustNavigation->setRecenter( Disabled );
 }
 
-void RoutingPlugin::setNavigationMenu( PositionProviderStatus status )
-{
-    if( status == PositionProviderStatusAvailable ) {
-        m_navigationMenu->setEnabled( true );
-    }
-    else {
-        m_navigationMenu->setEnabled( false );
-    }
-}
-
 void RoutingPlugin::setNavigationMenuDisabled( PositionProviderPlugin *activePlugin )
 {
-    if( !activePlugin ) {
-        m_navigationMenu->setEnabled( false );
+    m_navigationMenu->setEnabled( activePlugin != 0 );
     }
-}
 
 Q_EXPORT_PLUGIN2( RoutingPlugin, Marble::RoutingPlugin )
 
--- trunk/KDE/kdeedu/marble/src/plugins/render/routing/RoutingPlugin.h #1166755:1166756
@@ -80,11 +80,6 @@
 private Q_SLOTS:
 
     /**
-     * Enable/Disable Navigation Menu depending on the status of the position provider
-     */
-     void setNavigationMenu( PositionProviderStatus status );
-
-    /**
      * @brief sets the re-center mode to "Always Recenter"
      * @see AdjustNavigation
      */


More information about the Marble-commits mailing list