1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 16:29:43 +01:00

* Renamed Track(Proxy)Model to Playable(Proxy)Model.

This commit is contained in:
Christian Muehlhaeuser 2012-05-21 10:07:49 +02:00
parent 45397e82a8
commit 1b748201bc
45 changed files with 216 additions and 217 deletions

View File

@ -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

View File

@ -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 ) ) );

View File

@ -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 );

View File

@ -27,7 +27,7 @@ using namespace Tomahawk;
CollectionFlatModel::CollectionFlatModel( QObject* parent )
: TrackModel( parent )
: PlayableModel( parent )
{
}

View File

@ -25,7 +25,7 @@
#include <QHash>
#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

View File

@ -30,7 +30,7 @@
CollectionProxyModel::CollectionProxyModel( QObject* parent )
: TrackProxyModel( parent )
: PlayableProxyModel( parent )
{
}

View File

@ -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

View File

@ -28,7 +28,7 @@
using namespace Tomahawk;
CollectionProxyModelPlaylistInterface::CollectionProxyModelPlaylistInterface( CollectionProxyModel *proxyModel )
: TrackProxyModelPlaylistInterface( proxyModel )
: PlayableProxyModelPlaylistInterface( proxyModel )
{
}

View File

@ -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

View File

@ -23,7 +23,7 @@
#include <QPainter>
#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 ) ) );
}

View File

@ -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; }

View File

@ -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();

View File

@ -18,7 +18,7 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TrackModel.h"
#include "PlayableModel.h"
#include <QDateTime>
#include <QMimeData>
@ -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<QModelIndex>& indexes )
PlayableModel::remove( const QList<QModelIndex>& indexes )
{
QList<QPersistentModelIndex> pil;
foreach ( const QModelIndex& idx, indexes )
@ -491,7 +491,7 @@ TrackModel::remove( const QList<QModelIndex>& indexes )
void
TrackModel::remove( const QList<QPersistentModelIndex>& indexes )
PlayableModel::remove( const QList<QPersistentModelIndex>& indexes )
{
QList<QPersistentModelIndex> finalIndexes;
foreach ( const QPersistentModelIndex index, indexes )
@ -509,7 +509,7 @@ TrackModel::remove( const QList<QPersistentModelIndex>& 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() )

View File

@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2011 Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
*
@ -18,8 +18,8 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRACKMODEL_H
#define TRACKMODEL_H
#ifndef PLAYABLEMODEL_H
#define PLAYABLEMODEL_H
#include <QAbstractItemModel>
@ -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

View File

@ -17,11 +17,11 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TrackProxyModel.h"
#include "PlayableProxyModel.h"
#include <QTreeView>
#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;

View File

@ -23,20 +23,20 @@
#include <QtGui/QSortFilterProxyModel>
#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;
};

View File

@ -17,9 +17,9 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#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<Tomahawk::query_ptr> 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() )

View File

@ -23,21 +23,21 @@
#include <QtGui/QSortFilterProxyModel>
#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<Tomahawk::query_ptr> 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;
};

View File

@ -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 )

View File

@ -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;
};

View File

@ -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 )

View File

@ -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

View File

@ -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 )

View File

@ -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;
};

View File

@ -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<QModelIndex>& indexes )
{
TrackModel::remove( indexes );
PlayableModel::remove( indexes );
}
void
PlaylistModel::remove( const QList<QPersistentModelIndex>& indexes )
{
TrackModel::remove( indexes );
PlayableModel::remove( indexes );
}

View File

@ -23,7 +23,7 @@
#include <QHash>
#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

View File

@ -24,7 +24,7 @@
PlaylistProxyModel::PlaylistProxyModel( QObject* parent )
: TrackProxyModel( parent )
: PlayableProxyModel( parent )
{
}

View File

@ -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

View File

@ -25,7 +25,7 @@
using namespace Tomahawk;
PlaylistProxyModelPlaylistInterface::PlaylistProxyModelPlaylistInterface( PlaylistProxyModel *proxyModel )
: TrackProxyModelPlaylistInterface( proxyModel )
: PlayableProxyModelPlaylistInterface( proxyModel )
{
}

View File

@ -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

View File

@ -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() )
{

View File

@ -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"

View File

@ -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 )
{

View File

@ -23,11 +23,11 @@
#include <QHash>
#include "Typedefs.h"
#include "TrackModel.h"
#include "PlayableModel.h"
#include "DllMacro.h"
class DLLEXPORT RecentlyAddedModel : public TrackModel
class DLLEXPORT RecentlyAddedModel : public PlayableModel
{
Q_OBJECT

View File

@ -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;

View File

@ -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;

View File

@ -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 );

View File

@ -26,7 +26,7 @@
#include <QScrollBar>
#include "PlaylistModel.h"
#include "TrackProxyModel.h"
#include "PlayableProxyModel.h"
#include "TrackHeader.h"
#include "DynamicModel.h"
#include "widgets/OverlayWidget.h"

View File

@ -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"

View File

@ -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 );

View File

@ -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 );

View File

@ -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;

View File

@ -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 ) );

View File

@ -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 );

View File

@ -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() )