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

Dennis Nienhüser earthwings at gentoo.org
Mon Nov 1 12:01:21 CET 2010


SVN commit 1191880 by nienhueser:

Deprecate (doxygen only because it is a slot) openGpxFile in favor of addGeoDataFile.
Deprecate addPlacemarkFile in favor of addGeoDataFile
Deprecate addPlacemarkData in favor of addGeoDataString
Deprecate removePlacemarkKey in favor of removeGeoData
Make addGeoDataFile, addGeoDataString, removeGeoData slots to be able to call them via DBus.
RB: 5691
BUG: 253305

 M  +1 -1      ControlView.h  
 M  +1 -5      MarbleTest.cpp  
 M  +1 -9      QtMainWindow.cpp  
 M  +1 -1      kdemain.cpp  
 M  +18 -4     lib/MarbleMap.cpp  
 M  +28 -5     lib/MarbleMap.h  
 M  +26 -11    lib/MarbleModel.cpp  
 M  +23 -4     lib/MarbleModel.h  
 M  +20 -5     lib/MarbleWidget.cpp  
 M  +27 -4     lib/MarbleWidget.h  
 M  +1 -8      marble_part.cpp  
 M  +7 -14     plugins/render/fileview/FileViewFloatItem.cpp  
 M  +1 -1      qtmain.cpp  


--- trunk/KDE/kdeedu/marble/src/ControlView.h #1191879:1191880
@@ -58,7 +58,7 @@
 
     bool setSideBarState( const QByteArray &state );
 
-    void addPlacemarkFile( QString filename ) { m_marbleWidget->addPlacemarkFile( filename ); }
+    void addGeoDataFile( QString filename ) { m_marbleWidget->addGeoDataFile( filename ); }
 
     QPixmap mapScreenShot() { return m_marbleWidget->mapScreenShot(); }
     
--- trunk/KDE/kdeedu/marble/src/MarbleTest.cpp #1191879:1191880
@@ -94,12 +94,8 @@
             "GPS Data (*.gpx);;KML (*.kml)");
     
     if ( ! fileName.isNull() ) {
-        QString extension = fileName.section( '.', -1 );
-
-        if ( extension.compare( "gpx", Qt::CaseInsensitive ) == 0 ) {
-            m_marbleWidget->openGpxFile( fileName );
+        m_marbleWidget->addGeoDataFile( fileName );
         }
-    }
    
     QTime t;
     QTime totalTime;
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1191879:1191880
@@ -807,17 +807,9 @@
                             tr("All Supported Files (*.gpx *.kml *.pnt);;GPS Data (*.gpx);;Google Earth KML (*.kml);; Micro World Database II (*.pnt)"));
 
     foreach( const QString &fileName, fileNames ) {
-        QString extension = fileName.section( '.', -1 );
-
-        if ( extension.compare( "gpx", Qt::CaseInsensitive ) == 0 ) {
-            m_controlView->marbleWidget()->openGpxFile( fileName );
+        m_controlView->marbleWidget()->addGeoDataFile( fileName );
         }
-        else
-        {
-            m_controlView->marbleWidget()->addPlacemarkFile( fileName );
         }
-    }
-}
 
 void MainWindow::setupStatusBar()
 {
--- trunk/KDE/kdeedu/marble/src/kdemain.cpp #1191879:1191880
@@ -339,7 +339,7 @@
 
         // FIXME: Use openUrl( args->url(i) ) instead?
         if ( QFile::exists( args->arg( i ) ) )
-            window->marbleControl()->addPlacemarkFile( args->arg( i ) );
+            window->marbleControl()->addGeoDataFile( args->arg( i ) );
     }
 
     return app.exec();
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.cpp #1191879:1191880
@@ -442,17 +442,17 @@
 
 void MarbleMap::addPlacemarkFile( const QString &filename )
 {
-    d->m_model->addPlacemarkFile( filename );
+    addGeoDataFile( filename );
 }
 
 void MarbleMap::addPlacemarkData( const QString &data, const QString &key )
 {
-    d->m_model->addPlacemarkData( data, key );
+    addGeoDataString( data, key );
 }
 
 void MarbleMap::removePlacemarkKey( const QString &key )
 {
-    d->m_model->removePlacemarkKey( key );
+    removeGeoData( key );
 }
 
 
@@ -918,7 +918,7 @@
 
 void MarbleMap::openGpxFile( const QString &filename )
 {
-    d->m_model->openGpxFile( filename );
+    addGeoDataFile( filename );
 }
 
 FileViewModel* MarbleMap::fileViewModel() const
@@ -1086,5 +1086,19 @@
     return d->zoom( radiusFromDistance( distance ) );
 }
 
+void MarbleMap::addGeoDataFile( const QString &filename )
+{
+    d->m_model->addGeoDataFile( filename );
+}
 
+void MarbleMap::addGeoDataString( const QString& data, const QString& key )
+{
+    d->m_model->addGeoDataString( data, key );
+}
+
+void MarbleMap::removeGeoData( const QString& key )
+{
+    d->m_model->removeGeoData( key );
+}
+
 #include "MarbleMap.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.h #1191879:1191880
@@ -226,23 +226,26 @@
     QItemSelectionModel *placemarkSelectionModel() const;
 
     /**
-     * @brief  Add a GeoDataPlacemark file to the model.
+     * @brief  Add a GeoData file to the model. Supported file types are .pnt, .gpx and .kml
      * @param  filename  the filename of the file containing the Placemarks.
+     * @deprecated This method has been renamed addGeoDataFile
      */
-    void addPlacemarkFile( const QString &filename );
+    MARBLE_DEPRECATED( void addPlacemarkFile( const QString &filename ) );
 
     /**
-     * @brief  Add GeoDataPlacemark data as string to the model.
+     * @brief  Add GeoData data as string to the model.
      * @param  data  the string containing the Placemarks.
      * @param key  the string needed to identify the data
+     * @deprecated This method has been renamed addGeoDataString
      */
-    void addPlacemarkData( const QString& data, const QString& key = "data" );
+    MARBLE_DEPRECATED( void addPlacemarkData( const QString& data, const QString& key = "data" ) );
     
     /**
      * @brief  remove data or files from the model.
      * @param key  either the filename or the string used to identify the data in addPlacemarkFile and addPlacemarkData
+     * @deprecated This method has been renamed removeGeoData
      */
-    void removePlacemarkKey( const QString& key );
+    MARBLE_DEPRECATED( void removePlacemarkKey( const QString& key ) );
 
     /**
      * @brief  Return the quaternion that specifies the rotation of the globe.
@@ -680,10 +683,30 @@
 
     /**
      * @brief Opens a gpx file for viewing on the Marble Map
+     * @deprecated Please use addGeoDataFile instead
      */
     void openGpxFile( const QString &filename );
 
     /**
+     * @brief  Add a GeoData file to the model. Supported file types are .pnt, .gpx and .kml
+     * @param  filename  the filename of the file containing the data to be loaded.
+     */
+    void addGeoDataFile( const QString &filename );
+
+    /**
+     * @brief  Add GeoData data as string to the model.
+     * @param  data  the string containing the Placemarks.
+     * @param key  the string needed to identify the data
+     */
+    void addGeoDataString( const QString& data, const QString& key = "data" );
+
+    /**
+     * @brief  remove data or files from the model.
+     * @param key  either the filename or the string used to identify the data in addGeoDataFile and addGeoDataString
+     */
+    void removeGeoData( const QString& key );
+
+    /**
      * @brief Return a QAbstractItemModel containing files.
      */
     FileViewModel* fileViewModel() const;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1191879:1191880
@@ -804,28 +804,22 @@
 
 void MarbleModel::openGpxFile( const QString& filename )
 {
-    d->m_fileManager->addFile( filename );
+    addGeoDataFile( filename );
 }
 
 void MarbleModel::addPlacemarkFile( const QString& filename )
 {
-    d->m_fileManager->addFile( filename );
-
-    d->notifyModelChanged();
+    addGeoDataFile( filename );
 }
 
 void MarbleModel::addPlacemarkData( const QString& data, const QString& key )
 {
-    d->m_fileManager->addData( key, data );
-
-    d->notifyModelChanged();
+    addGeoDataString( data, key );
 }
 
-void MarbleModel::removePlacemarkKey( const QString& fileName )
+void MarbleModel::removePlacemarkKey( const QString& key )
 {
-    d->m_fileManager->removeFile( fileName );
-
-    d->notifyModelChanged();
+    removeGeoData( key );
 }
 
 QVector<QModelIndex> MarbleModel::whichFeatureAt( const QPoint& curpos ) const
@@ -1265,6 +1259,27 @@
     d->m_backgroundVisible = visible;
 }
 
+void MarbleModel::addGeoDataFile( const QString& filename )
+{
+    d->m_fileManager->addFile( filename );
+
+    d->notifyModelChanged();
 }
 
+void MarbleModel::addGeoDataString( const QString& data, const QString& key )
+{
+    d->m_fileManager->addData( key, data );
+
+    d->notifyModelChanged();
+}
+
+void MarbleModel::removeGeoData( const QString& fileName )
+{
+    d->m_fileManager->removeFile( fileName );
+
+    d->notifyModelChanged();
+}
+
+}
+
 #include "MarbleModel.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.h #1191879:1191880
@@ -224,11 +224,30 @@
 
     HttpDownloadManager* downloadManager() const;
 
-    void openGpxFile( const QString& filename );
-    void addPlacemarkFile( const QString& filename );
-    void addPlacemarkData( const QString& data, const QString& key = "data" );
-    void removePlacemarkKey( const QString& key );
+    /**
+      * @deprecated Please use addGeoDataFile instead
+      */
+    MARBLE_DEPRECATED( void openGpxFile( const QString& filename ) );
 
+    /**
+      * @deprecated Please use addGeoDataFile instead
+      */
+    MARBLE_DEPRECATED( void addPlacemarkFile( const QString& filename ) );
+
+    /**
+      * @deprecated Please use addGeoDataString instead
+      */
+    MARBLE_DEPRECATED( void addPlacemarkData( const QString& data, const QString& key = "data" ) );
+
+    /**
+      * @deprecated Please use removeGeoData instead
+      */
+    MARBLE_DEPRECATED( void removePlacemarkKey( const QString& key ) );
+
+    void addGeoDataFile( const QString& filename );
+    void addGeoDataString( const QString& data, const QString& key = "data" );
+    void removeGeoData( const QString& key );
+
     QVector<QModelIndex> whichFeatureAt( const QPoint& ) const;
 
     PlacemarkLayout    *placemarkLayout()   const;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1191879:1191880
@@ -376,18 +376,17 @@
 
 void MarbleWidget::addPlacemarkFile( const QString &filename )
 {
-    d->m_map->addPlacemarkFile( filename );
-    //d->m_model->addPlacemarkFile( filename );
+    addGeoDataFile( filename );
 }
 
 void MarbleWidget::addPlacemarkData( const QString &data, const QString &key )
 {
-    d->m_map->addPlacemarkData( data, key );
+    addGeoDataString( data, key );
 }
 
 void MarbleWidget::removePlacemarkKey( const QString &key )
 {
-    d->m_map->removePlacemarkKey( key );
+    removeGeoData( key );
 }
 
 QPixmap MarbleWidget::mapScreenShot()
@@ -1007,7 +1006,7 @@
 
 void MarbleWidget::openGpxFile( const QString &filename )
 {
-    d->m_map->openGpxFile( filename );
+    addGeoDataFile( filename );
 }
 
 FileViewModel* MarbleWidget::fileViewModel() const
@@ -1353,6 +1352,22 @@
     return d->m_routingLayer;
 }
              
+void MarbleWidget::addGeoDataFile( const QString &filename )
+{
+    d->m_map->addGeoDataFile( filename );
+    //d->m_model->addGeoDataFile( filename );
 }
 
+void MarbleWidget::addGeoDataString( const QString &data, const QString &key )
+{
+    d->m_map->addGeoDataString( data, key );
+}
+
+void MarbleWidget::removeGeoData( const QString &key )
+{
+    d->m_map->removeGeoData( key );
+}
+
+}
+
 #include "MarbleWidget.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.h #1191879:1191880
@@ -302,23 +302,26 @@
     qreal moveStep();
 
     /**
-     * @brief  Add a GeoDataPlacemark file to the model.
+     * @brief  Add a GeoDataPlacemark file to the model. Supported file types are .pnt, .gpx and .kml
      * @param  filename  the filename of the file containing the Placemarks.
+     * @deprecated Please use addGeoDataFile instead
      */
-    void addPlacemarkFile( const QString &filename );
+    MARBLE_DEPRECATED( void addPlacemarkFile( const QString &filename ) );
 
     /**
      * @brief  Add GeoDataPlacemark data as string to the model.
      * @param  data  the string containing the Placemarks.
      * @param key  the string needed to identify the data
+     * @deprecated Please use addGeoDataString instead
      */
-    void addPlacemarkData( const QString& data, const QString& key = "data" );
+    MARBLE_DEPRECATED( void addPlacemarkData( const QString& data, const QString& key = "data" ) );
     
     /**
      * @brief  remove data or files from the model.
      * @param key  either the filename or the string used to identify the data in addPlacemarkFile and addPlacemarkData
+     * @deprecated Please use removeGeoData instead
      */
-    void removePlacemarkKey( const QString& key );
+    MARBLE_DEPRECATED( void removePlacemarkKey( const QString& key ) );
 
     /**
      * @brief  Return the quaternion that specifies the rotation of the globe.
@@ -861,9 +864,29 @@
 
     /**
      * @brief Opens a gpx file for viewing on the Marble Widget
+     * @deprecated Please use addGeoDataFile instead
      */
     void openGpxFile( const QString &filename );
 
+    /**
+     * @brief  Add a GeoData file to the model. Supported file types are .pnt, .gpx and .kml
+     * @param  filename  the filename of the file containing the data to be loaded.
+     */
+    void addGeoDataFile( const QString &filename );
+
+    /**
+     * @brief  Add GeoData data as string to the model.
+     * @param  data  the string containing the Placemarks.
+     * @param key  the string needed to identify the data
+     */
+    void addGeoDataString( const QString& data, const QString& key = "data" );
+
+    /**
+     * @brief  remove data or files from the model.
+     * @param key  either the filename or the string used to identify the data in addGeoDataFile and addGeoDataString
+     */
+    void removeGeoData( const QString& key );
+
     void clearPersistentTileCache();
     /**
      * @brief  Set the limit of the persistent (on hard disc) tile cache.
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1191879:1191880
@@ -207,15 +207,8 @@
                                             widget(), i18n("Open File")
                                            );
     foreach( const QString &fileName, fileNames ) {
-        QString extension = fileName.section( '.', -1 );
-
-        if ( extension.compare( "gpx", Qt::CaseInsensitive ) == 0 ) {
-            m_controlView->marbleWidget()->openGpxFile( fileName );
+        m_controlView->marbleWidget()->addGeoDataFile( fileName );
         }
-        else if ( extension.compare( "kml", Qt::CaseInsensitive ) == 0 ) {
-            m_controlView->marbleWidget()->addPlacemarkFile( fileName );
-        }
-    }
 
     return true;
 }
--- trunk/KDE/kdeedu/marble/src/plugins/render/fileview/FileViewFloatItem.cpp #1191879:1191880
@@ -19,6 +19,7 @@
 #include <QtGui/QMenu>
 #include <QtGui/QPixmap>
 #include <QtGui/QSlider>
+#include <QtGui/QMouseEvent>
 
 #include "MarbleDebug.h"
 #include "FileViewModel.h"
@@ -215,9 +216,9 @@
     // We need the global position to move the menu.
     // pos contains the relative position.
     test->move( m_itemPosition );
-    connect( test->addAction( tr( "Open new kml file..." ) ), SIGNAL( triggered() ),
+    connect( test->addAction( tr( "Open file..." ) ), SIGNAL( triggered() ),
              this, SLOT( addFile() ) );
-    connect( test->addAction( tr( "close this kml file..." ) ), SIGNAL( triggered() ),
+    connect( test->addAction( tr( "Close this file" ) ), SIGNAL( triggered() ),
              this, SLOT( removeFile() ) );
     m_persIndex = new QPersistentModelIndex( m_fileView->indexAt( pos ) );
     test->exec();
@@ -228,24 +229,16 @@
     QString fileName;
     fileName = QFileDialog::getOpenFileName(m_marbleWidget, tr("Open File"),
                             QString(), 
-                            tr("All Supported Files (*.gpx *.kml);;GPS Data (*.gpx);;Google Earth KML (*.kml)"));
+                                            tr("All Supported Files (*.gpx *.kml *.pnt);;GPS Data (*.gpx);;Google Earth KML (*.kml);PNT Data (*.pnt)"));
 
-    if ( ! fileName.isNull() ) {
-        QString extension = fileName.section( '.', -1 );
-
-/*        if ( extension.compare( "gpx", Qt::CaseInsensitive ) == 0 ) {
-            m_marbleWidget->openGpxFile( fileName );
+    if ( ! fileName.isEmpty() ) {
+        m_marbleWidget->addGeoDataFile( fileName );
         }
-        else */
-        if ( extension.compare( "kml", Qt::CaseInsensitive ) == 0 ) {
-            m_marbleWidget->addPlacemarkFile( fileName );
         }
-    }
-}
 
 void FileViewFloatItem::removeFile()
 {
-    reinterpret_cast<FileViewModel*>(m_fileView->model())->setSelectedIndex( *m_persIndex );
+    //reinterpret_cast<FileViewModel*>(m_fileView->model())->setSelectedIndex( *m_persIndex );
     mDebug() << m_fileView->model()->data( *m_persIndex, Qt::DisplayRole ).toString();
     // close selected file
     reinterpret_cast<FileViewModel*>(m_fileView->model())->closeFile();
--- trunk/KDE/kdeedu/marble/src/qtmain.cpp #1191879:1191880
@@ -156,7 +156,7 @@
 	    window->marbleControl()->marbleWidget()->setShowTileId(true);
         }
         else if ( i != dataPathIndex && QFile::exists( arg ) )
-            ( window->marbleControl() )->addPlacemarkFile( arg );
+            ( window->marbleControl() )->addGeoDataFile( arg );
     }
 
     delete marbleTest;


More information about the Marble-commits mailing list