[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:29
Message-ID: 1246365389.650693.27187.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 989504 by mrnjavac:

Moved findNext() and findPrevious() from the proxies to Playlist::ProxyBase.

 M  +0 -10     FilterProxy.cpp  
 M  +0 -2      FilterProxy.h  
 M  +0 -10     GroupingProxy.cpp  
 M  +0 -3      GroupingProxy.h  
 M  +15 -0     ProxyBase.cpp  
 M  +28 -0     ProxyBase.h  
 M  +0 -12     SortProxy.cpp  
 M  +0 -26     SortProxy.h  


--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/FilterProxy.cpp #989503:989504
@@ -216,16 +216,6 @@
     return m_belowModel->trackAt( rowToSource( row ) );
 }
 
-int FilterProxy::findNext( const QString & searchTerm, int selectedRow, int searchFields )
-{
-    return rowFromSource( m_belowModel->findNext( searchTerm, selectedRow, searchFields ) );
-}
-
-int FilterProxy::findPrevious( const QString & searchTerm, int selectedRow, int searchFields )
-{
-    return rowFromSource( m_belowModel->findPrevious( searchTerm, selectedRow, searchFields ) );
-}
-
 int FilterProxy::totalLength() const
 {
     return m_belowModel->totalLength();
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/FilterProxy.h #989503:989504
@@ -107,8 +107,6 @@
     QStringList mimeTypes() const;
     QMimeData* mimeData( const QModelIndexList& ) const;
 
-    int findNext( const QString & searchTerm, int selectedRow, int searchFields );
-    int findPrevious( const QString & searchTerm, int selectedRow, int searchFields );
     int totalLength() const;
 
     void clearSearchTerm();
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/GroupingProxy.cpp #989503:989504
@@ -302,16 +302,6 @@
     return false;
 }
 
-int Playlist::GroupingProxy::findNext( const QString &searchTerm, int selectedRow, int fields  )
-{
-    return m_belowModel->findNext( searchTerm, selectedRow, fields );
-}
-
-int Playlist::GroupingProxy::findPrevious( const QString &searchTerm, int selectedRow, int fields  )
-{
-    return m_belowModel->findPrevious( searchTerm, selectedRow, fields );
-}
-
 int Playlist::GroupingProxy::totalLength()
 {
     return m_belowModel->totalLength();
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/GroupingProxy.h #989503:989504
@@ -90,9 +90,6 @@
     int tracksInGroup( int row ) const;
     int lengthOfGroup( int row ) const;
 
-    int findNext( const QString & searchTerm, int selectedRow, int fields  );
-    int findPrevious( const QString & searchTerm, int selectedRow, int fields  );
-
     int totalLength();
 
 signals:
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/ProxyBase.cpp #989503:989504
@@ -97,6 +97,21 @@
     return rowFromSource( m_belowModel->find( searchTerm, searchFields ) );
 }
 
+int
+ProxyBase::findNext( const QString &searchTerm, int selectedRow, int searchFields )
+{
+    //FIXME: selectedRow might need to be adjusted through rowToSource now that SortProxy
+    //       changes the order of rows.     -- Téo 28/6/2009
+    return rowFromSource( m_belowModel->findNext( searchTerm, selectedRow, searchFields ) );
+}
+
+int
+ProxyBase::findPrevious( const QString &searchTerm, int selectedRow, int searchFields )
+{
+    //FIXME: see findNext().
+    return rowFromSource( m_belowModel->findPrevious( searchTerm, selectedRow, searchFields ) );
+}
+
 }   //namespace Playlist
 
 #include "ProxyBase.moc"
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/ProxyBase.h #989503:989504
@@ -120,7 +120,35 @@
      */
     virtual 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 whether a match is found. If no row is found below the current row, the
+     * function wraps around and returns the first match. If no match is found at all, -1
+     * is returned.
+     * @param searchTerm The term to search for.
+     * @param selectedRow The offset row.
+     * @param searchFields A bitmask specifying the fields to look in.
+     * @return The row of the first found match below the offset, -1 if no match is found.
+     */
+    virtual int findNext( const QString &searchTerm, int selectedRow, int searchFields );
 
+    /**
+     * Forwards through the stack of ProxyModels a bottom to top search for the next item.
+     * Find the first track above a given row that matches the search term in one of the
+     * specified search fields. Playlist::Model::findPrevious() emits found() or notFound()
+     * depending on whether a match is found. If no row is found above the current row, the
+     * function wraps around and returns the last match. If no match is found at all, -1
+     * is returned.
+     * @param searchTerm The term to search for.
+     * @param selectedRow The offset row.
+     * @param searchFields A bitmask specifying the fields to look in.
+     * @return The row of the first found match above the offset, -1 if no match is found.
+     */
+    virtual int findPrevious( const QString &searchTerm, int selectedRow, 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
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/SortProxy.cpp #989503:989504
@@ -80,18 +80,6 @@
 // pretty much just forward stuff through the stack of proxies start here.
 // Please keep them sorted alphabetically.  -- Téo
 
-int
-SortProxy::findNext( const QString &searchTerm, int selectedRow, int searchFields )
-{
-    return rowFromSource( m_belowModel->findNext( searchTerm, selectedRow, searchFields ) );
-}
-
-int
-SortProxy::findPrevious( const QString &searchTerm, int selectedRow, int searchFields )
-{
-    return rowFromSource( m_belowModel->findPrevious( searchTerm, selectedRow, searchFields ) );
-}
-
 Qt::ItemFlags
 SortProxy::flags( const QModelIndex &index ) const
 {
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/SortProxy.h #989503:989504
@@ -55,32 +55,6 @@
 // Please keep them sorted alphabetically.  -- To
 
     /**
-     * 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
-     * whether a match is found. If no row is found below the current row, the function wraps
-     * around and returns the first match. If no match is found at all, -1 is returned.
-     * @param searchTerm The term to search for.
-     * @param selectedRow The offset row.
-     * @param searchFields A bitmask specifying the fields to look in.
-     * @return The row of the first found match below the offset, -1 if no match is found.
-     */
-    int findNext( const QString &searchTerm, int selectedRow, int searchFields );
-
-    /**
-     * Forwards through the stack of ProxyModels a bottom to top search for the next item.
-     * Find the first track above a given row that matches the search term in one of the
-     * specified search fields. Playlist::Model::findPrevious() emits found() or notFound() depending on
-     * whether a match is found. If no row is found above the current row, the function wraps
-     * around and returns the last match. If no match is found at all, -1 is returned.
-     * @param searchTerm The term to search for.
-     * @param selectedRow The offset row.
-     * @param searchFields A bitmask specifying the fields to look in.
-     * @return The row of the first found match above the offset, -1 if no match is found.
-     */
-    int findPrevious( const QString &searchTerm, int selectedRow, int searchFields );
-
-    /**
      * Returns the item flags for the given index.
      * @param index the index to retrieve the flags for.
      * @return the item flags.
[prev in list] [next in list] [prev in thread] [next in thread] 

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