diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index d6e228cf2..170b72524 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -62,9 +62,9 @@ set( libGuiSources playlist/QueueProxyModel.cpp playlist/QueueProxyModelPlaylistInterface.cpp playlist/QueueView.cpp - playlist/TrackModel.cpp - playlist/TrackProxyModel.cpp - playlist/TrackProxyModelPlaylistInterface.cpp + playlist/PlayableModel.cpp + playlist/PlayableProxyModel.cpp + playlist/PlayableProxyModelPlaylistInterface.cpp playlist/TrackView.cpp playlist/TrackHeader.cpp playlist/AlbumModel.cpp diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index 245cfa333..6d1255bb2 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -32,8 +32,8 @@ #include "CollectionView.h" #include "PlaylistModel.h" #include "PlaylistView.h" -#include "TrackProxyModel.h" -#include "TrackModel.h" +#include "PlayableProxyModel.h" +#include "PlayableModel.h" #include "ArtistView.h" #include "AlbumView.h" #include "AlbumProxyModel.h" @@ -289,7 +289,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection ) { view = new CollectionView(); CollectionFlatModel* model = new CollectionFlatModel(); - view->setTrackModel( model ); + view->setPlayableModel( model ); view->setFrameShape( QFrame::NoFrame ); view->setAttribute( Qt::WA_MacShowFocusRect, 0 ); @@ -496,7 +496,7 @@ ViewManager::showRecentPlaysPage() RecentlyPlayedModel* raModel = new RecentlyPlayedModel( source_ptr(), pv ); raModel->setTitle( tr( "Recently Played Tracks" ) ); raModel->setDescription( tr( "Recently played tracks from all your friends" ) ); - raModel->setStyle( TrackModel::Large ); + raModel->setStyle( PlayableModel::Large ); PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv, pv->proxyModel() ); connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv, SLOT( update( QModelIndex ) ) ); diff --git a/src/libtomahawk/context/pages/TopTracksContext.cpp b/src/libtomahawk/context/pages/TopTracksContext.cpp index 1b1c40d92..585146360 100644 --- a/src/libtomahawk/context/pages/TopTracksContext.cpp +++ b/src/libtomahawk/context/pages/TopTracksContext.cpp @@ -35,7 +35,7 @@ TopTracksContext::TopTracksContext() m_topHitsView->setGuid( "TopTracksContext" ); m_topHitsView->setUpdatesContextView( false ); m_topHitsModel = new PlaylistModel( m_topHitsView ); - m_topHitsModel->setStyle( TrackModel::Short ); + m_topHitsModel->setStyle( PlayableModel::Short ); m_topHitsView->setPlaylistModel( m_topHitsModel ); m_topHitsView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); diff --git a/src/libtomahawk/playlist/CollectionFlatModel.cpp b/src/libtomahawk/playlist/CollectionFlatModel.cpp index 73d15d2c8..746d3c7d1 100644 --- a/src/libtomahawk/playlist/CollectionFlatModel.cpp +++ b/src/libtomahawk/playlist/CollectionFlatModel.cpp @@ -27,7 +27,7 @@ using namespace Tomahawk; CollectionFlatModel::CollectionFlatModel( QObject* parent ) - : TrackModel( parent ) + : PlayableModel( parent ) { } diff --git a/src/libtomahawk/playlist/CollectionFlatModel.h b/src/libtomahawk/playlist/CollectionFlatModel.h index f09365a08..d158196de 100644 --- a/src/libtomahawk/playlist/CollectionFlatModel.h +++ b/src/libtomahawk/playlist/CollectionFlatModel.h @@ -25,7 +25,7 @@ #include #include "Typedefs.h" -#include "TrackModel.h" +#include "PlayableModel.h" #include "Query.h" #include "Source.h" #include "PlaylistInterface.h" @@ -36,7 +36,7 @@ class QMetaData; -class DLLEXPORT CollectionFlatModel : public TrackModel +class DLLEXPORT CollectionFlatModel : public PlayableModel { Q_OBJECT diff --git a/src/libtomahawk/playlist/CollectionProxyModel.cpp b/src/libtomahawk/playlist/CollectionProxyModel.cpp index 9d8c5dbc4..960409717 100644 --- a/src/libtomahawk/playlist/CollectionProxyModel.cpp +++ b/src/libtomahawk/playlist/CollectionProxyModel.cpp @@ -30,7 +30,7 @@ CollectionProxyModel::CollectionProxyModel( QObject* parent ) - : TrackProxyModel( parent ) + : PlayableProxyModel( parent ) { } diff --git a/src/libtomahawk/playlist/CollectionProxyModel.h b/src/libtomahawk/playlist/CollectionProxyModel.h index ab2d06dc3..17ae207b2 100644 --- a/src/libtomahawk/playlist/CollectionProxyModel.h +++ b/src/libtomahawk/playlist/CollectionProxyModel.h @@ -20,12 +20,12 @@ #ifndef COLLECTIONPROXYMODEL_H #define COLLECTIONPROXYMODEL_H -#include "TrackProxyModel.h" -#include "TrackProxyModelPlaylistInterface.h" +#include "PlayableProxyModel.h" +#include "PlayableProxyModelPlaylistInterface.h" #include "DllMacro.h" -class DLLEXPORT CollectionProxyModel : public TrackProxyModel +class DLLEXPORT CollectionProxyModel : public PlayableProxyModel { Q_OBJECT diff --git a/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.cpp b/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.cpp index 3676c43e7..b3144c343 100644 --- a/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.cpp +++ b/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.cpp @@ -28,7 +28,7 @@ using namespace Tomahawk; CollectionProxyModelPlaylistInterface::CollectionProxyModelPlaylistInterface( CollectionProxyModel *proxyModel ) - : TrackProxyModelPlaylistInterface( proxyModel ) + : PlayableProxyModelPlaylistInterface( proxyModel ) { } diff --git a/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.h b/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.h index 705ce9bfb..386cd25ee 100644 --- a/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.h +++ b/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.h @@ -20,8 +20,8 @@ #ifndef COLLECTIONPROXYMODELPLAYLISTINTERFACE_H #define COLLECTIONPROXYMODELPLAYLISTINTERFACE_H -#include "TrackProxyModel.h" -#include "TrackProxyModelPlaylistInterface.h" +#include "PlayableProxyModel.h" +#include "PlayableProxyModelPlaylistInterface.h" #include "DllMacro.h" @@ -30,7 +30,7 @@ class CollectionProxyModel; namespace Tomahawk { -class DLLEXPORT CollectionProxyModelPlaylistInterface : public TrackProxyModelPlaylistInterface +class DLLEXPORT CollectionProxyModelPlaylistInterface : public PlayableProxyModelPlaylistInterface { Q_OBJECT diff --git a/src/libtomahawk/playlist/CollectionView.cpp b/src/libtomahawk/playlist/CollectionView.cpp index 3243c86ed..0054c16e7 100644 --- a/src/libtomahawk/playlist/CollectionView.cpp +++ b/src/libtomahawk/playlist/CollectionView.cpp @@ -23,7 +23,7 @@ #include #include "CollectionProxyModel.h" -#include "TrackModel.h" +#include "PlayableModel.h" #include "widgets/OverlayWidget.h" #include "utils/Logger.h" #include "Source.h" @@ -50,22 +50,22 @@ void CollectionView::setModel( QAbstractItemModel* model ) { Q_UNUSED( model ); - qDebug() << "Explicitly use setTrackModel instead"; + qDebug() << "Explicitly use setPlayableModel instead"; Q_ASSERT( false ); } void -CollectionView::setTrackModel( TrackModel* model ) +CollectionView::setPlayableModel( PlayableModel* model ) { - TrackView::setTrackModel( model ); + TrackView::setPlayableModel( model ); - setColumnHidden( TrackModel::Score, true ); // Hide score column per default - setColumnHidden( TrackModel::Origin, true ); // Hide origin column per default - setColumnHidden( TrackModel::Composer, true ); //Hide composer column per default + setColumnHidden( PlayableModel::Score, true ); // Hide score column per default + setColumnHidden( PlayableModel::Origin, true ); // Hide origin column per default + setColumnHidden( PlayableModel::Composer, true ); //Hide composer column per default setGuid( QString( "collectionview/%1" ).arg( model->columnCount() ) ); - sortByColumn( TrackModel::Artist, Qt::AscendingOrder ); + sortByColumn( PlayableModel::Artist, Qt::AscendingOrder ); connect( model, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( onTrackCountChanged( unsigned int ) ) ); } diff --git a/src/libtomahawk/playlist/CollectionView.h b/src/libtomahawk/playlist/CollectionView.h index 6f80df54a..40f3ac76f 100644 --- a/src/libtomahawk/playlist/CollectionView.h +++ b/src/libtomahawk/playlist/CollectionView.h @@ -20,14 +20,13 @@ #ifndef COLLECTIONVIEW_H #define COLLECTIONVIEW_H -#include "TrackProxyModel.h" +#include "PlayableModel.h" +#include "PlayableProxyModel.h" #include "TrackView.h" #include "ViewPage.h" #include "DllMacro.h" -class TrackModel; - class DLLEXPORT CollectionView : public TrackView, public Tomahawk::ViewPage { Q_OBJECT @@ -36,7 +35,7 @@ public: explicit CollectionView( QWidget* parent = 0 ); ~CollectionView(); - virtual void setTrackModel( TrackModel* model ); + virtual void setPlayableModel( PlayableModel* model ); virtual void setModel( QAbstractItemModel* model ); virtual QWidget* widget() { return this; } diff --git a/src/libtomahawk/playlist/CustomPlaylistView.cpp b/src/libtomahawk/playlist/CustomPlaylistView.cpp index 886c7d998..742e8f443 100644 --- a/src/libtomahawk/playlist/CustomPlaylistView.cpp +++ b/src/libtomahawk/playlist/CustomPlaylistView.cpp @@ -37,7 +37,7 @@ CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, c setFrameShape( QFrame::NoFrame ); setAttribute( Qt::WA_MacShowFocusRect, 0 ); - m_model->setStyle( TrackModel::Large ); + m_model->setStyle( PlayableModel::Large ); setPlaylistModel( m_model ); generateTracks(); diff --git a/src/libtomahawk/playlist/TrackModel.cpp b/src/libtomahawk/playlist/PlayableModel.cpp similarity index 85% rename from src/libtomahawk/playlist/TrackModel.cpp rename to src/libtomahawk/playlist/PlayableModel.cpp index 5438788b9..5a6206399 100644 --- a/src/libtomahawk/playlist/TrackModel.cpp +++ b/src/libtomahawk/playlist/PlayableModel.cpp @@ -18,7 +18,7 @@ * along with Tomahawk. If not, see . */ -#include "TrackModel.h" +#include "PlayableModel.h" #include #include @@ -37,7 +37,7 @@ using namespace Tomahawk; -TrackModel::TrackModel( QObject* parent ) +PlayableModel::PlayableModel( QObject* parent ) : QAbstractItemModel( parent ) , m_rootItem( new PlayableItem( 0, this ) ) , m_readOnly( true ) @@ -48,13 +48,13 @@ TrackModel::TrackModel( QObject* parent ) } -TrackModel::~TrackModel() +PlayableModel::~PlayableModel() { } QModelIndex -TrackModel::index( int row, int column, const QModelIndex& parent ) const +PlayableModel::index( int row, int column, const QModelIndex& parent ) const { if ( !m_rootItem || row < 0 || column < 0 ) return QModelIndex(); @@ -69,7 +69,7 @@ TrackModel::index( int row, int column, const QModelIndex& parent ) const int -TrackModel::rowCount( const QModelIndex& parent ) const +PlayableModel::rowCount( const QModelIndex& parent ) const { if ( parent.column() > 0 ) return 0; @@ -83,7 +83,7 @@ TrackModel::rowCount( const QModelIndex& parent ) const int -TrackModel::columnCount( const QModelIndex& parent ) const +PlayableModel::columnCount( const QModelIndex& parent ) const { Q_UNUSED( parent ); @@ -104,7 +104,7 @@ TrackModel::columnCount( const QModelIndex& parent ) const QModelIndex -TrackModel::parent( const QModelIndex& child ) const +PlayableModel::parent( const QModelIndex& child ) const { PlayableItem* entry = itemFromIndex( child ); if ( !entry ) @@ -124,7 +124,7 @@ TrackModel::parent( const QModelIndex& child ) const QVariant -TrackModel::data( const QModelIndex& index, int role ) const +PlayableModel::data( const QModelIndex& index, int role ) const { PlayableItem* entry = itemFromIndex( index ); if ( !entry ) @@ -226,7 +226,7 @@ TrackModel::data( const QModelIndex& index, int role ) const QVariant -TrackModel::headerData( int section, Qt::Orientation orientation, int role ) const +PlayableModel::headerData( int section, Qt::Orientation orientation, int role ) const { Q_UNUSED( orientation ); @@ -247,21 +247,21 @@ TrackModel::headerData( int section, Qt::Orientation orientation, int role ) con void -TrackModel::updateDetailedInfo( const QModelIndex& index ) +PlayableModel::updateDetailedInfo( const QModelIndex& index ) { - if ( style() != TrackModel::Short && style() != TrackModel::Large ) + if ( style() != PlayableModel::Short && style() != PlayableModel::Large ) return; PlayableItem* item = itemFromIndex( index ); if ( item->query().isNull() ) return; - if ( style() == TrackModel::Short || style() == TrackModel::Large ) + if ( style() == PlayableModel::Short || style() == PlayableModel::Large ) { item->query()->cover( QSize( 0, 0 ) ); } - if ( style() == TrackModel::Large ) + if ( style() == PlayableModel::Large ) { item->query()->loadSocialActions(); } @@ -269,7 +269,7 @@ TrackModel::updateDetailedInfo( const QModelIndex& index ) void -TrackModel::setCurrentItem( const QModelIndex& index ) +PlayableModel::setCurrentItem( const QModelIndex& index ) { PlayableItem* oldEntry = itemFromIndex( m_currentIndex ); if ( oldEntry ) @@ -293,14 +293,14 @@ TrackModel::setCurrentItem( const QModelIndex& index ) Qt::DropActions -TrackModel::supportedDropActions() const +PlayableModel::supportedDropActions() const { return Qt::CopyAction | Qt::MoveAction; } Qt::ItemFlags -TrackModel::flags( const QModelIndex& index ) const +PlayableModel::flags( const QModelIndex& index ) const { Qt::ItemFlags defaultFlags = QAbstractItemModel::flags( index ); @@ -312,7 +312,7 @@ TrackModel::flags( const QModelIndex& index ) const QStringList -TrackModel::mimeTypes() const +PlayableModel::mimeTypes() const { QStringList types; types << "application/tomahawk.query.list"; @@ -321,7 +321,7 @@ TrackModel::mimeTypes() const QMimeData* -TrackModel::mimeData( const QModelIndexList &indexes ) const +PlayableModel::mimeData( const QModelIndexList &indexes ) const { qDebug() << Q_FUNC_INFO; @@ -350,7 +350,7 @@ TrackModel::mimeData( const QModelIndexList &indexes ) const void -TrackModel::clear() +PlayableModel::clear() { if ( rowCount( QModelIndex() ) ) { @@ -366,7 +366,7 @@ TrackModel::clear() QList< query_ptr > -TrackModel::queries() const +PlayableModel::queries() const { Q_ASSERT( m_rootItem ); @@ -381,21 +381,21 @@ TrackModel::queries() const void -TrackModel::append( const Tomahawk::query_ptr& query ) +PlayableModel::append( const Tomahawk::query_ptr& query ) { insert( query, rowCount( QModelIndex() ) ); } void -TrackModel::append( const QList< Tomahawk::query_ptr >& queries ) +PlayableModel::append( const QList< Tomahawk::query_ptr >& queries ) { insert( queries, rowCount( QModelIndex() ) ); } void -TrackModel::insert( const Tomahawk::query_ptr& query, int row ) +PlayableModel::insert( const Tomahawk::query_ptr& query, int row ) { if ( query.isNull() ) return; @@ -408,7 +408,7 @@ TrackModel::insert( const Tomahawk::query_ptr& query, int row ) void -TrackModel::insert( const QList< Tomahawk::query_ptr >& queries, int row ) +PlayableModel::insert( const QList< Tomahawk::query_ptr >& queries, int row ) { if ( !queries.count() ) { @@ -443,14 +443,14 @@ TrackModel::insert( const QList< Tomahawk::query_ptr >& queries, int row ) void -TrackModel::remove( int row, bool moreToCome ) +PlayableModel::remove( int row, bool moreToCome ) { remove( index( row, 0, QModelIndex() ), moreToCome ); } void -TrackModel::remove( const QModelIndex& index, bool moreToCome ) +PlayableModel::remove( const QModelIndex& index, bool moreToCome ) { if ( QThread::currentThread() != thread() ) { @@ -478,7 +478,7 @@ TrackModel::remove( const QModelIndex& index, bool moreToCome ) void -TrackModel::remove( const QList& indexes ) +PlayableModel::remove( const QList& indexes ) { QList pil; foreach ( const QModelIndex& idx, indexes ) @@ -491,7 +491,7 @@ TrackModel::remove( const QList& indexes ) void -TrackModel::remove( const QList& indexes ) +PlayableModel::remove( const QList& indexes ) { QList finalIndexes; foreach ( const QPersistentModelIndex index, indexes ) @@ -509,7 +509,7 @@ TrackModel::remove( const QList& indexes ) PlayableItem* -TrackModel::itemFromIndex( const QModelIndex& index ) const +PlayableModel::itemFromIndex( const QModelIndex& index ) const { if ( index.isValid() ) { @@ -523,7 +523,7 @@ TrackModel::itemFromIndex( const QModelIndex& index ) const void -TrackModel::onPlaybackStarted( const Tomahawk::result_ptr& result ) +PlayableModel::onPlaybackStarted( const Tomahawk::result_ptr& result ) { PlayableItem* oldEntry = itemFromIndex( m_currentIndex ); if ( oldEntry && ( oldEntry->query().isNull() || !oldEntry->query()->numResults() || oldEntry->query()->results().first().data() != result.data() ) ) @@ -534,7 +534,7 @@ TrackModel::onPlaybackStarted( const Tomahawk::result_ptr& result ) void -TrackModel::onPlaybackStopped() +PlayableModel::onPlaybackStopped() { PlayableItem* oldEntry = itemFromIndex( m_currentIndex ); if ( oldEntry ) @@ -545,7 +545,7 @@ TrackModel::onPlaybackStopped() void -TrackModel::ensureResolved() +PlayableModel::ensureResolved() { for( int i = 0; i < rowCount( QModelIndex() ); i++ ) { @@ -558,14 +558,14 @@ TrackModel::ensureResolved() void -TrackModel::setStyle( TrackModel::TrackItemStyle style ) +PlayableModel::setStyle( PlayableModel::PlayableItemStyle style ) { m_style = style; } Qt::Alignment -TrackModel::columnAlignment( int column ) const +PlayableModel::columnAlignment( int column ) const { switch( column ) { @@ -585,7 +585,7 @@ TrackModel::columnAlignment( int column ) const void -TrackModel::onDataChanged() +PlayableModel::onDataChanged() { PlayableItem* p = (PlayableItem*)sender(); if ( p && p->index.isValid() ) diff --git a/src/libtomahawk/playlist/TrackModel.h b/src/libtomahawk/playlist/PlayableModel.h similarity index 90% rename from src/libtomahawk/playlist/TrackModel.h rename to src/libtomahawk/playlist/PlayableModel.h index e1bec6cb0..7ee0f763c 100644 --- a/src/libtomahawk/playlist/TrackModel.h +++ b/src/libtomahawk/playlist/PlayableModel.h @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2012, Christian Muehlhaeuser * Copyright 2011 Leo Franchi * Copyright 2010-2011, Jeff Mitchell * @@ -18,8 +18,8 @@ * along with Tomahawk. If not, see . */ -#ifndef TRACKMODEL_H -#define TRACKMODEL_H +#ifndef PLAYABLEMODEL_H +#define PLAYABLEMODEL_H #include @@ -32,15 +32,15 @@ class QMetaData; class PlayableItem; -class DLLEXPORT TrackModel : public QAbstractItemModel +class DLLEXPORT PlayableModel : public QAbstractItemModel { Q_OBJECT public: - enum TrackItemStyle + enum PlayableItemStyle { Detailed = 0, Short = 1, ShortWithAvatars = 2, Large = 3 }; - enum TrackModelRole + enum PlayableModelRole { StyleRole = Qt::UserRole + 1 }; enum Columns { @@ -58,11 +58,11 @@ public: Score = 11 }; - explicit TrackModel( QObject* parent = 0 ); - virtual ~TrackModel(); + explicit PlayableModel( QObject* parent = 0 ); + virtual ~PlayableModel(); - TrackModel::TrackItemStyle style() const { return m_style; } - void setStyle( TrackModel::TrackItemStyle style ); + PlayableModel::PlayableItemStyle style() const { return m_style; } + void setStyle( PlayableModel::PlayableItemStyle style ); virtual QModelIndex index( int row, int column, const QModelIndex& parent ) const; virtual QModelIndex parent( const QModelIndex& child ) const; @@ -153,7 +153,7 @@ private: QString m_title; QString m_description; - TrackItemStyle m_style; + PlayableItemStyle m_style; }; -#endif // TRACKMODEL_H +#endif // PLAYABLEMODEL_H diff --git a/src/libtomahawk/playlist/TrackProxyModel.cpp b/src/libtomahawk/playlist/PlayableProxyModel.cpp similarity index 83% rename from src/libtomahawk/playlist/TrackProxyModel.cpp rename to src/libtomahawk/playlist/PlayableProxyModel.cpp index 5b88861c1..efee2a979 100644 --- a/src/libtomahawk/playlist/TrackProxyModel.cpp +++ b/src/libtomahawk/playlist/PlayableProxyModel.cpp @@ -17,11 +17,11 @@ * along with Tomahawk. If not, see . */ -#include "TrackProxyModel.h" +#include "PlayableProxyModel.h" #include -#include "TrackProxyModelPlaylistInterface.h" +#include "PlayableProxyModelPlaylistInterface.h" #include "Artist.h" #include "Album.h" #include "Query.h" @@ -30,7 +30,7 @@ #include "utils/Logger.h" -TrackProxyModel::TrackProxyModel( QObject* parent ) +PlayableProxyModel::PlayableProxyModel( QObject* parent ) : QSortFilterProxyModel( parent ) , m_model( 0 ) , m_showOfflineResults( true ) @@ -39,21 +39,21 @@ TrackProxyModel::TrackProxyModel( QObject* parent ) setSortCaseSensitivity( Qt::CaseInsensitive ); setDynamicSortFilter( true ); - setSourceTrackModel( 0 ); + setSourcePlayableModel( 0 ); } void -TrackProxyModel::setSourceModel( QAbstractItemModel* model ) +PlayableProxyModel::setSourceModel( QAbstractItemModel* model ) { Q_UNUSED( model ); - qDebug() << "Explicitly use setSourceTrackModel instead"; + qDebug() << "Explicitly use setSourcePlayableModel instead"; Q_ASSERT( false ); } void -TrackProxyModel::setSourceTrackModel( TrackModel* sourceModel ) +PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel ) { m_model = sourceModel; @@ -65,7 +65,7 @@ TrackProxyModel::setSourceTrackModel( TrackModel* sourceModel ) bool -TrackProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const +PlayableProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const { PlayableItem* pi = itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) ); if ( !pi ) @@ -102,7 +102,7 @@ TrackProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParen void -TrackProxyModel::remove( const QModelIndex& index ) +PlayableProxyModel::remove( const QModelIndex& index ) { if ( !sourceModel() ) return; @@ -114,7 +114,7 @@ TrackProxyModel::remove( const QModelIndex& index ) void -TrackProxyModel::remove( const QModelIndexList& indexes ) +PlayableProxyModel::remove( const QModelIndexList& indexes ) { if ( !sourceModel() ) return; @@ -131,7 +131,7 @@ TrackProxyModel::remove( const QModelIndexList& indexes ) void -TrackProxyModel::remove( const QList< QPersistentModelIndex >& indexes ) +PlayableProxyModel::remove( const QList< QPersistentModelIndex >& indexes ) { if ( !sourceModel() ) return; @@ -148,7 +148,7 @@ TrackProxyModel::remove( const QList< QPersistentModelIndex >& indexes ) bool -TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const +PlayableProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const { PlayableItem* p1 = itemFromIndex( left ); PlayableItem* p2 = itemFromIndex( right ); @@ -200,7 +200,7 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c id2 = (qint64)&q2; } - if ( left.column() == TrackModel::Artist ) // sort by artist + if ( left.column() == PlayableModel::Artist ) // sort by artist { if ( artist1 == artist2 ) { @@ -222,7 +222,7 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c return QString::localeAwareCompare( artist1, artist2 ) < 0; } - else if ( left.column() == TrackModel::Album ) // sort by album + else if ( left.column() == PlayableModel::Album ) // sort by album { if ( album1 == album2 ) { @@ -239,28 +239,28 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c return QString::localeAwareCompare( album1, album2 ) < 0; } - else if ( left.column() == TrackModel::Bitrate ) // sort by bitrate + else if ( left.column() == PlayableModel::Bitrate ) // sort by bitrate { if ( bitrate1 == bitrate2 ) return id1 < id2; return bitrate1 < bitrate2; } - else if ( left.column() == TrackModel::Age ) // sort by mtime + else if ( left.column() == PlayableModel::Age ) // sort by mtime { if ( mtime1 == mtime2 ) return id1 < id2; return mtime1 < mtime2; } - else if ( left.column() == TrackModel::Filesize ) // sort by file size + else if ( left.column() == PlayableModel::Filesize ) // sort by file size { if ( size1 == size2 ) return id1 < id2; return size1 < size2; } - else if ( left.column() == TrackModel::AlbumPos ) // sort by album pos + else if ( left.column() == PlayableModel::AlbumPos ) // sort by album pos { if ( discnumber1 != discnumber2 ) { @@ -283,11 +283,11 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c Tomahawk::playlistinterface_ptr -TrackProxyModel::playlistInterface() +PlayableProxyModel::playlistInterface() { if ( m_playlistInterface.isNull() ) { - m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::TrackProxyModelPlaylistInterface( this ) ); + m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::PlayableProxyModelPlaylistInterface( this ) ); } return m_playlistInterface; diff --git a/src/libtomahawk/playlist/TrackProxyModel.h b/src/libtomahawk/playlist/PlayableProxyModel.h similarity index 86% rename from src/libtomahawk/playlist/TrackProxyModel.h rename to src/libtomahawk/playlist/PlayableProxyModel.h index 177d006cc..34b63c145 100644 --- a/src/libtomahawk/playlist/TrackProxyModel.h +++ b/src/libtomahawk/playlist/PlayableProxyModel.h @@ -23,20 +23,20 @@ #include #include "PlaylistInterface.h" -#include "playlist/TrackModel.h" +#include "playlist/PlayableModel.h" #include "DllMacro.h" -class DLLEXPORT TrackProxyModel : public QSortFilterProxyModel +class DLLEXPORT PlayableProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - explicit TrackProxyModel ( QObject* parent = 0 ); - virtual ~TrackProxyModel() {} + explicit PlayableProxyModel ( QObject* parent = 0 ); + virtual ~PlayableProxyModel() {} - virtual TrackModel* sourceModel() const { return m_model; } - virtual void setSourceTrackModel( TrackModel* sourceModel ); + virtual PlayableModel* sourceModel() const { return m_model; } + virtual void setSourcePlayableModel( PlayableModel* sourceModel ); virtual void setSourceModel( QAbstractItemModel* model ); virtual QPersistentModelIndex currentIndex() const { return mapFromSource( m_model->currentItem() ); } @@ -62,7 +62,7 @@ protected: virtual bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const; virtual bool lessThan( const QModelIndex& left, const QModelIndex& right ) const; - TrackModel* m_model; + PlayableModel* m_model; bool m_showOfflineResults; Tomahawk::playlistinterface_ptr m_playlistInterface; }; diff --git a/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.cpp b/src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.cpp similarity index 82% rename from src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.cpp rename to src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.cpp index 7e7b096d7..96df71e03 100644 --- a/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.cpp +++ b/src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.cpp @@ -17,9 +17,9 @@ * along with Tomahawk. If not, see . */ -#include "TrackProxyModelPlaylistInterface.h" +#include "PlayableProxyModelPlaylistInterface.h" -#include "TrackProxyModel.h" +#include "PlayableProxyModel.h" #include "Artist.h" #include "Album.h" #include "Query.h" @@ -30,7 +30,7 @@ using namespace Tomahawk; -TrackProxyModelPlaylistInterface::TrackProxyModelPlaylistInterface( TrackProxyModel* proxyModel ) +PlayableProxyModelPlaylistInterface::PlayableProxyModelPlaylistInterface( PlayableProxyModel* proxyModel ) : PlaylistInterface() , m_proxyModel( proxyModel ) , m_repeatMode( PlaylistModes::NoRepeat ) @@ -39,35 +39,35 @@ TrackProxyModelPlaylistInterface::TrackProxyModelPlaylistInterface( TrackProxyMo } -TrackProxyModelPlaylistInterface::~TrackProxyModelPlaylistInterface() +PlayableProxyModelPlaylistInterface::~PlayableProxyModelPlaylistInterface() { m_proxyModel.clear(); } int -TrackProxyModelPlaylistInterface::unfilteredTrackCount() const +PlayableProxyModelPlaylistInterface::unfilteredTrackCount() const { return ( m_proxyModel.isNull() ? 0 : m_proxyModel.data()->sourceModel()->trackCount() ); } int -TrackProxyModelPlaylistInterface::trackCount() const +PlayableProxyModelPlaylistInterface::trackCount() const { return ( m_proxyModel.isNull() ? 0 : m_proxyModel.data()->rowCount( QModelIndex() ) ); } QString -TrackProxyModelPlaylistInterface::filter() const +PlayableProxyModelPlaylistInterface::filter() const { return ( m_proxyModel.isNull() ? QString() : m_proxyModel.data()->filterRegExp().pattern() ); } void -TrackProxyModelPlaylistInterface::setFilter( const QString& pattern ) +PlayableProxyModelPlaylistInterface::setFilter( const QString& pattern ) { if ( m_proxyModel.isNull() ) return; @@ -80,12 +80,12 @@ TrackProxyModelPlaylistInterface::setFilter( const QString& pattern ) QList< Tomahawk::query_ptr > -TrackProxyModelPlaylistInterface::tracks() +PlayableProxyModelPlaylistInterface::tracks() { if ( m_proxyModel.isNull() ) return QList< Tomahawk::query_ptr >(); - TrackProxyModel* proxyModel = m_proxyModel.data(); + PlayableProxyModel* proxyModel = m_proxyModel.data(); QList queries; for ( int i = 0; i < proxyModel->rowCount( QModelIndex() ); i++ ) @@ -100,28 +100,28 @@ TrackProxyModelPlaylistInterface::tracks() Tomahawk::result_ptr -TrackProxyModelPlaylistInterface::siblingItem( int itemsAway ) +PlayableProxyModelPlaylistInterface::siblingItem( int itemsAway ) { return siblingItem( itemsAway, false ); } bool -TrackProxyModelPlaylistInterface::hasNextItem() +PlayableProxyModelPlaylistInterface::hasNextItem() { return !( siblingItem( 1, true ).isNull() ); } Tomahawk::result_ptr -TrackProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly ) +PlayableProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly ) { qDebug() << Q_FUNC_INFO; if ( m_proxyModel.isNull() ) return Tomahawk::result_ptr(); - TrackProxyModel* proxyModel = m_proxyModel.data(); + PlayableProxyModel* proxyModel = m_proxyModel.data(); QModelIndex idx = proxyModel->index( 0, 0 ); if ( proxyModel->rowCount() ) @@ -182,12 +182,12 @@ TrackProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly ) Tomahawk::result_ptr -TrackProxyModelPlaylistInterface::currentItem() const +PlayableProxyModelPlaylistInterface::currentItem() const { if ( m_proxyModel.isNull() ) return Tomahawk::result_ptr(); - TrackProxyModel* proxyModel = m_proxyModel.data(); + PlayableProxyModel* proxyModel = m_proxyModel.data(); PlayableItem* item = proxyModel->itemFromIndex( proxyModel->mapToSource( proxyModel->currentIndex() ) ); if ( item && !item->query().isNull() && item->query()->playable() ) diff --git a/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.h b/src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.h similarity index 86% rename from src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.h rename to src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.h index 394a9c443..bc785aa58 100644 --- a/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.h +++ b/src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.h @@ -23,21 +23,21 @@ #include #include "PlaylistInterface.h" -#include "playlist/TrackModel.h" +#include "playlist/PlayableModel.h" #include "DllMacro.h" -class TrackProxyModel; +class PlayableProxyModel; namespace Tomahawk { -class DLLEXPORT TrackProxyModelPlaylistInterface : public Tomahawk::PlaylistInterface +class DLLEXPORT PlayableProxyModelPlaylistInterface : public Tomahawk::PlaylistInterface { Q_OBJECT public: - explicit TrackProxyModelPlaylistInterface( TrackProxyModel* proxyModel ); - virtual ~TrackProxyModelPlaylistInterface(); + explicit PlayableProxyModelPlaylistInterface( PlayableProxyModel* proxyModel ); + virtual ~PlayableProxyModelPlaylistInterface(); virtual QList tracks(); @@ -60,7 +60,7 @@ public slots: virtual void setShuffled( bool enabled ) { m_shuffled = enabled; emit shuffleModeChanged( enabled ); } protected: - QWeakPointer< TrackProxyModel > m_proxyModel; + QWeakPointer< PlayableProxyModel > m_proxyModel; PlaylistModes::RepeatMode m_repeatMode; bool m_shuffled; }; diff --git a/src/libtomahawk/playlist/PlaylistChartItemDelegate.cpp b/src/libtomahawk/playlist/PlaylistChartItemDelegate.cpp index eb6bde770..638d88a4b 100644 --- a/src/libtomahawk/playlist/PlaylistChartItemDelegate.cpp +++ b/src/libtomahawk/playlist/PlaylistChartItemDelegate.cpp @@ -28,9 +28,9 @@ #include "SourceList.h" #include "PlaylistView.h" -#include "TrackModel.h" +#include "PlayableModel.h" #include "PlayableItem.h" -#include "TrackProxyModel.h" +#include "PlayableProxyModel.h" #include "TrackView.h" #include "TrackHeader.h" @@ -42,7 +42,7 @@ using namespace Tomahawk; -PlaylistChartItemDelegate::PlaylistChartItemDelegate( TrackView* parent, TrackProxyModel* proxy ) +PlaylistChartItemDelegate::PlaylistChartItemDelegate( TrackView* parent, PlayableProxyModel* proxy ) : QStyledItemDelegate( (QObject*)parent ) , m_view( parent ) , m_model( proxy ) diff --git a/src/libtomahawk/playlist/PlaylistChartItemDelegate.h b/src/libtomahawk/playlist/PlaylistChartItemDelegate.h index 00adb0a33..87017d453 100644 --- a/src/libtomahawk/playlist/PlaylistChartItemDelegate.h +++ b/src/libtomahawk/playlist/PlaylistChartItemDelegate.h @@ -32,7 +32,7 @@ class PixmapDelegateFader; class TrackModel; class PlayableItem; -class TrackProxyModel; +class PlayableProxyModel; class TrackView; class DLLEXPORT PlaylistChartItemDelegate : public QStyledItemDelegate @@ -40,7 +40,7 @@ class DLLEXPORT PlaylistChartItemDelegate : public QStyledItemDelegate Q_OBJECT public: - PlaylistChartItemDelegate( TrackView* parent = 0, TrackProxyModel* proxy = 0 ); + PlaylistChartItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0 ); signals: void updateRequest( const QModelIndex& idx ); @@ -63,7 +63,7 @@ private: QTextOption m_bottomOption; TrackView* m_view; - TrackProxyModel* m_model; + PlayableProxyModel* m_model; mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps; }; diff --git a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp index 5266695b9..3fa898c2f 100644 --- a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp +++ b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp @@ -28,9 +28,9 @@ #include "Source.h" #include "SourceList.h" -#include "TrackModel.h" +#include "PlayableModel.h" #include "PlayableItem.h" -#include "TrackProxyModel.h" +#include "PlayableProxyModel.h" #include "TrackView.h" #include "TrackHeader.h" @@ -40,7 +40,7 @@ using namespace Tomahawk; -PlaylistItemDelegate::PlaylistItemDelegate( TrackView* parent, TrackProxyModel* proxy ) +PlaylistItemDelegate::PlaylistItemDelegate( TrackView* parent, PlayableProxyModel* proxy ) : QStyledItemDelegate( (QObject*)parent ) , m_view( parent ) , m_model( proxy ) @@ -67,8 +67,8 @@ PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel if ( index.isValid() ) { - int style = index.data( TrackModel::StyleRole ).toInt(); - if ( style == TrackModel::Short || style == TrackModel::ShortWithAvatars ) + int style = index.data( PlayableModel::StyleRole ).toInt(); + if ( style == PlayableModel::Short || style == PlayableModel::ShortWithAvatars ) { int rowHeight = option.fontMetrics.height() + 8; size.setHeight( rowHeight * 2 ); @@ -101,17 +101,17 @@ PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, const void PlaylistItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { - int style = index.data( TrackModel::StyleRole ).toInt(); + int style = index.data( PlayableModel::StyleRole ).toInt(); switch ( style ) { - case TrackModel::Detailed: + case PlayableModel::Detailed: paintDetailed( painter, option, index ); break; - case TrackModel::Short: + case PlayableModel::Short: paintShort( painter, option, index ); break; - case TrackModel::ShortWithAvatars: + case PlayableModel::ShortWithAvatars: paintShort( painter, option, index, true ); break; } @@ -224,7 +224,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter ); if ( m_view->hoveredIndex().row() == index.row() && m_view->hoveredIndex().column() == index.column() && - ( index.column() == TrackModel::Artist || index.column() == TrackModel::Album || index.column() == TrackModel::Track ) ) + ( index.column() == PlayableModel::Artist || index.column() == PlayableModel::Album || index.column() == PlayableModel::Track ) ) { opt.rect.setWidth( opt.rect.width() - 16 ); QRect arrowRect( opt.rect.x() + opt.rect.width(), opt.rect.y() + 1, opt.rect.height() - 2, opt.rect.height() - 2 ); @@ -235,7 +235,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt painter->save(); - if ( index.column() == TrackModel::Score ) + if ( index.column() == PlayableModel::Score ) { QColor barColor( 167, 183, 211 ); // This matches the sidebar (sourcetreeview.cpp:672) if ( opt.state & QStyle::State_Selected ) diff --git a/src/libtomahawk/playlist/PlaylistItemDelegate.h b/src/libtomahawk/playlist/PlaylistItemDelegate.h index b3f7ea59a..244a726d2 100644 --- a/src/libtomahawk/playlist/PlaylistItemDelegate.h +++ b/src/libtomahawk/playlist/PlaylistItemDelegate.h @@ -26,7 +26,7 @@ class TrackModel; class PlayableItem; -class TrackProxyModel; +class PlayableProxyModel; class TrackView; class DLLEXPORT PlaylistItemDelegate : public QStyledItemDelegate @@ -34,7 +34,7 @@ class DLLEXPORT PlaylistItemDelegate : public QStyledItemDelegate Q_OBJECT public: - PlaylistItemDelegate( TrackView* parent = 0, TrackProxyModel* proxy = 0 ); + PlaylistItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0 ); void updateRowSize( const QModelIndex& index ); @@ -53,7 +53,7 @@ private: QTextOption m_bottomOption; TrackView* m_view; - TrackProxyModel* m_model; + PlayableProxyModel* m_model; }; #endif // PLAYLISTITEMDELEGATE_H diff --git a/src/libtomahawk/playlist/PlaylistLargeItemDelegate.cpp b/src/libtomahawk/playlist/PlaylistLargeItemDelegate.cpp index e1daf35fb..acd1fd8f0 100644 --- a/src/libtomahawk/playlist/PlaylistLargeItemDelegate.cpp +++ b/src/libtomahawk/playlist/PlaylistLargeItemDelegate.cpp @@ -29,9 +29,9 @@ #include "SourceList.h" #include "PlaylistView.h" -#include "TrackModel.h" +#include "PlayableModel.h" #include "PlayableItem.h" -#include "TrackProxyModel.h" +#include "PlayableProxyModel.h" #include "TrackView.h" #include "TrackHeader.h" @@ -43,7 +43,7 @@ using namespace Tomahawk; -PlaylistLargeItemDelegate::PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent, TrackProxyModel* proxy ) +PlaylistLargeItemDelegate::PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent, PlayableProxyModel* proxy ) : QStyledItemDelegate( (QObject*)parent ) , m_view( parent ) , m_model( proxy ) diff --git a/src/libtomahawk/playlist/PlaylistLargeItemDelegate.h b/src/libtomahawk/playlist/PlaylistLargeItemDelegate.h index a643573c3..d6b33f076 100644 --- a/src/libtomahawk/playlist/PlaylistLargeItemDelegate.h +++ b/src/libtomahawk/playlist/PlaylistLargeItemDelegate.h @@ -32,7 +32,7 @@ class PixmapDelegateFader; class TrackModel; class PlayableItem; -class TrackProxyModel; +class PlayableProxyModel; class TrackView; class DLLEXPORT PlaylistLargeItemDelegate : public QStyledItemDelegate @@ -43,7 +43,7 @@ public: enum DisplayMode { LovedTracks, RecentlyPlayed, LatestAdditions }; - PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent = 0, TrackProxyModel* proxy = 0 ); + PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent = 0, PlayableProxyModel* proxy = 0 ); protected: void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; @@ -68,7 +68,7 @@ private: mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps; TrackView* m_view; - TrackProxyModel* m_model; + PlayableProxyModel* m_model; DisplayMode m_mode; }; diff --git a/src/libtomahawk/playlist/PlaylistModel.cpp b/src/libtomahawk/playlist/PlaylistModel.cpp index 49cc049a0..5ed5241bb 100644 --- a/src/libtomahawk/playlist/PlaylistModel.cpp +++ b/src/libtomahawk/playlist/PlaylistModel.cpp @@ -39,7 +39,7 @@ using namespace Tomahawk; PlaylistModel::PlaylistModel( QObject* parent ) - : TrackModel( parent ) + : PlayableModel( parent ) , m_isTemporary( false ) , m_changesOngoing( false ) , m_isLoading( false ) @@ -106,7 +106,7 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn void PlaylistModel::clear() { - TrackModel::clear(); + PlayableModel::clear(); m_waitingForResolved.clear(); } @@ -176,7 +176,7 @@ PlaylistModel::append( const Tomahawk::artist_ptr& artist ) void PlaylistModel::insert( const Tomahawk::query_ptr& query, int row ) { - TrackModel::insert( query, row ); + PlayableModel::insert( query, row ); } @@ -297,7 +297,7 @@ QMimeData* PlaylistModel::mimeData( const QModelIndexList& indexes ) const { // Add the playlist id to the mime data so that we can detect dropping on ourselves - QMimeData* d = TrackModel::mimeData( indexes ); + QMimeData* d = PlayableModel::mimeData( indexes ); if ( !m_playlist.isNull() ) d->setData( "application/tomahawk.playlist.id", m_playlist->guid().toLatin1() ); @@ -489,7 +489,7 @@ PlaylistModel::playlistEntries() const void PlaylistModel::remove( int row, bool moreToCome ) { - TrackModel::remove( row, moreToCome ); + PlayableModel::remove( row, moreToCome ); } @@ -512,7 +512,7 @@ PlaylistModel::remove( const QModelIndex& index, bool moreToCome ) if ( item && !m_isLoading ) m_savedRemoveTracks << item->query(); - TrackModel::remove( index, moreToCome ); + PlayableModel::remove( index, moreToCome ); if ( !moreToCome ) endPlaylistChanges(); @@ -522,14 +522,14 @@ PlaylistModel::remove( const QModelIndex& index, bool moreToCome ) void PlaylistModel::remove( const QList& indexes ) { - TrackModel::remove( indexes ); + PlayableModel::remove( indexes ); } void PlaylistModel::remove( const QList& indexes ) { - TrackModel::remove( indexes ); + PlayableModel::remove( indexes ); } diff --git a/src/libtomahawk/playlist/PlaylistModel.h b/src/libtomahawk/playlist/PlaylistModel.h index 63c538889..e7a3341d3 100644 --- a/src/libtomahawk/playlist/PlaylistModel.h +++ b/src/libtomahawk/playlist/PlaylistModel.h @@ -23,7 +23,7 @@ #include #include "Typedefs.h" -#include "TrackModel.h" +#include "PlayableModel.h" #include "Playlist.h" #include "Query.h" #include "PlaylistInterface.h" @@ -33,7 +33,7 @@ class QMimeData; class QMetaData; -class DLLEXPORT PlaylistModel : public TrackModel +class DLLEXPORT PlaylistModel : public PlayableModel { Q_OBJECT diff --git a/src/libtomahawk/playlist/PlaylistProxyModel.cpp b/src/libtomahawk/playlist/PlaylistProxyModel.cpp index 4ed1011c8..b9d7ccb7e 100644 --- a/src/libtomahawk/playlist/PlaylistProxyModel.cpp +++ b/src/libtomahawk/playlist/PlaylistProxyModel.cpp @@ -24,7 +24,7 @@ PlaylistProxyModel::PlaylistProxyModel( QObject* parent ) - : TrackProxyModel( parent ) + : PlayableProxyModel( parent ) { } diff --git a/src/libtomahawk/playlist/PlaylistProxyModel.h b/src/libtomahawk/playlist/PlaylistProxyModel.h index ec8ce154f..49adf1534 100644 --- a/src/libtomahawk/playlist/PlaylistProxyModel.h +++ b/src/libtomahawk/playlist/PlaylistProxyModel.h @@ -20,11 +20,11 @@ #ifndef PLAYLISTPROXYMODEL_H #define PLAYLISTPROXYMODEL_H -#include "TrackProxyModel.h" +#include "PlayableProxyModel.h" #include "DllMacro.h" -class DLLEXPORT PlaylistProxyModel : public TrackProxyModel +class DLLEXPORT PlaylistProxyModel : public PlayableProxyModel { Q_OBJECT diff --git a/src/libtomahawk/playlist/PlaylistProxyModelPlaylistInterface.cpp b/src/libtomahawk/playlist/PlaylistProxyModelPlaylistInterface.cpp index 73e443712..ce06675d2 100644 --- a/src/libtomahawk/playlist/PlaylistProxyModelPlaylistInterface.cpp +++ b/src/libtomahawk/playlist/PlaylistProxyModelPlaylistInterface.cpp @@ -25,7 +25,7 @@ using namespace Tomahawk; PlaylistProxyModelPlaylistInterface::PlaylistProxyModelPlaylistInterface( PlaylistProxyModel *proxyModel ) - : TrackProxyModelPlaylistInterface( proxyModel ) + : PlayableProxyModelPlaylistInterface( proxyModel ) { } diff --git a/src/libtomahawk/playlist/PlaylistProxyModelPlaylistInterface.h b/src/libtomahawk/playlist/PlaylistProxyModelPlaylistInterface.h index 133e6f5e1..29888c0bf 100644 --- a/src/libtomahawk/playlist/PlaylistProxyModelPlaylistInterface.h +++ b/src/libtomahawk/playlist/PlaylistProxyModelPlaylistInterface.h @@ -20,7 +20,7 @@ #ifndef PLAYLISTPROXYMODELPLAYLISTINTERFACE_H #define PLAYLISTPROXYMODELPLAYLISTINTERFACE_H -#include "TrackProxyModelPlaylistInterface.h" +#include "PlayableProxyModelPlaylistInterface.h" #include "DllMacro.h" @@ -29,7 +29,7 @@ class PlaylistProxyModel; namespace Tomahawk { -class DLLEXPORT PlaylistProxyModelPlaylistInterface : public TrackProxyModelPlaylistInterface +class DLLEXPORT PlaylistProxyModelPlaylistInterface : public PlayableProxyModelPlaylistInterface { Q_OBJECT diff --git a/src/libtomahawk/playlist/PlaylistView.cpp b/src/libtomahawk/playlist/PlaylistView.cpp index 92d6ebe41..3fb6f7426 100644 --- a/src/libtomahawk/playlist/PlaylistView.cpp +++ b/src/libtomahawk/playlist/PlaylistView.cpp @@ -61,9 +61,9 @@ PlaylistView::setPlaylistModel( PlaylistModel* model ) { m_model = model; - TrackView::setTrackModel( m_model ); - setColumnHidden( TrackModel::Age, true ); // Hide age column per default - setColumnHidden( TrackModel::Composer, true ); // Hide composer column per default + TrackView::setPlayableModel( m_model ); + setColumnHidden( PlayableModel::Age, true ); // Hide age column per default + setColumnHidden( PlayableModel::Composer, true ); // Hide composer column per default if ( guid().isEmpty() ) { diff --git a/src/libtomahawk/playlist/PlaylistView.h b/src/libtomahawk/playlist/PlaylistView.h index 978e4e15f..34633ee1e 100644 --- a/src/libtomahawk/playlist/PlaylistView.h +++ b/src/libtomahawk/playlist/PlaylistView.h @@ -20,7 +20,7 @@ #ifndef PLAYLISTVIEW_H #define PLAYLISTVIEW_H -#include "playlist/TrackProxyModel.h" +#include "playlist/PlayableProxyModel.h" #include "playlist/PlaylistModel.h" #include "TrackView.h" #include "ViewPage.h" diff --git a/src/libtomahawk/playlist/RecentlyAddedModel.cpp b/src/libtomahawk/playlist/RecentlyAddedModel.cpp index 2847fa124..243a43f76 100644 --- a/src/libtomahawk/playlist/RecentlyAddedModel.cpp +++ b/src/libtomahawk/playlist/RecentlyAddedModel.cpp @@ -34,7 +34,7 @@ using namespace Tomahawk; RecentlyAddedModel::RecentlyAddedModel( const source_ptr& source, QObject* parent ) - : TrackModel( parent ) + : PlayableModel( parent ) , m_source( source ) , m_limit( LATEST_TRACK_ITEMS ) { diff --git a/src/libtomahawk/playlist/RecentlyAddedModel.h b/src/libtomahawk/playlist/RecentlyAddedModel.h index d47032039..e4a3a98fa 100644 --- a/src/libtomahawk/playlist/RecentlyAddedModel.h +++ b/src/libtomahawk/playlist/RecentlyAddedModel.h @@ -23,11 +23,11 @@ #include #include "Typedefs.h" -#include "TrackModel.h" +#include "PlayableModel.h" #include "DllMacro.h" -class DLLEXPORT RecentlyAddedModel : public TrackModel +class DLLEXPORT RecentlyAddedModel : public PlayableModel { Q_OBJECT diff --git a/src/libtomahawk/playlist/TrackView.cpp b/src/libtomahawk/playlist/TrackView.cpp index b85d8e6bb..9bbc109ff 100644 --- a/src/libtomahawk/playlist/TrackView.cpp +++ b/src/libtomahawk/playlist/TrackView.cpp @@ -25,8 +25,8 @@ #include "TrackHeader.h" #include "ViewManager.h" -#include "TrackModel.h" -#include "TrackProxyModel.h" +#include "PlayableModel.h" +#include "PlayableProxyModel.h" #include "PlayableItem.h" #include "audio/AudioEngine.h" #include "context/ContextWidget.h" @@ -112,7 +112,7 @@ TrackView::setGuid( const QString& guid ) void -TrackView::setProxyModel( TrackProxyModel* model ) +TrackView::setProxyModel( PlayableProxyModel* model ) { m_proxyModel = model; @@ -127,19 +127,19 @@ void TrackView::setModel( QAbstractItemModel* model ) { Q_UNUSED( model ); - tDebug() << "Explicitly use setTrackModel instead"; + tDebug() << "Explicitly use setPlayableModel instead"; Q_ASSERT( false ); } void -TrackView::setTrackModel( TrackModel* model ) +TrackView::setPlayableModel( PlayableModel* model ) { m_model = model; if ( m_proxyModel ) { - m_proxyModel->setSourceTrackModel( m_model ); + m_proxyModel->setSourcePlayableModel( m_model ); } connect( m_model, SIGNAL( loadingStarted() ), m_loadingSpinner, SLOT( fadeIn() ) ); @@ -152,9 +152,9 @@ TrackView::setTrackModel( TrackModel* model ) switch( model->style() ) { - case TrackModel::Short: - case TrackModel::ShortWithAvatars: - case TrackModel::Large: + case PlayableModel::Short: + case PlayableModel::ShortWithAvatars: + case PlayableModel::Large: setHeaderHidden( true ); setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); break; @@ -169,7 +169,7 @@ TrackView::setTrackModel( TrackModel* model ) void TrackView::onViewChanged() { - if ( m_model->style() != TrackModel::Short && m_model->style() != TrackModel::Large ) // eventual FIXME? + if ( m_model->style() != PlayableModel::Short && m_model->style() != PlayableModel::Large ) // eventual FIXME? return; if ( m_timer.isActive() ) @@ -597,10 +597,10 @@ TrackView::updateHoverIndex( const QPoint& pos ) repaint(); } - if ( !m_model || m_model->style() != TrackModel::Detailed ) + if ( !m_model || m_model->style() != PlayableModel::Detailed ) return; - if ( idx.column() == TrackModel::Artist || idx.column() == TrackModel::Album || idx.column() == TrackModel::Track ) + if ( idx.column() == PlayableModel::Artist || idx.column() == PlayableModel::Album || idx.column() == PlayableModel::Track ) { if ( pos.x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 && pos.x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) ) @@ -649,7 +649,7 @@ TrackView::mousePressEvent( QMouseEvent* event ) { QTreeView::mousePressEvent( event ); - if ( !m_model || m_model->style() != TrackModel::Detailed ) + if ( !m_model || m_model->style() != PlayableModel::Detailed ) return; QModelIndex idx = indexAt( event->pos() ); @@ -659,7 +659,7 @@ TrackView::mousePressEvent( QMouseEvent* event ) PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( idx ) ); switch ( idx.column() ) { - case TrackModel::Artist: + case PlayableModel::Artist: { if ( item->query()->numResults() ) { @@ -672,7 +672,7 @@ TrackView::mousePressEvent( QMouseEvent* event ) break; } - case TrackModel::Album: + case PlayableModel::Album: { if ( item->query()->numResults() ) { @@ -686,7 +686,7 @@ TrackView::mousePressEvent( QMouseEvent* event ) break; } - case TrackModel::Track: + case PlayableModel::Track: { ViewManager::instance()->show( item->query() ); break; diff --git a/src/libtomahawk/playlist/TrackView.h b/src/libtomahawk/playlist/TrackView.h index 1a27ccfed..7ff314656 100644 --- a/src/libtomahawk/playlist/TrackView.h +++ b/src/libtomahawk/playlist/TrackView.h @@ -32,8 +32,8 @@ class QAction; class AnimatedSpinner; class TrackHeader; -class TrackModel; -class TrackProxyModel; +class PlayableModel; +class PlayableProxyModel; class OverlayWidget; class DLLEXPORT TrackView : public QTreeView @@ -47,12 +47,12 @@ public: virtual QString guid() const { return m_guid; } virtual void setGuid( const QString& guid ); - virtual void setTrackModel( TrackModel* model ); + virtual void setPlayableModel( PlayableModel* model ); virtual void setModel( QAbstractItemModel* model ); - void setProxyModel( TrackProxyModel* model ); + void setProxyModel( PlayableProxyModel* model ); - virtual TrackModel* model() const { return m_model; } - TrackProxyModel* proxyModel() const { return m_proxyModel; } + virtual PlayableModel* model() const { return m_model; } + PlayableProxyModel* proxyModel() const { return m_proxyModel; } PlaylistItemDelegate* delegate() const { return m_delegate; } TrackHeader* header() const { return m_header; } OverlayWidget* overlay() const { return m_overlay; } @@ -114,8 +114,8 @@ private: void updateHoverIndex( const QPoint& pos ); QString m_guid; - TrackModel* m_model; - TrackProxyModel* m_proxyModel; + PlayableModel* m_model; + PlayableProxyModel* m_proxyModel; PlaylistItemDelegate* m_delegate; TrackHeader* m_header; OverlayWidget* m_overlay; diff --git a/src/libtomahawk/playlist/dynamic/DynamicModel.cpp b/src/libtomahawk/playlist/dynamic/DynamicModel.cpp index 30fb755b0..a75a92f86 100644 --- a/src/libtomahawk/playlist/dynamic/DynamicModel.cpp +++ b/src/libtomahawk/playlist/dynamic/DynamicModel.cpp @@ -340,7 +340,7 @@ DynamicModel::remove(const QModelIndex& idx, bool moreToCome) { // if the user is manually removing the last one, re-add as we're a station newTrackLoading(); } - TrackModel::remove( idx ); + PlayableModel::remove( idx ); } else PlaylistModel::remove( idx, moreToCome ); diff --git a/src/libtomahawk/playlist/dynamic/DynamicView.cpp b/src/libtomahawk/playlist/dynamic/DynamicView.cpp index b4fbc9b6b..d55c03065 100644 --- a/src/libtomahawk/playlist/dynamic/DynamicView.cpp +++ b/src/libtomahawk/playlist/dynamic/DynamicView.cpp @@ -26,7 +26,7 @@ #include #include "PlaylistModel.h" -#include "TrackProxyModel.h" +#include "PlayableProxyModel.h" #include "TrackHeader.h" #include "DynamicModel.h" #include "widgets/OverlayWidget.h" diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp b/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp index 303bf1002..bf323dcb9 100644 --- a/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp +++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp @@ -29,7 +29,7 @@ #include "DynamicControlList.h" #include "dynamic/DynamicModel.h" -#include "TrackProxyModel.h" +#include "PlayableProxyModel.h" #include "PlayableItem.h" #include "dynamic/GeneratorInterface.h" #include "dynamic/GeneratorFactory.h" diff --git a/src/libtomahawk/widgets/SocialPlaylistWidget.cpp b/src/libtomahawk/widgets/SocialPlaylistWidget.cpp index b646fb106..69572d81f 100644 --- a/src/libtomahawk/widgets/SocialPlaylistWidget.cpp +++ b/src/libtomahawk/widgets/SocialPlaylistWidget.cpp @@ -72,7 +72,7 @@ SocialPlaylistWidget::SocialPlaylistWidget ( QWidget* parent ) m_topForeignTracksModel = new PlaylistModel( ui->newTracksView ); ui->newTracksView->setPlaylistModel( m_topForeignTracksModel ); - m_topForeignTracksModel->setStyle( TrackModel::Short ); + m_topForeignTracksModel->setStyle( PlayableModel::Short ); ui->newTracksView->overlay()->setEnabled( false ); m_popularNewAlbumsModel = new AlbumModel( ui->newAlbumsView ); diff --git a/src/libtomahawk/widgets/WelcomeWidget.cpp b/src/libtomahawk/widgets/WelcomeWidget.cpp index e991e1ef5..1411799bc 100644 --- a/src/libtomahawk/widgets/WelcomeWidget.cpp +++ b/src/libtomahawk/widgets/WelcomeWidget.cpp @@ -72,7 +72,7 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) updatePlaylists(); m_tracksModel = new RecentlyPlayedModel( source_ptr(), ui->tracksView ); - m_tracksModel->setStyle( TrackModel::ShortWithAvatars ); + m_tracksModel->setStyle( PlayableModel::ShortWithAvatars ); ui->tracksView->overlay()->setEnabled( false ); ui->tracksView->setPlaylistModel( m_tracksModel ); diff --git a/src/libtomahawk/widgets/WhatsHotWidget.cpp b/src/libtomahawk/widgets/WhatsHotWidget.cpp index ea55cf65a..94068899a 100644 --- a/src/libtomahawk/widgets/WhatsHotWidget.cpp +++ b/src/libtomahawk/widgets/WhatsHotWidget.cpp @@ -295,7 +295,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat connect( loader, SIGNAL( tracks( Tomahawk::ChartDataLoader*, QList< Tomahawk::query_ptr > ) ), this, SLOT( chartTracksLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::query_ptr > ) ) ); PlaylistModel* trackModel = new PlaylistModel( ui->tracksViewLeft ); - trackModel->setStyle( TrackModel::Large ); + trackModel->setStyle( PlayableModel::Large ); m_trackModels[ chartId ] = trackModel; diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp index 09d17d3e9..7a32abff6 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp @@ -76,8 +76,8 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* ui->relatedArtists->proxyModel()->sort( -1 ); m_topHitsModel = new PlaylistModel( ui->topHits ); - m_topHitsModel->setStyle( TrackModel::Short ); - ui->topHits->setTrackModel( m_topHitsModel ); + m_topHitsModel->setStyle( PlayableModel::Short ); + ui->topHits->setPlayableModel( m_topHitsModel ); ui->topHits->setSortingEnabled( false ); m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( 48, 48 ) ); diff --git a/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp index c250dafda..7dc557539 100644 --- a/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp @@ -62,12 +62,12 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* ui->historyView->overlay()->setEnabled( false ); m_recentTracksModel = new RecentlyAddedModel( source, ui->recentCollectionView ); - m_recentTracksModel->setStyle( TrackModel::Short ); - ui->recentCollectionView->setTrackModel( m_recentTracksModel ); - ui->recentCollectionView->sortByColumn( TrackModel::Age, Qt::DescendingOrder ); + m_recentTracksModel->setStyle( PlayableModel::Short ); + ui->recentCollectionView->setPlayableModel( m_recentTracksModel ); + ui->recentCollectionView->sortByColumn( PlayableModel::Age, Qt::DescendingOrder ); m_historyModel = new RecentlyPlayedModel( source, ui->historyView ); - m_historyModel->setStyle( TrackModel::Short ); + m_historyModel->setStyle( PlayableModel::Short ); ui->historyView->setPlaylistModel( m_historyModel ); m_recentAlbumModel = new AlbumModel( ui->recentAlbumView ); diff --git a/src/sourcetree/items/SourceItem.cpp b/src/sourcetree/items/SourceItem.cpp index d2b51b0ae..5df62ad39 100644 --- a/src/sourcetree/items/SourceItem.cpp +++ b/src/sourcetree/items/SourceItem.cpp @@ -533,7 +533,7 @@ SourceItem::latestAdditionsClicked() cv->setAttribute( Qt::WA_MacShowFocusRect, 0 ); RecentlyAddedModel* raModel = new RecentlyAddedModel( m_source, cv ); - raModel->setStyle( TrackModel::Large ); + raModel->setStyle( PlayableModel::Large ); raModel->setTitle( tr( "Latest Additions" ) ); if ( m_source->isLocal() ) @@ -545,8 +545,8 @@ SourceItem::latestAdditionsClicked() connect( del, SIGNAL( updateIndex( QModelIndex ) ), cv, SLOT( update( QModelIndex ) ) ); cv->setItemDelegate( del ); - cv->setTrackModel( raModel ); - cv->sortByColumn( TrackModel::Age, Qt::DescendingOrder ); + cv->setPlayableModel( raModel ); + cv->sortByColumn( PlayableModel::Age, Qt::DescendingOrder ); m_latestAdditionsPage = cv; } @@ -573,7 +573,7 @@ SourceItem::recentPlaysClicked() pv->setAttribute( Qt::WA_MacShowFocusRect, 0 ); RecentlyPlayedModel* raModel = new RecentlyPlayedModel( m_source, pv ); - raModel->setStyle( TrackModel::Large ); + raModel->setStyle( PlayableModel::Large ); raModel->setTitle( tr( "Recently Played Tracks" ) ); if ( m_source->isLocal() )