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

Dennis Nienhüser earthwings at gentoo.org
Thu Oct 21 22:20:14 CEST 2010


SVN commit 1188261 by nienhueser:

Move route export method from RoutingWidget to RoutingLayer.
CCBUG: 248086

 M  +18 -2     RoutingLayer.cpp  
 M  +3 -5      RoutingLayer.h  
 M  +0 -16     RoutingWidget.cpp  
 M  +0 -3      RoutingWidget.h  


--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingLayer.cpp #1188260:1188261
@@ -23,7 +23,6 @@
 #include "MarbleModel.h"
 #include "AlternativeRoutesModel.h"
 
-
 #include <QtCore/QMap>
 #include <QtGui/QAbstractProxyModel>
 #include <QtGui/QIcon>
@@ -33,6 +32,7 @@
 #include <QtGui/QMouseEvent>
 #include <QtGui/QPixmap>
 #include <QtGui/QComboBox>
+#include <QtGui/QFileDialog>
 
 namespace Marble
 {
@@ -177,7 +177,7 @@
     QObject::connect( m_removeViaPointAction, SIGNAL( triggered() ), q, SLOT( removeViaPoint() ) );
     m_contextMenu->addAction( Qt::RightButton, m_removeViaPointAction );
     QAction *exportAction = new QAction( QObject::tr( "&Export route..." ), q );
-    QObject::connect( exportAction, SIGNAL( triggered() ), q, SIGNAL( exportRequested() ) );
+    QObject::connect( exportAction, SIGNAL( triggered() ), q, SLOT( exportRoute() ) );
     m_contextMenu->addAction( Qt::RightButton, exportAction );
     if ( MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen ) {
         m_pixmapSize = QSize( 38, 38 );
@@ -776,6 +776,22 @@
     d->m_marbleWidget->repaint();
 }
 
+void RoutingLayer::exportRoute()
+{
+    QString fileName = QFileDialog::getSaveFileName( d->m_marbleWidget,
+                       tr( "Export Route" ), // krazy:exclude=qclasses
+                       QDir::homePath(),
+                       tr( "GPX files (*.gpx)" ) );
+
+    if ( d->m_routingModel && !fileName.isEmpty() ) {
+        QFile gpx( fileName );
+        if ( gpx.open( QFile::WriteOnly) ) {
+            d->m_routingModel->exportGpx( &gpx );
+            gpx.close();
+        }
+    }
+}
+
 } // namespace Marble
 
 #include "RoutingLayer.moc"
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingLayer.h #1188260:1188261
@@ -122,11 +122,6 @@
       */
     void routeDirty();
 
-    /**
-      * Route should be exported
-      */
-    void exportRequested();
-
 protected:
     /** Overriding QWidget, used to make the layer interactive */
     bool eventFilter( QObject *obj, QEvent *event );
@@ -136,6 +131,9 @@
 
     void showAlternativeRoads();
 
+    /** Export route to a file */
+    void exportRoute();
+
 private:
     RoutingLayerPrivate *const d;
     friend class RoutingLayerPrivate;
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.cpp #1188260:1188261
@@ -28,7 +28,6 @@
 
 #include <QtCore/QTime>
 #include <QtCore/QTimer>
-#include <QtGui/QFileDialog>
 #include <QtGui/QSortFilterProxyModel>
 #include <QtGui/QComboBox>
 #include <QtGui/QPainter>
@@ -475,21 +474,6 @@
     }
 }
 
-void RoutingWidget::exportRoute()
-{
-    QString fileName = QFileDialog::getSaveFileName( this, tr( "Export Route" ), // krazy:exclude=qclasses
-                       QDir::homePath(),
-                       tr( "GPX files (*.gpx)" ) );
-
-    if ( !fileName.isEmpty() ) {
-        QFile gpx( fileName );
-        if ( gpx.open( QFile::WriteOnly) ) {
-            d->m_routingManager->routingModel()->exportGpx( &gpx );
-            gpx.close();
-        }
-    }
-}
-
 void RoutingWidget::setWorkOffline( bool offline )
 {
     foreach ( RoutingInputWidget *widget, d->m_inputWidgets ) {
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.h #1188260:1188261
@@ -98,9 +98,6 @@
     /** show profile configuration dialog */
     void configureProfile();
 
-    /** Export route to a file */
-    void exportRoute();
-
     /** Progress animation update */
     void updateProgress();
 


More information about the Marble-commits mailing list