[PATCH 3/3] Rename 'firstRowForTrack()' to 'anyRowForTrack()' to emphasize the new semantics.

Nanno Langstraat langstr at gmail.com
Mon Feb 1 15:23:18 CET 2010


---
 src/amarokurls/PlayUrlRunner.cpp         |    2 +-
 src/playlist/PlaylistActions.cpp         |    2 +-
 src/playlist/PlaylistModel.cpp           |    2 +-
 src/playlist/PlaylistModel.h             |    2 +-
 src/playlist/proxymodels/AbstractModel.h |   20 ++++++++++----------
 src/playlist/proxymodels/ProxyBase.cpp   |    4 ++--
 src/playlist/proxymodels/ProxyBase.h     |    6 +++---
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/amarokurls/PlayUrlRunner.cpp b/src/amarokurls/PlayUrlRunner.cpp
index a0d80d1..834ebab 100644
--- a/src/amarokurls/PlayUrlRunner.cpp
+++ b/src/amarokurls/PlayUrlRunner.cpp
@@ -63,7 +63,7 @@ bool PlayUrlRunner::run ( AmarokUrl url )
 
     if( model->containsTrack( track ) )
     {
-        model->setActiveRow( model->firstRowForTrack( track ) );
+        model->setActiveRow( model->anyRowForTrack( track ) );
     }
     else
     {
diff --git a/src/playlist/PlaylistActions.cpp b/src/playlist/PlaylistActions.cpp
index 87ee5cb..248fb74 100644
--- a/src/playlist/PlaylistActions.cpp
+++ b/src/playlist/PlaylistActions.cpp
@@ -408,7 +408,7 @@ Playlist::Actions::engineNewTrackPlaying()
             if ( m_topmostModel->activeTrack() != track )
             {
                  // this will set active row to -1 if the track isn't in the playlist at all
-                qint64 row = m_topmostModel->firstRowForTrack( track );
+                int row = m_topmostModel->anyRowForTrack( track );
                 if( row != -1 )
                     m_topmostModel->setActiveRow( row );
                 else
diff --git a/src/playlist/PlaylistModel.cpp b/src/playlist/PlaylistModel.cpp
index 9652b58..2e20827 100644
--- a/src/playlist/PlaylistModel.cpp
+++ b/src/playlist/PlaylistModel.cpp
@@ -561,7 +561,7 @@ Playlist::Model::containsTrack( const Meta::TrackPtr track ) const
 }
 
 int
-Playlist::Model::firstRowForTrack( const Meta::TrackPtr track ) const
+Playlist::Model::anyRowForTrack( const Meta::TrackPtr track ) const
 {
     // QMultiHash::value() will pick a random matching playlist item.
     Item* item = m_TrackToItems.value( track, NULL );
diff --git a/src/playlist/PlaylistModel.h b/src/playlist/PlaylistModel.h
index a0912a2..ebda8a5 100644
--- a/src/playlist/PlaylistModel.h
+++ b/src/playlist/PlaylistModel.h
@@ -85,7 +85,7 @@ class AMAROK_EXPORT Model : public QAbstractListModel, public Meta::Observer, pu
         Item::State stateOfRow( int row ) const;
 
         bool containsTrack( const Meta::TrackPtr track ) const;
-        int firstRowForTrack( const Meta::TrackPtr track ) const;
+        int anyRowForTrack( const Meta::TrackPtr track ) const;
         QSet<int> allRowsForTrack( const Meta::TrackPtr track ) const;
 
         Meta::TrackPtr trackAt( int row ) const;
diff --git a/src/playlist/proxymodels/AbstractModel.h b/src/playlist/proxymodels/AbstractModel.h
index 204bdf8..e1cc481 100644
--- a/src/playlist/proxymodels/AbstractModel.h
+++ b/src/playlist/proxymodels/AbstractModel.h
@@ -71,13 +71,21 @@ public:
 
     /**
      * Returns all rows in the current model which match a given track pointer.
-     * @see firstRowForTrack
+     * @see anyRowForTrack
      * @param track the track.
-     * @return collection of rows, empty if the track pointer is invalid.
+     * @return collection of rows, empty if the track pointer is not present or invalid.
      */
     virtual QSet<int> allRowsForTrack( const Meta::TrackPtr track ) const = 0;
 
     /**
+     * Returns any row in the current model which matches a given track pointer.
+     * @see allRowsForTrack
+     * @param track the track.
+     * @return the row, or -1 if the track pointer is not present or invalid.
+     */
+    virtual int anyRowForTrack( const Meta::TrackPtr track ) const = 0;
+
+    /**
      * Clears the current search term.
      */
     virtual void clearSearchTerm() {}    //dummy, needed by Playlist::Model
@@ -187,14 +195,6 @@ public:
     virtual int findPrevious( const QString &, int, int ) {return -1; }
 
     /**
-     * Returns the first row in the current model which matches a given track pointer.
-     * @see allRowsForTrack
-     * @param track the track.
-     * @return the row, -1 if the track pointer is invalid.
-     */
-    virtual int firstRowForTrack( const Meta::TrackPtr track ) const = 0;
-
-    /**
      * Returns the item flags for the given index.
      * @param index the index to retrieve the flags for.
      * @return the item flags.
diff --git a/src/playlist/proxymodels/ProxyBase.cpp b/src/playlist/proxymodels/ProxyBase.cpp
index dc2beb0..fae4e73 100644
--- a/src/playlist/proxymodels/ProxyBase.cpp
+++ b/src/playlist/proxymodels/ProxyBase.cpp
@@ -174,9 +174,9 @@ ProxyBase::findPrevious( const QString &searchTerm, int selectedRow, int searchF
 }
 
 int
-ProxyBase::firstRowForTrack( const Meta::TrackPtr track ) const
+ProxyBase::anyRowForTrack( const Meta::TrackPtr track ) const
 {
-    return rowFromSource( m_belowModel->firstRowForTrack( track ) );
+    return rowFromSource( m_belowModel->anyRowForTrack( track ) );
 }
 
 Qt::ItemFlags
diff --git a/src/playlist/proxymodels/ProxyBase.h b/src/playlist/proxymodels/ProxyBase.h
index 85ce133..d61bff3 100644
--- a/src/playlist/proxymodels/ProxyBase.h
+++ b/src/playlist/proxymodels/ProxyBase.h
@@ -71,7 +71,7 @@ public:
 
     /**
      * Returns all rows in the current model which match a given track pointer.
-     * @see firstRowForTrack
+     * @see anyRowForTrack
      * @param track the track.
      * @return collection of rows, empty if the track pointer is invalid.
      */
@@ -188,12 +188,12 @@ public:
     virtual int findPrevious( const QString &searchTerm, int selectedRow, int searchFields );
 
     /**
-     * Returns the first row in the current model which matches a given track pointer.
+     * Returns any row in the current model which matches a given track pointer.
      * @see allRowsForTrack
      * @param track the track.
      * @return the row, -1 if the track pointer is invalid.
      */
-    virtual int firstRowForTrack( const Meta::TrackPtr track ) const;
+    virtual int anyRowForTrack( const Meta::TrackPtr track ) const;
 
     /**
      * Returns the item flags for the given index.
-- 
1.7.0.4


--------------050205060600030001000806--


More information about the Amarok-devel mailing list