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

Dennis Nienhüser earthwings at gentoo.org
Wed Oct 13 20:45:48 CEST 2010


SVN commit 1185565 by nienhueser:

Select the first routing profile if none is selected by the user yet

 M  +12 -0     RoutingWidget.cpp  
 M  +3 -0      RoutingWidget.h  


--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.cpp #1185564:1185565
@@ -192,6 +192,10 @@
 
     d->m_ui.routingProfileComboBox->setModel( d->m_routingManager->profilesModel() );
 
+    connect( d->m_routingManager->profilesModel(), SIGNAL( rowsInserted( QModelIndex, int, int ) ),
+             this, SLOT( selectFirstProfile() ) );
+    connect( d->m_routingManager->profilesModel(), SIGNAL( modelReset() ),
+             this, SLOT( selectFirstProfile() ) );
     connect( d->m_routingManager->alternativeRoutesModel(), SIGNAL( currentRouteChanged( GeoDataDocument* ) ),
              d->m_widget, SLOT( repaint() ) );
     connect( d->m_routingLayer, SIGNAL( placemarkSelected( QModelIndex ) ),
@@ -559,6 +563,14 @@
     d->m_routingManager->setGuidanceModeEnabled( enabled );
 }
 
+void RoutingWidget::selectFirstProfile()
+{
+    int count = d->m_routingManager->profilesModel()->rowCount();
+    if ( count && d->m_ui.routingProfileComboBox->currentIndex() < 0 ) {
+        d->m_ui.routingProfileComboBox->setCurrentIndex( 0 );
+    }
+}
+
 } // namespace Marble
 
 #include "RoutingWidget.moc"
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.h #1185564:1185565
@@ -113,6 +113,9 @@
     /** Toggle turn by turn navigation mode */
     void setGuidanceModeEnabled( bool enabled );
 
+    /** Select the first routing profile if none is selected yet */
+    void selectFirstProfile();
+
 private:
     RoutingWidgetPrivate *const d;
 };


More information about the Marble-commits mailing list