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

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


SVN commit 1209152 by tgridel:

CurrentLocationWidget: UI to toggle display and clear the track

 M  +21 -0     CurrentLocationWidget.cpp  
 M  +2 -0      CurrentLocationWidget.h  
 M  +21 -1     CurrentLocationWidget.ui  


--- trunk/KDE/kdeedu/marble/src/lib/CurrentLocationWidget.cpp #1209151:1209152
@@ -52,6 +52,7 @@
     void updateRecenterComboBox( int centerMode );
     void updateAutoZoomCheckBox( bool autoZoom );
     void updateActivePositionProvider( PositionProviderPlugin* );
+    void clearTrack();
 };
 
 CurrentLocationWidget::CurrentLocationWidget( QWidget *parent, Qt::WindowFlags f )
@@ -91,6 +92,8 @@
         QString html = "<p>No Position Tracking Plugin installed.</p>";
         d->m_currentLocationUi.locationLabel->setText( html );
         d->m_currentLocationUi.locationLabel->setEnabled ( true );
+        d->m_currentLocationUi.showTrackCheckBox->setEnabled( false );
+        d->m_currentLocationUi.clearTrackPushButton->setEnabled( false );
     }
 
     //disconnect CurrentLocation Signals
@@ -132,7 +135,16 @@
              this, SLOT( updateRecenterComboBox( int ) ) );
     connect( d->m_adjustNavigation, SIGNAL( autoZoomToggled( bool ) ),
              this, SLOT( updateAutoZoomCheckBox( bool ) ) );
+    connect (d->m_currentLocationUi.showTrackCheckBox, SIGNAL( clicked(bool) ),
+             d->m_widget->model()->positionTracking(), SLOT( setTrackVisible(bool) ));
+    connect (d->m_currentLocationUi.showTrackCheckBox, SIGNAL( clicked(bool) ),
+             d->m_widget, SLOT(repaint()));
+    if ( d->m_widget->model()->positionTracking()->trackVisible() ) {
+        d->m_currentLocationUi.showTrackCheckBox->setCheckState(Qt::Checked);
 }
+    connect (d->m_currentLocationUi.clearTrackPushButton, SIGNAL( clicked(bool)),
+             this, SLOT(clearTrack()));
+}
 
 void CurrentLocationWidgetPrivate::adjustPositionTrackingStatus( PositionProviderStatus status )
 {
@@ -222,6 +234,8 @@
     html = html.arg( position.lonToString() ).arg( position.latToString() );
     html = html.arg( distanceString ).arg( speedString + ' ' + unitString );
     d->m_currentLocationUi.locationLabel->setText( html );
+    d->m_currentLocationUi.showTrackCheckBox->setEnabled( true );
+    d->m_currentLocationUi.clearTrackPushButton->setEnabled( true );
 }
 
 void CurrentLocationWidgetPrivate::changePositionProvider( const QString &provider )
@@ -277,6 +291,13 @@
     m_widget->centerOn(m_currentPosition, true);
 }
 
+void CurrentLocationWidgetPrivate::clearTrack()
+{
+    m_widget->model()->positionTracking()->clearTrack();
+    m_widget->repaint();
+    m_currentLocationUi.clearTrackPushButton->setEnabled( false );
 }
 
+}
+
 #include "CurrentLocationWidget.moc"
--- trunk/KDE/kdeedu/marble/src/lib/CurrentLocationWidget.h #1209151:1209152
@@ -72,6 +72,8 @@
      Q_PRIVATE_SLOT( d, void updateAutoZoomCheckBox( bool autoZoom ) )
 
      Q_PRIVATE_SLOT( d, void updateActivePositionProvider( PositionProviderPlugin* ) )
+
+     Q_PRIVATE_SLOT( d, void clearTrack() )
 };
 
 }
--- trunk/KDE/kdeedu/marble/src/lib/CurrentLocationWidget.ui #1209151:1209152
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>137</width>
-    <height>190</height>
+    <height>237</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -40,6 +40,26 @@
     </widget>
    </item>
    <item>
+    <widget class="QCheckBox" name="showTrackCheckBox">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="text">
+      <string>Show Track</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QPushButton" name="clearTrackPushButton">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="text">
+      <string>Clear Track</string>
+     </property>
+    </widget>
+   </item>
+   <item>
     <widget class="QLabel" name="locationLabel">
      <property name="enabled">
       <bool>false</bool>


More information about the Marble-commits mailing list