[Marble-commits] KDE/kdeedu/marble/src
Dennis Nienhüser
earthwings at gentoo.org
Thu Dec 30 12:12:52 CET 2010
SVN commit 1210272 by nienhueser:
Only enable the guidance mode button when a route is available.
M +1 -0 lib/routing/RoutingModel.cpp
M +3 -0 lib/routing/RoutingModel.h
M +12 -0 plugins/render/routing/RoutingPlugin.cpp
M +2 -0 plugins/render/routing/RoutingPlugin.h
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingModel.cpp #1210271:1210272
@@ -303,6 +303,7 @@
}
reset();
+ emit currentRouteChanged();
return true;
}
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingModel.h #1210271:1210272
@@ -178,6 +178,9 @@
void routeCalculated( int );
void deviatedFromRoute( bool deviated );
+ /** A different route was loaded */
+ void currentRouteChanged();
+
private:
RoutingModelPrivate *const d;
};
--- trunk/KDE/kdeedu/marble/src/plugins/render/routing/RoutingPlugin.cpp #1210271:1210272
@@ -63,6 +63,8 @@
void updateZoomButtons();
+ void updateGuidanceModeButton();
+
void updateInstructionLabel( int fontSize, qreal remainingDistance );
void forceRepaint();
@@ -142,6 +144,12 @@
forceRepaint();
}
+void RoutingPluginPrivate::updateGuidanceModeButton()
+{
+ bool const hasRoute = m_routingModel->rowCount() > 0;
+ m_widget.routingButton->setEnabled( hasRoute );
+}
+
void RoutingPluginPrivate::forceRepaint()
{
if ( m_marbleWidget ) {
@@ -370,6 +378,7 @@
d->m_widget.setupUi( widget );
PositionProviderPlugin* activePlugin = dataFacade()->positionTracking()->positionProviderPlugin();
d->m_widget.gpsButton->setChecked( activePlugin != 0 );
+ d->m_widget.routingButton->setEnabled( false );
connect( d->m_widget.instructionLabel, SIGNAL( linkActivated( QString ) ),
this, SLOT( reverseRoute() ) );
@@ -425,6 +434,9 @@
this, SLOT( updateZoomButtons() ) );
connect( d->m_marbleWidget, SIGNAL( zoomChanged( int ) ),
this, SLOT( updateZoomButtons( int ) ) );
+ connect( d->m_routingModel, SIGNAL( currentRouteChanged() ),
+ this, SLOT( updateGuidanceModeButton() ) );
+ d->updateGuidanceModeButton();
}
return AbstractFloatItem::eventFilter( object, e );
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/routing/RoutingPlugin.h #1210271:1210272
@@ -72,6 +72,8 @@
/** Activate or deactivate position tracking */
Q_PRIVATE_SLOT( d, void togglePositionTracking( bool enabled ) )
+ Q_PRIVATE_SLOT( d, void updateGuidanceModeButton() );
+
RoutingPluginPrivate* const d;
};
More information about the Marble-commits
mailing list