[Marble-devel] [PATCH 4/8] dead code

Thibaut GRIDEL tgridel at free.fr
Tue Sep 1 23:24:32 CEST 2009


 9 files changed, 13 insertions(+), 75 deletions(-)

diff --git a/src/lib/AbstractFileViewItem.h b/src/lib/AbstractFileViewItem.h
index 6fc5339..b745341 100644
--- a/src/lib/AbstractFileViewItem.h
+++ b/src/lib/AbstractFileViewItem.h
@@ -27,7 +27,7 @@ class AbstractFileViewItem
     virtual ~AbstractFileViewItem() {};
 
     virtual void saveFile() = 0;
-    virtual void closeFile( int start, bool finalize = true ) = 0;
+    virtual void closeFile( int start ) = 0;
     virtual int size() const { return 0; };
     virtual bool isShown() const = 0;
     virtual void setShown( bool value ) = 0;
diff --git a/src/lib/GpxFileViewItem.cpp b/src/lib/GpxFileViewItem.cpp
index a60bf45..b4ea6b8 100644
--- a/src/lib/GpxFileViewItem.cpp
+++ b/src/lib/GpxFileViewItem.cpp
@@ -55,10 +55,9 @@ void GpxFileViewItem::saveFile()
     stream << ( *m_gpxFile );
 }
 
-void GpxFileViewItem::closeFile( int start, bool finalize )
+void GpxFileViewItem::closeFile( int start )
 {
     Q_UNUSED( start );
-    Q_UNUSED( finalize );
     //TODO
 }
 
diff --git a/src/lib/GpxFileViewItem.h b/src/lib/GpxFileViewItem.h
index dc254f7..4e0c865 100644
--- a/src/lib/GpxFileViewItem.h
+++ b/src/lib/GpxFileViewItem.h
@@ -34,7 +34,7 @@ class GpxFileViewItem
      * AbstractFileViewItem methods
      */
     virtual void saveFile();
-    virtual void closeFile( int start, bool finalize = true );
+    virtual void closeFile( int start );
     virtual bool isShown() const;
     virtual void setShown( bool value );
     virtual QString name() const;
diff --git a/src/lib/KmlFileViewItem.cpp b/src/lib/KmlFileViewItem.cpp
index 6d75771..d90d838 100644
--- a/src/lib/KmlFileViewItem.cpp
+++ b/src/lib/KmlFileViewItem.cpp
@@ -42,10 +42,10 @@ GeoDataDocument* KmlFileViewItem::document()
     return &m_document;
 }
 
-void KmlFileViewItem::closeFile( int start, bool finalize )
+void KmlFileViewItem::closeFile( int start )
 {
     qDebug() << "closing file" << m_document.name() << m_document.fileName();
-    m_fileManager.dataFacade()->placemarkModel()->removePlacemarks( m_document.fileName(), start, size(), finalize );
+    m_fileManager.dataFacade()->placemarkModel()->removePlacemarks( m_document.fileName(), start, size() );
 }
 
 int KmlFileViewItem::size() const
diff --git a/src/lib/KmlFileViewItem.h b/src/lib/KmlFileViewItem.h
index 505c698..b2053ba 100644
--- a/src/lib/KmlFileViewItem.h
+++ b/src/lib/KmlFileViewItem.h
@@ -31,7 +31,7 @@ class KmlFileViewItem : public AbstractFileViewItem
      * AbstractFileViewItem methods
      */
     virtual void saveFile();
-    virtual void closeFile( int start, bool finalize = true );
+    virtual void closeFile( int start );
     virtual bool isShown() const;
     virtual void setShown( bool value );
     virtual int size() const;
diff --git a/src/lib/MarblePlacemarkModel.cpp b/src/lib/MarblePlacemarkModel.cpp
index a002a67..8746002 100644
--- a/src/lib/MarblePlacemarkModel.cpp
+++ b/src/lib/MarblePlacemarkModel.cpp
@@ -52,7 +52,7 @@ MarblePlacemarkModel::MarblePlacemarkModel( QObject *parent )
 
 MarblePlacemarkModel::~MarblePlacemarkModel()
 {
-    clearPlacemarks();
+    d->m_placemarkContainer.clear();
     delete d;
 }
 
@@ -73,24 +73,6 @@ int MarblePlacemarkModel::columnCount( const QModelIndex &parent ) const
         return 0;
 }
 
-GeoDataCoordinates MarblePlacemarkModel::coordinateData( const QModelIndex &index ) const
-{
-    if ( !index.isValid() ) {
-        qDebug() << "MarblePlacemarkModel: Error - index invalid";
-        return GeoDataCoordinates();
-    }
-    return d->m_placemarkContainer.at( index.row() ).coordinate();
-}
-
-GeoDataStyle* MarblePlacemarkModel::styleData( const QModelIndex &index ) const
-{
-    if ( !index.isValid() )
-        return 0;
-    else {
-        return d->m_placemarkContainer.at( index.row() ).style();
-    }
-}
-
 QVariant MarblePlacemarkModel::data( const QModelIndex &index, int role ) const
 {
     if ( !index.isValid() )
@@ -167,23 +149,11 @@ QModelIndexList MarblePlacemarkModel::approxMatch( const QModelIndex & start, in
     return results;
 }
 
-void MarblePlacemarkModel::addPlacemarks( QVector<Marble::GeoDataPlacemark> &placemarks,
-                                          bool clearPrevious,
-                                          bool finalize )
+void MarblePlacemarkModel::addPlacemarks( QVector<Marble::GeoDataPlacemark> &placemarks )
 {
-    Q_UNUSED( finalize )
-
     if( placemarks.count() <= 0 )
         return;
 
-    if ( clearPrevious ) {
-        beginRemoveRows( QModelIndex(), 0, rowCount() );
-
-        d->m_placemarkContainer.clear();
-
-        endRemoveRows();
-    }
-
     const int length = d->m_placemarkContainer.count();
     beginInsertRows( QModelIndex(), length, length + placemarks.count() - 1 );
     createFilterProperties( placemarks );
@@ -196,11 +166,8 @@ void MarblePlacemarkModel::addPlacemarks( QVector<Marble::GeoDataPlacemark> &pla
 
 void  MarblePlacemarkModel::removePlacemarks( const QString &containerName,
                                               int start,
-                                              int length,
-                                              bool finalize )
+                                              int length )
 {
-    Q_UNUSED( finalize )
-
     QTime t;
     t.start();
 
@@ -215,17 +182,6 @@ void  MarblePlacemarkModel::removePlacemarks( const QString &containerName,
     qDebug() << "removePlacemarks(" << containerName << "): Time elapsed:" << t.elapsed() << "ms for" << length << "Placemarks.";
 }
 
-QStringList MarblePlacemarkModel::containers() const
-{
-    return QStringList();
-}
-
-void MarblePlacemarkModel::clearPlacemarks()
-{
-    d->m_placemarkContainer.clear();
-    reset();
-}
-
 void MarblePlacemarkModel::createFilterProperties( QVector<Marble::GeoDataPlacemark> &container )
 {
 
diff --git a/src/lib/MarblePlacemarkModel.h b/src/lib/MarblePlacemarkModel.h
index fb31d38..b76d5fe 100644
--- a/src/lib/MarblePlacemarkModel.h
+++ b/src/lib/MarblePlacemarkModel.h
@@ -80,9 +80,6 @@ class MARBLE_EXPORT MarblePlacemarkModel : public QAbstractListModel
     int rowCount( const QModelIndex &parent = QModelIndex() ) const;
     int columnCount( const QModelIndex &parent = QModelIndex() ) const;
 
-    Marble::GeoDataCoordinates coordinateData( const QModelIndex &index ) const;
-    Marble::GeoDataStyle* styleData( const QModelIndex &index ) const;
-
     /**
      * Return the data according to the index.
      *
@@ -101,9 +98,7 @@ class MARBLE_EXPORT MarblePlacemarkModel : public QAbstractListModel
      *
      * Note: The model takes ownership of the place marks!
      */
-    void addPlacemarks( QVector<Marble::GeoDataPlacemark> &placemarks,
-                        bool clearPrevious = false,
-                        bool finalize = true );
+    void addPlacemarks( QVector<Marble::GeoDataPlacemark> &placemarks );
 
     /**
      * This method is used by the PlacemarkManager to remove
@@ -113,13 +108,7 @@ class MARBLE_EXPORT MarblePlacemarkModel : public QAbstractListModel
      */
     void removePlacemarks( const QString &containerName,
                            int start,
-                           int length,
-                           bool finalize = true );
-
-    /**
-    * This method returns a list of open Containers (== open kml files)
-    */
-    QStringList containers() const;
+                           int length );
 
  Q_SIGNALS:
     /**
@@ -129,12 +118,6 @@ class MARBLE_EXPORT MarblePlacemarkModel : public QAbstractListModel
 
  private:
 
-    /**
-     * This method is used by the PlacemarkManager to clear
-     * the model.
-     */
-    void clearPlacemarks();
-    
     void createFilterProperties( QVector<Marble::GeoDataPlacemark> &container );
 
     Q_DISABLE_COPY( MarblePlacemarkModel )
diff --git a/src/lib/MarbleRunnerManager.cpp b/src/lib/MarbleRunnerManager.cpp
index f237c11..2045efd 100644
--- a/src/lib/MarbleRunnerManager.cpp
+++ b/src/lib/MarbleRunnerManager.cpp
@@ -94,7 +94,7 @@ void MarbleRunnerManager::slotRunnerFinished( MarbleAbstractRunner* runner, QVec
     if( result.isEmpty() )
         return;
 
-    m_model->addPlacemarks( result, false );
+    m_model->addPlacemarks( result );
 
     emit modelChanged( m_model );
 }
diff --git a/src/lib/PlacemarkManager.cpp b/src/lib/PlacemarkManager.cpp
index 07418dd..37a3fc1 100644
--- a/src/lib/PlacemarkManager.cpp
+++ b/src/lib/PlacemarkManager.cpp
@@ -77,7 +77,7 @@ void PlacemarkManager::addGeoDataDocument(const GeoDataDocument &document)
     { 
 //        d->m_placemarkContainer << document->placemarks();
         QVector<GeoDataPlacemark> result = document.placemarks();
-        d->m_datafacade->placemarkModel()->addPlacemarks( result, false );
+        d->m_datafacade->placemarkModel()->addPlacemarks( result );
     }
 }
 
-- 
1.6.3.3





More information about the Marble-devel mailing list