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

SVN commit 989502 by mrnjavac:

Added columnCount() to Playlist::AbstractModel and Playlist::ProxyBase.
Fixed a nasty crash that used to happen when reapplying the grouping on a filtered playlist.
~yay

 M  +2 -0      AbstractModel.h  
 M  +1 -1      FilterProxy.cpp  
 M  +0 -6      GroupingProxy.cpp  
 M  +0 -1      GroupingProxy.h  
 M  +6 -0      ProxyBase.cpp  
 M  +8 -0      ProxyBase.h  
 M  +1 -1      SortProxy.cpp  


--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/AbstractModel.h #989501:989502
@@ -42,6 +42,8 @@
      */
     virtual int activeRow() const = 0;
 
+    virtual int columnCount( const QModelIndex& ) const = 0;
+
     /**
      * Clears the current search term.
      */
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/FilterProxy.cpp #989501:989502
@@ -71,7 +71,7 @@
 int
 FilterProxy::rowCount(const QModelIndex& parent) const
 {
-    return m_belowModel->rowCount( parent );
+    return QSortFilterProxyModel::rowCount( parent );
 }
 
 void FilterProxy::filterUpdated()
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/GroupingProxy.cpp #989501:989502
@@ -92,12 +92,6 @@
     return m_belowModel->rowCount( i );
 }
 
-int
-Playlist::GroupingProxy::columnCount( const QModelIndex& i ) const
-{
-    return sourceModel()->columnCount( i );
-}
-
 QModelIndex
 Playlist::GroupingProxy::mapToSource( const QModelIndex& i ) const
 {
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/GroupingProxy.h #989501:989502
@@ -70,7 +70,6 @@
     QModelIndex index( int, int c = 0, const QModelIndex& parent = QModelIndex() ) const;
     QModelIndex parent( const QModelIndex& ) const;
     int rowCount( const QModelIndex& idx = QModelIndex() ) const;
-    int columnCount( const QModelIndex& ) const;
     QModelIndex mapToSource( const QModelIndex& ) const;
     QModelIndex mapFromSource( const QModelIndex& ) const;
     QVariant data( const QModelIndex &index, int role ) const;
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/ProxyBase.cpp #989501:989502
@@ -44,6 +44,12 @@
     return rowFromSource( m_belowModel->activeRow() );
 }
 
+int
+ProxyBase::columnCount( const QModelIndex& i ) const
+{
+    return m_belowModel->columnCount( i );
+}
+
 void
 ProxyBase::clearSearchTerm()
 {
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/ProxyBase.h #989501:989502
@@ -58,6 +58,14 @@
      */
     virtual int activeRow() const;
 
+   /**
+     * Returns the number of columns exposed by the current proxy.
+     * The default implementation forwards the column count of the model below it.
+     * @param parent the parent of the columns to count.
+     * @return the number of columns.
+     */
+    virtual int columnCount( const QModelIndex& i ) const;
+
     /**
      * Clears the current search term.
      */
--- trunk/extragear/multimedia/amarok/src/playlist/proxymodels/SortProxy.cpp #989501:989502
@@ -41,7 +41,7 @@
     DEBUG_BLOCK
     debug() << "Instantiating SortProxy";
     m_belowModel = FilterProxy::instance();
-    setSourceModel( ( FilterProxy * )m_belowModel );
+    setSourceModel( dynamic_cast< FilterProxy * >( m_belowModel ) );
     setDynamicSortFilter( false );
 
     //As this Proxy doesn't add or remove tracks, and unique track IDs must be left untouched
[prev in list] [next in list] [prev in thread] [next in thread] 

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