[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/playlist/proxymodels
From:       Teo Mrnjavac <teo.mrnjavac () gmail ! com>
Date:       2009-06-30 12:36:18
Message-ID: 1246365378.150086.27018.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 989503 by mrnjavac:

Moved find() forwarder from proxies to Playlist::ProxyBase.

 M  +0 -5      FilterProxy.cpp  
 M  +0 -1      FilterProxy.h  
 M  +0 -5      GroupingProxy.cpp  
 M  +0 -1      GroupingProxy.h  
 M  +6 -0      ProxyBase.cpp  
 M  +17 -4     ProxyBase.h  
 M  +0 -6      SortProxy.cpp  
 M  +0 -11     SortProxy.h  


--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/FilterProxy.cpp #989502:989503
@@ -216,11 +216,6 @@
     return m_belowModel->trackAt( rowToSource( row ) );
 }
 
-int FilterProxy::find( const QString &searchTerm, int searchFields )
-{
-    return rowFromSource( m_belowModel->find( searchTerm, searchFields ) );
-}
-
 int FilterProxy::findNext( const QString & searchTerm, int selectedRow, int searchFields )
 {
     return rowFromSource( m_belowModel->findNext( searchTerm, selectedRow, searchFields ) );
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/FilterProxy.h #989502:989503
@@ -107,7 +107,6 @@
     QStringList mimeTypes() const;
     QMimeData* mimeData( const QModelIndexList& ) const;
 
-    int find( const QString & searchTerm, int searchFields );
     int findNext( const QString & searchTerm, int selectedRow, int searchFields );
     int findPrevious( const QString & searchTerm, int selectedRow, int searchFields );
     int totalLength() const;
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/GroupingProxy.cpp #989502:989503
@@ -302,11 +302,6 @@
     return false;
 }
 
-int Playlist::GroupingProxy::find( const QString &searchTerm, int fields  )
-{
-    return m_belowModel->find( searchTerm, fields );
-}
-
 int Playlist::GroupingProxy::findNext( const QString &searchTerm, int selectedRow, int fields  )
 {
     return m_belowModel->findNext( searchTerm, selectedRow, fields );
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/GroupingProxy.h #989502:989503
@@ -90,7 +90,6 @@
     int tracksInGroup( int row ) const;
     int lengthOfGroup( int row ) const;
 
-    int find( const QString & searchTerm, int fields );
     int findNext( const QString & searchTerm, int selectedRow, int fields  );
     int findPrevious( const QString & searchTerm, int selectedRow, int fields  );
 
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/ProxyBase.cpp #989502:989503
@@ -91,6 +91,12 @@
     ( ( ProxyBase *)m_belowModel )->filterUpdated();
 }
 
+int
+ProxyBase::find( const QString &searchTerm, int searchFields )
+{
+    return rowFromSource( m_belowModel->find( searchTerm, searchFields ) );
+}
+
 }   //namespace Playlist
 
 #include "ProxyBase.moc"
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/ProxyBase.h #989502:989503
@@ -109,16 +109,28 @@
      */
     virtual void filterUpdated();
 
+    /**
+     * Forwards a search down through the stack of ProxyModels.
+     * Find the first track in the playlist that matches the search term in one of the
+     * specified search fields. Playlist::Model::find() emits found() or notFound() depending
+     * on whether a match is found.
+     * @param searchTerm The term to search for.
+     * @param searchFields A bitmask specifying the fields to look in.
+     * @return The row of the first found match, -1 if no match is found.
+     */
+    virtual int find( const QString &searchTerm, int searchFields );
 
+
 //FIXME: When every proxy talks only to the proxy below it, these should be made protected
 //       here and and in subclasses that reimplement them. For now, they have to be public
 //       otherwise it won't compile.    -- Téo 21/6/2009
 //protected:
     /**
      * Converts a row index that's valid in the proxy below this one to a row index valid
-     * in this proxy, with sanity checks.
+     * in this proxy.
      * The default implementation returns the same row, and results in a perfectly pass-
-     * -through proxy.
+     * -through proxy. Reimplement this method with mapFromSource and sanity checks if your
+     * proxy adds, removes or sorts rows.
      * @param row the row index to be converted.
      * @return the index of the row that's valid in this proxy.
      */
@@ -127,9 +139,10 @@
 
     /**
      * Converts a row index that's valid in this proxy to a row index valid in the proxy
-     * below this one, with sanity checks.
+     * below this one.
      * The default implementation returns the same row, and results in a perfectly pass-
-     * -through proxy.
+     * -through proxy. Reimplement this method with mapToSource and sanity checks if your
+     * proxy adds, removes or sorts rows.
      * @param row the row index to be converted.
      * @return the index of the row that's valid in the proxy below this one.
      */
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/SortProxy.cpp #989502:989503
@@ -81,12 +81,6 @@
 // Please keep them sorted alphabetically.  -- Téo
 
 int
-SortProxy::find( const QString &searchTerm, int searchFields )
-{
-    return rowFromSource( m_belowModel->find( searchTerm, searchFields ) );
-}
-
-int
 SortProxy::findNext( const QString &searchTerm, int selectedRow, int searchFields )
 {
     return rowFromSource( m_belowModel->findNext( searchTerm, selectedRow, searchFields ) );
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/SortProxy.h #989502:989503
@@ -55,17 +55,6 @@
 // Please keep them sorted alphabetically.  -- To
 
     /**
-     * Forwards a search down through the stack of ProxyModels.
-     * Find the first track in the playlist that matches the search term in one of the
-     * specified search fields. Playlist::Model::find() emits found() or notFound() depending on
-     * whether a match is found.
-     * @param searchTerm The term to search for.
-     * @param searchFields A bitmask specifying the fields to look in.
-     * @return The row of the first found match, -1 if no match is found.
-     */
-    int find( const QString &searchTerm, int searchFields );
-
-    /**
      * Forwards through the stack of ProxyModels a top to bottom search for the next item.
      * Find the first track below a given row that matches the search term in one of the
      * specified search fields. Playlist::Model::findNext() emits found() or notFound() depending on
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic