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

Dennis Nienhüser earthwings at gentoo.org
Sun May 9 19:27:53 CEST 2010


SVN commit 1124617 by nienhueser:

Disable current location and routing widgets and their respective map layers on planets other than earth. We're not there yet.

 M  +17 -0     MarbleControlBox.cpp  
 M  +6 -0      routing/RoutingLayer.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1124616:1124617
@@ -539,10 +539,21 @@
 {
     QString  title = tr( "Current Location" );
     setWidgetTabShown( d->m_currentLocation2Widget, 4, show, title );
+    if ( d->m_widget ) {
+        bool enabled = d->m_widget->mapTheme()->head()->target() == "earth";
+        int locationIndex = d->uiWidget.toolBox->indexOf( d->m_currentLocation2Widget );
+        if ( locationIndex >= 0 ) {
+            d->uiWidget.toolBox->setItemEnabled( locationIndex, enabled );
 }
 
+        if ( !enabled ) {
+            d->m_widget->map()->model()->gpsLayer()->setVisible( false );
+        }
+    }
+}
 
 
+
 void MarbleControlBox::resizeEvent ( QResizeEvent * )
 {
     if ( height() < 500 ) {
@@ -628,6 +639,12 @@
 
         QString selectedId = d->m_widget->mapTheme()->head()->target();
         d->m_runnerManager->setCelestialBodyId( selectedId );
+        int routingIndex = d->uiWidget.toolBox->indexOf( d->m_routingWidget );
+        d->uiWidget.toolBox->setItemEnabled( routingIndex, selectedId == "earth" );
+        int locationIndex = d->uiWidget.toolBox->indexOf( d->m_currentLocation2Widget );
+        if ( locationIndex >= 0 ) {
+            d->uiWidget.toolBox->setItemEnabled( locationIndex, selectedId == "earth" );
+        }
 
         QList<QStandardItem*> itemList = d->m_celestialList->findItems( selectedId, Qt::MatchExactly, 1 );
 
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingLayer.cpp #1124616:1124617
@@ -13,6 +13,8 @@
 #include "GeoDataCoordinates.h"
 #include "GeoDataLineString.h"
 #include "GeoPainter.h"
+#include "GeoSceneDocument.h"
+#include "GeoSceneHead.h"
 #include "MarblePlacemarkModel.h"
 #include "MarbleWidget.h"
 #include "MarbleWidgetPopupMenu.h"
@@ -554,6 +556,10 @@
 bool RoutingLayer::render( GeoPainter *painter, ViewportParams *viewport,
                            const QString& renderPos, GeoSceneLayer *layer )
 {
+    if ( d->m_marbleWidget->mapTheme()->head()->target() != "earth" ) {
+        return false;
+    }
+
     Q_UNUSED( viewport )
     Q_UNUSED( renderPos )
     Q_UNUSED( layer )


More information about the Marble-commits mailing list