mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Renamed Track(Proxy)Model to Playable(Proxy)Model.
This commit is contained in:
@@ -62,9 +62,9 @@ set( libGuiSources
|
|||||||
playlist/QueueProxyModel.cpp
|
playlist/QueueProxyModel.cpp
|
||||||
playlist/QueueProxyModelPlaylistInterface.cpp
|
playlist/QueueProxyModelPlaylistInterface.cpp
|
||||||
playlist/QueueView.cpp
|
playlist/QueueView.cpp
|
||||||
playlist/TrackModel.cpp
|
playlist/PlayableModel.cpp
|
||||||
playlist/TrackProxyModel.cpp
|
playlist/PlayableProxyModel.cpp
|
||||||
playlist/TrackProxyModelPlaylistInterface.cpp
|
playlist/PlayableProxyModelPlaylistInterface.cpp
|
||||||
playlist/TrackView.cpp
|
playlist/TrackView.cpp
|
||||||
playlist/TrackHeader.cpp
|
playlist/TrackHeader.cpp
|
||||||
playlist/AlbumModel.cpp
|
playlist/AlbumModel.cpp
|
||||||
|
@@ -32,8 +32,8 @@
|
|||||||
#include "CollectionView.h"
|
#include "CollectionView.h"
|
||||||
#include "PlaylistModel.h"
|
#include "PlaylistModel.h"
|
||||||
#include "PlaylistView.h"
|
#include "PlaylistView.h"
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
#include "ArtistView.h"
|
#include "ArtistView.h"
|
||||||
#include "AlbumView.h"
|
#include "AlbumView.h"
|
||||||
#include "AlbumProxyModel.h"
|
#include "AlbumProxyModel.h"
|
||||||
@@ -289,7 +289,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
|
|||||||
{
|
{
|
||||||
view = new CollectionView();
|
view = new CollectionView();
|
||||||
CollectionFlatModel* model = new CollectionFlatModel();
|
CollectionFlatModel* model = new CollectionFlatModel();
|
||||||
view->setTrackModel( model );
|
view->setPlayableModel( model );
|
||||||
view->setFrameShape( QFrame::NoFrame );
|
view->setFrameShape( QFrame::NoFrame );
|
||||||
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ ViewManager::showRecentPlaysPage()
|
|||||||
RecentlyPlayedModel* raModel = new RecentlyPlayedModel( source_ptr(), pv );
|
RecentlyPlayedModel* raModel = new RecentlyPlayedModel( source_ptr(), pv );
|
||||||
raModel->setTitle( tr( "Recently Played Tracks" ) );
|
raModel->setTitle( tr( "Recently Played Tracks" ) );
|
||||||
raModel->setDescription( tr( "Recently played tracks from all your friends" ) );
|
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() );
|
PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv, pv->proxyModel() );
|
||||||
connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv, SLOT( update( QModelIndex ) ) );
|
connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv, SLOT( update( QModelIndex ) ) );
|
||||||
|
@@ -35,7 +35,7 @@ TopTracksContext::TopTracksContext()
|
|||||||
m_topHitsView->setGuid( "TopTracksContext" );
|
m_topHitsView->setGuid( "TopTracksContext" );
|
||||||
m_topHitsView->setUpdatesContextView( false );
|
m_topHitsView->setUpdatesContextView( false );
|
||||||
m_topHitsModel = new PlaylistModel( m_topHitsView );
|
m_topHitsModel = new PlaylistModel( m_topHitsView );
|
||||||
m_topHitsModel->setStyle( TrackModel::Short );
|
m_topHitsModel->setStyle( PlayableModel::Short );
|
||||||
m_topHitsView->setPlaylistModel( m_topHitsModel );
|
m_topHitsView->setPlaylistModel( m_topHitsModel );
|
||||||
m_topHitsView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
m_topHitsView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
|
|
||||||
CollectionFlatModel::CollectionFlatModel( QObject* parent )
|
CollectionFlatModel::CollectionFlatModel( QObject* parent )
|
||||||
: TrackModel( parent )
|
: PlayableModel( parent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
#include "Source.h"
|
#include "Source.h"
|
||||||
#include "PlaylistInterface.h"
|
#include "PlaylistInterface.h"
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
class QMetaData;
|
class QMetaData;
|
||||||
|
|
||||||
class DLLEXPORT CollectionFlatModel : public TrackModel
|
class DLLEXPORT CollectionFlatModel : public PlayableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
CollectionProxyModel::CollectionProxyModel( QObject* parent )
|
CollectionProxyModel::CollectionProxyModel( QObject* parent )
|
||||||
: TrackProxyModel( parent )
|
: PlayableProxyModel( parent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,12 +20,12 @@
|
|||||||
#ifndef COLLECTIONPROXYMODEL_H
|
#ifndef COLLECTIONPROXYMODEL_H
|
||||||
#define COLLECTIONPROXYMODEL_H
|
#define COLLECTIONPROXYMODEL_H
|
||||||
|
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "TrackProxyModelPlaylistInterface.h"
|
#include "PlayableProxyModelPlaylistInterface.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
class DLLEXPORT CollectionProxyModel : public TrackProxyModel
|
class DLLEXPORT CollectionProxyModel : public PlayableProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
CollectionProxyModelPlaylistInterface::CollectionProxyModelPlaylistInterface( CollectionProxyModel *proxyModel )
|
CollectionProxyModelPlaylistInterface::CollectionProxyModelPlaylistInterface( CollectionProxyModel *proxyModel )
|
||||||
: TrackProxyModelPlaylistInterface( proxyModel )
|
: PlayableProxyModelPlaylistInterface( proxyModel )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,8 +20,8 @@
|
|||||||
#ifndef COLLECTIONPROXYMODELPLAYLISTINTERFACE_H
|
#ifndef COLLECTIONPROXYMODELPLAYLISTINTERFACE_H
|
||||||
#define COLLECTIONPROXYMODELPLAYLISTINTERFACE_H
|
#define COLLECTIONPROXYMODELPLAYLISTINTERFACE_H
|
||||||
|
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "TrackProxyModelPlaylistInterface.h"
|
#include "PlayableProxyModelPlaylistInterface.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ class CollectionProxyModel;
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
class DLLEXPORT CollectionProxyModelPlaylistInterface : public TrackProxyModelPlaylistInterface
|
class DLLEXPORT CollectionProxyModelPlaylistInterface : public PlayableProxyModelPlaylistInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
#include "CollectionProxyModel.h"
|
#include "CollectionProxyModel.h"
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
#include "widgets/OverlayWidget.h"
|
#include "widgets/OverlayWidget.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "Source.h"
|
#include "Source.h"
|
||||||
@@ -50,22 +50,22 @@ void
|
|||||||
CollectionView::setModel( QAbstractItemModel* model )
|
CollectionView::setModel( QAbstractItemModel* model )
|
||||||
{
|
{
|
||||||
Q_UNUSED( model );
|
Q_UNUSED( model );
|
||||||
qDebug() << "Explicitly use setTrackModel instead";
|
qDebug() << "Explicitly use setPlayableModel instead";
|
||||||
Q_ASSERT( false );
|
Q_ASSERT( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
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( PlayableModel::Score, true ); // Hide score column per default
|
||||||
setColumnHidden( TrackModel::Origin, true ); // Hide origin column per default
|
setColumnHidden( PlayableModel::Origin, true ); // Hide origin column per default
|
||||||
setColumnHidden( TrackModel::Composer, true ); //Hide composer column per default
|
setColumnHidden( PlayableModel::Composer, true ); //Hide composer column per default
|
||||||
|
|
||||||
setGuid( QString( "collectionview/%1" ).arg( model->columnCount() ) );
|
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 ) ) );
|
connect( model, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( onTrackCountChanged( unsigned int ) ) );
|
||||||
}
|
}
|
||||||
|
@@ -20,14 +20,13 @@
|
|||||||
#ifndef COLLECTIONVIEW_H
|
#ifndef COLLECTIONVIEW_H
|
||||||
#define COLLECTIONVIEW_H
|
#define COLLECTIONVIEW_H
|
||||||
|
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableModel.h"
|
||||||
|
#include "PlayableProxyModel.h"
|
||||||
#include "TrackView.h"
|
#include "TrackView.h"
|
||||||
#include "ViewPage.h"
|
#include "ViewPage.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
class TrackModel;
|
|
||||||
|
|
||||||
class DLLEXPORT CollectionView : public TrackView, public Tomahawk::ViewPage
|
class DLLEXPORT CollectionView : public TrackView, public Tomahawk::ViewPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -36,7 +35,7 @@ public:
|
|||||||
explicit CollectionView( QWidget* parent = 0 );
|
explicit CollectionView( QWidget* parent = 0 );
|
||||||
~CollectionView();
|
~CollectionView();
|
||||||
|
|
||||||
virtual void setTrackModel( TrackModel* model );
|
virtual void setPlayableModel( PlayableModel* model );
|
||||||
virtual void setModel( QAbstractItemModel* model );
|
virtual void setModel( QAbstractItemModel* model );
|
||||||
|
|
||||||
virtual QWidget* widget() { return this; }
|
virtual QWidget* widget() { return this; }
|
||||||
|
@@ -37,7 +37,7 @@ CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, c
|
|||||||
setFrameShape( QFrame::NoFrame );
|
setFrameShape( QFrame::NoFrame );
|
||||||
setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
|
||||||
m_model->setStyle( TrackModel::Large );
|
m_model->setStyle( PlayableModel::Large );
|
||||||
setPlaylistModel( m_model );
|
setPlaylistModel( m_model );
|
||||||
generateTracks();
|
generateTracks();
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
TrackModel::TrackModel( QObject* parent )
|
PlayableModel::PlayableModel( QObject* parent )
|
||||||
: QAbstractItemModel( parent )
|
: QAbstractItemModel( parent )
|
||||||
, m_rootItem( new PlayableItem( 0, this ) )
|
, m_rootItem( new PlayableItem( 0, this ) )
|
||||||
, m_readOnly( true )
|
, m_readOnly( true )
|
||||||
@@ -48,13 +48,13 @@ TrackModel::TrackModel( QObject* parent )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TrackModel::~TrackModel()
|
PlayableModel::~PlayableModel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QModelIndex
|
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 )
|
if ( !m_rootItem || row < 0 || column < 0 )
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
@@ -69,7 +69,7 @@ TrackModel::index( int row, int column, const QModelIndex& parent ) const
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TrackModel::rowCount( const QModelIndex& parent ) const
|
PlayableModel::rowCount( const QModelIndex& parent ) const
|
||||||
{
|
{
|
||||||
if ( parent.column() > 0 )
|
if ( parent.column() > 0 )
|
||||||
return 0;
|
return 0;
|
||||||
@@ -83,7 +83,7 @@ TrackModel::rowCount( const QModelIndex& parent ) const
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TrackModel::columnCount( const QModelIndex& parent ) const
|
PlayableModel::columnCount( const QModelIndex& parent ) const
|
||||||
{
|
{
|
||||||
Q_UNUSED( parent );
|
Q_UNUSED( parent );
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ TrackModel::columnCount( const QModelIndex& parent ) const
|
|||||||
|
|
||||||
|
|
||||||
QModelIndex
|
QModelIndex
|
||||||
TrackModel::parent( const QModelIndex& child ) const
|
PlayableModel::parent( const QModelIndex& child ) const
|
||||||
{
|
{
|
||||||
PlayableItem* entry = itemFromIndex( child );
|
PlayableItem* entry = itemFromIndex( child );
|
||||||
if ( !entry )
|
if ( !entry )
|
||||||
@@ -124,7 +124,7 @@ TrackModel::parent( const QModelIndex& child ) const
|
|||||||
|
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
TrackModel::data( const QModelIndex& index, int role ) const
|
PlayableModel::data( const QModelIndex& index, int role ) const
|
||||||
{
|
{
|
||||||
PlayableItem* entry = itemFromIndex( index );
|
PlayableItem* entry = itemFromIndex( index );
|
||||||
if ( !entry )
|
if ( !entry )
|
||||||
@@ -226,7 +226,7 @@ TrackModel::data( const QModelIndex& index, int role ) const
|
|||||||
|
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
TrackModel::headerData( int section, Qt::Orientation orientation, int role ) const
|
PlayableModel::headerData( int section, Qt::Orientation orientation, int role ) const
|
||||||
{
|
{
|
||||||
Q_UNUSED( orientation );
|
Q_UNUSED( orientation );
|
||||||
|
|
||||||
@@ -247,21 +247,21 @@ TrackModel::headerData( int section, Qt::Orientation orientation, int role ) con
|
|||||||
|
|
||||||
|
|
||||||
void
|
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;
|
return;
|
||||||
|
|
||||||
PlayableItem* item = itemFromIndex( index );
|
PlayableItem* item = itemFromIndex( index );
|
||||||
if ( item->query().isNull() )
|
if ( item->query().isNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( style() == TrackModel::Short || style() == TrackModel::Large )
|
if ( style() == PlayableModel::Short || style() == PlayableModel::Large )
|
||||||
{
|
{
|
||||||
item->query()->cover( QSize( 0, 0 ) );
|
item->query()->cover( QSize( 0, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( style() == TrackModel::Large )
|
if ( style() == PlayableModel::Large )
|
||||||
{
|
{
|
||||||
item->query()->loadSocialActions();
|
item->query()->loadSocialActions();
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@ TrackModel::updateDetailedInfo( const QModelIndex& index )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::setCurrentItem( const QModelIndex& index )
|
PlayableModel::setCurrentItem( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
||||||
if ( oldEntry )
|
if ( oldEntry )
|
||||||
@@ -293,14 +293,14 @@ TrackModel::setCurrentItem( const QModelIndex& index )
|
|||||||
|
|
||||||
|
|
||||||
Qt::DropActions
|
Qt::DropActions
|
||||||
TrackModel::supportedDropActions() const
|
PlayableModel::supportedDropActions() const
|
||||||
{
|
{
|
||||||
return Qt::CopyAction | Qt::MoveAction;
|
return Qt::CopyAction | Qt::MoveAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Qt::ItemFlags
|
Qt::ItemFlags
|
||||||
TrackModel::flags( const QModelIndex& index ) const
|
PlayableModel::flags( const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags( index );
|
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags( index );
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ TrackModel::flags( const QModelIndex& index ) const
|
|||||||
|
|
||||||
|
|
||||||
QStringList
|
QStringList
|
||||||
TrackModel::mimeTypes() const
|
PlayableModel::mimeTypes() const
|
||||||
{
|
{
|
||||||
QStringList types;
|
QStringList types;
|
||||||
types << "application/tomahawk.query.list";
|
types << "application/tomahawk.query.list";
|
||||||
@@ -321,7 +321,7 @@ TrackModel::mimeTypes() const
|
|||||||
|
|
||||||
|
|
||||||
QMimeData*
|
QMimeData*
|
||||||
TrackModel::mimeData( const QModelIndexList &indexes ) const
|
PlayableModel::mimeData( const QModelIndexList &indexes ) const
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ TrackModel::mimeData( const QModelIndexList &indexes ) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::clear()
|
PlayableModel::clear()
|
||||||
{
|
{
|
||||||
if ( rowCount( QModelIndex() ) )
|
if ( rowCount( QModelIndex() ) )
|
||||||
{
|
{
|
||||||
@@ -366,7 +366,7 @@ TrackModel::clear()
|
|||||||
|
|
||||||
|
|
||||||
QList< query_ptr >
|
QList< query_ptr >
|
||||||
TrackModel::queries() const
|
PlayableModel::queries() const
|
||||||
{
|
{
|
||||||
Q_ASSERT( m_rootItem );
|
Q_ASSERT( m_rootItem );
|
||||||
|
|
||||||
@@ -381,21 +381,21 @@ TrackModel::queries() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::append( const Tomahawk::query_ptr& query )
|
PlayableModel::append( const Tomahawk::query_ptr& query )
|
||||||
{
|
{
|
||||||
insert( query, rowCount( QModelIndex() ) );
|
insert( query, rowCount( QModelIndex() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::append( const QList< Tomahawk::query_ptr >& queries )
|
PlayableModel::append( const QList< Tomahawk::query_ptr >& queries )
|
||||||
{
|
{
|
||||||
insert( queries, rowCount( QModelIndex() ) );
|
insert( queries, rowCount( QModelIndex() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::insert( const Tomahawk::query_ptr& query, int row )
|
PlayableModel::insert( const Tomahawk::query_ptr& query, int row )
|
||||||
{
|
{
|
||||||
if ( query.isNull() )
|
if ( query.isNull() )
|
||||||
return;
|
return;
|
||||||
@@ -408,7 +408,7 @@ TrackModel::insert( const Tomahawk::query_ptr& query, int row )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::insert( const QList< Tomahawk::query_ptr >& queries, int row )
|
PlayableModel::insert( const QList< Tomahawk::query_ptr >& queries, int row )
|
||||||
{
|
{
|
||||||
if ( !queries.count() )
|
if ( !queries.count() )
|
||||||
{
|
{
|
||||||
@@ -443,14 +443,14 @@ TrackModel::insert( const QList< Tomahawk::query_ptr >& queries, int row )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::remove( int row, bool moreToCome )
|
PlayableModel::remove( int row, bool moreToCome )
|
||||||
{
|
{
|
||||||
remove( index( row, 0, QModelIndex() ), moreToCome );
|
remove( index( row, 0, QModelIndex() ), moreToCome );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::remove( const QModelIndex& index, bool moreToCome )
|
PlayableModel::remove( const QModelIndex& index, bool moreToCome )
|
||||||
{
|
{
|
||||||
if ( QThread::currentThread() != thread() )
|
if ( QThread::currentThread() != thread() )
|
||||||
{
|
{
|
||||||
@@ -478,7 +478,7 @@ TrackModel::remove( const QModelIndex& index, bool moreToCome )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::remove( const QList<QModelIndex>& indexes )
|
PlayableModel::remove( const QList<QModelIndex>& indexes )
|
||||||
{
|
{
|
||||||
QList<QPersistentModelIndex> pil;
|
QList<QPersistentModelIndex> pil;
|
||||||
foreach ( const QModelIndex& idx, indexes )
|
foreach ( const QModelIndex& idx, indexes )
|
||||||
@@ -491,7 +491,7 @@ TrackModel::remove( const QList<QModelIndex>& indexes )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::remove( const QList<QPersistentModelIndex>& indexes )
|
PlayableModel::remove( const QList<QPersistentModelIndex>& indexes )
|
||||||
{
|
{
|
||||||
QList<QPersistentModelIndex> finalIndexes;
|
QList<QPersistentModelIndex> finalIndexes;
|
||||||
foreach ( const QPersistentModelIndex index, indexes )
|
foreach ( const QPersistentModelIndex index, indexes )
|
||||||
@@ -509,7 +509,7 @@ TrackModel::remove( const QList<QPersistentModelIndex>& indexes )
|
|||||||
|
|
||||||
|
|
||||||
PlayableItem*
|
PlayableItem*
|
||||||
TrackModel::itemFromIndex( const QModelIndex& index ) const
|
PlayableModel::itemFromIndex( const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
if ( index.isValid() )
|
if ( index.isValid() )
|
||||||
{
|
{
|
||||||
@@ -523,7 +523,7 @@ TrackModel::itemFromIndex( const QModelIndex& index ) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
PlayableModel::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
||||||
{
|
{
|
||||||
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
||||||
if ( oldEntry && ( oldEntry->query().isNull() || !oldEntry->query()->numResults() || oldEntry->query()->results().first().data() != result.data() ) )
|
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
|
void
|
||||||
TrackModel::onPlaybackStopped()
|
PlayableModel::onPlaybackStopped()
|
||||||
{
|
{
|
||||||
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
||||||
if ( oldEntry )
|
if ( oldEntry )
|
||||||
@@ -545,7 +545,7 @@ TrackModel::onPlaybackStopped()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::ensureResolved()
|
PlayableModel::ensureResolved()
|
||||||
{
|
{
|
||||||
for( int i = 0; i < rowCount( QModelIndex() ); i++ )
|
for( int i = 0; i < rowCount( QModelIndex() ); i++ )
|
||||||
{
|
{
|
||||||
@@ -558,14 +558,14 @@ TrackModel::ensureResolved()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::setStyle( TrackModel::TrackItemStyle style )
|
PlayableModel::setStyle( PlayableModel::PlayableItemStyle style )
|
||||||
{
|
{
|
||||||
m_style = style;
|
m_style = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Qt::Alignment
|
Qt::Alignment
|
||||||
TrackModel::columnAlignment( int column ) const
|
PlayableModel::columnAlignment( int column ) const
|
||||||
{
|
{
|
||||||
switch( column )
|
switch( column )
|
||||||
{
|
{
|
||||||
@@ -585,7 +585,7 @@ TrackModel::columnAlignment( int column ) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::onDataChanged()
|
PlayableModel::onDataChanged()
|
||||||
{
|
{
|
||||||
PlayableItem* p = (PlayableItem*)sender();
|
PlayableItem* p = (PlayableItem*)sender();
|
||||||
if ( p && p->index.isValid() )
|
if ( p && p->index.isValid() )
|
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === 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 2011 Leo Franchi <lfranchi@kde.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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/>.
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TRACKMODEL_H
|
#ifndef PLAYABLEMODEL_H
|
||||||
#define TRACKMODEL_H
|
#define PLAYABLEMODEL_H
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
@@ -32,15 +32,15 @@ class QMetaData;
|
|||||||
|
|
||||||
class PlayableItem;
|
class PlayableItem;
|
||||||
|
|
||||||
class DLLEXPORT TrackModel : public QAbstractItemModel
|
class DLLEXPORT PlayableModel : public QAbstractItemModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum TrackItemStyle
|
enum PlayableItemStyle
|
||||||
{ Detailed = 0, Short = 1, ShortWithAvatars = 2, Large = 3 };
|
{ Detailed = 0, Short = 1, ShortWithAvatars = 2, Large = 3 };
|
||||||
|
|
||||||
enum TrackModelRole
|
enum PlayableModelRole
|
||||||
{ StyleRole = Qt::UserRole + 1 };
|
{ StyleRole = Qt::UserRole + 1 };
|
||||||
|
|
||||||
enum Columns {
|
enum Columns {
|
||||||
@@ -58,11 +58,11 @@ public:
|
|||||||
Score = 11
|
Score = 11
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit TrackModel( QObject* parent = 0 );
|
explicit PlayableModel( QObject* parent = 0 );
|
||||||
virtual ~TrackModel();
|
virtual ~PlayableModel();
|
||||||
|
|
||||||
TrackModel::TrackItemStyle style() const { return m_style; }
|
PlayableModel::PlayableItemStyle style() const { return m_style; }
|
||||||
void setStyle( TrackModel::TrackItemStyle style );
|
void setStyle( PlayableModel::PlayableItemStyle style );
|
||||||
|
|
||||||
virtual QModelIndex index( int row, int column, const QModelIndex& parent ) const;
|
virtual QModelIndex index( int row, int column, const QModelIndex& parent ) const;
|
||||||
virtual QModelIndex parent( const QModelIndex& child ) const;
|
virtual QModelIndex parent( const QModelIndex& child ) const;
|
||||||
@@ -153,7 +153,7 @@ private:
|
|||||||
QString m_title;
|
QString m_title;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
|
|
||||||
TrackItemStyle m_style;
|
PlayableItemStyle m_style;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRACKMODEL_H
|
#endif // PLAYABLEMODEL_H
|
@@ -17,11 +17,11 @@
|
|||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
#include "TrackProxyModelPlaylistInterface.h"
|
#include "PlayableProxyModelPlaylistInterface.h"
|
||||||
#include "Artist.h"
|
#include "Artist.h"
|
||||||
#include "Album.h"
|
#include "Album.h"
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
|
|
||||||
TrackProxyModel::TrackProxyModel( QObject* parent )
|
PlayableProxyModel::PlayableProxyModel( QObject* parent )
|
||||||
: QSortFilterProxyModel( parent )
|
: QSortFilterProxyModel( parent )
|
||||||
, m_model( 0 )
|
, m_model( 0 )
|
||||||
, m_showOfflineResults( true )
|
, m_showOfflineResults( true )
|
||||||
@@ -39,21 +39,21 @@ TrackProxyModel::TrackProxyModel( QObject* parent )
|
|||||||
setSortCaseSensitivity( Qt::CaseInsensitive );
|
setSortCaseSensitivity( Qt::CaseInsensitive );
|
||||||
setDynamicSortFilter( true );
|
setDynamicSortFilter( true );
|
||||||
|
|
||||||
setSourceTrackModel( 0 );
|
setSourcePlayableModel( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackProxyModel::setSourceModel( QAbstractItemModel* model )
|
PlayableProxyModel::setSourceModel( QAbstractItemModel* model )
|
||||||
{
|
{
|
||||||
Q_UNUSED( model );
|
Q_UNUSED( model );
|
||||||
qDebug() << "Explicitly use setSourceTrackModel instead";
|
qDebug() << "Explicitly use setSourcePlayableModel instead";
|
||||||
Q_ASSERT( false );
|
Q_ASSERT( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackProxyModel::setSourceTrackModel( TrackModel* sourceModel )
|
PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel )
|
||||||
{
|
{
|
||||||
m_model = sourceModel;
|
m_model = sourceModel;
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ TrackProxyModel::setSourceTrackModel( TrackModel* sourceModel )
|
|||||||
|
|
||||||
|
|
||||||
bool
|
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 ) );
|
PlayableItem* pi = itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) );
|
||||||
if ( !pi )
|
if ( !pi )
|
||||||
@@ -102,7 +102,7 @@ TrackProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParen
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackProxyModel::remove( const QModelIndex& index )
|
PlayableProxyModel::remove( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
if ( !sourceModel() )
|
if ( !sourceModel() )
|
||||||
return;
|
return;
|
||||||
@@ -114,7 +114,7 @@ TrackProxyModel::remove( const QModelIndex& index )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackProxyModel::remove( const QModelIndexList& indexes )
|
PlayableProxyModel::remove( const QModelIndexList& indexes )
|
||||||
{
|
{
|
||||||
if ( !sourceModel() )
|
if ( !sourceModel() )
|
||||||
return;
|
return;
|
||||||
@@ -131,7 +131,7 @@ TrackProxyModel::remove( const QModelIndexList& indexes )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackProxyModel::remove( const QList< QPersistentModelIndex >& indexes )
|
PlayableProxyModel::remove( const QList< QPersistentModelIndex >& indexes )
|
||||||
{
|
{
|
||||||
if ( !sourceModel() )
|
if ( !sourceModel() )
|
||||||
return;
|
return;
|
||||||
@@ -148,7 +148,7 @@ TrackProxyModel::remove( const QList< QPersistentModelIndex >& indexes )
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
|
PlayableProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
|
||||||
{
|
{
|
||||||
PlayableItem* p1 = itemFromIndex( left );
|
PlayableItem* p1 = itemFromIndex( left );
|
||||||
PlayableItem* p2 = itemFromIndex( right );
|
PlayableItem* p2 = itemFromIndex( right );
|
||||||
@@ -200,7 +200,7 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
|||||||
id2 = (qint64)&q2;
|
id2 = (qint64)&q2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( left.column() == TrackModel::Artist ) // sort by artist
|
if ( left.column() == PlayableModel::Artist ) // sort by artist
|
||||||
{
|
{
|
||||||
if ( artist1 == artist2 )
|
if ( artist1 == artist2 )
|
||||||
{
|
{
|
||||||
@@ -222,7 +222,7 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
|||||||
|
|
||||||
return QString::localeAwareCompare( artist1, artist2 ) < 0;
|
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 )
|
if ( album1 == album2 )
|
||||||
{
|
{
|
||||||
@@ -239,28 +239,28 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
|||||||
|
|
||||||
return QString::localeAwareCompare( album1, album2 ) < 0;
|
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 )
|
if ( bitrate1 == bitrate2 )
|
||||||
return id1 < id2;
|
return id1 < id2;
|
||||||
|
|
||||||
return bitrate1 < bitrate2;
|
return bitrate1 < bitrate2;
|
||||||
}
|
}
|
||||||
else if ( left.column() == TrackModel::Age ) // sort by mtime
|
else if ( left.column() == PlayableModel::Age ) // sort by mtime
|
||||||
{
|
{
|
||||||
if ( mtime1 == mtime2 )
|
if ( mtime1 == mtime2 )
|
||||||
return id1 < id2;
|
return id1 < id2;
|
||||||
|
|
||||||
return mtime1 < mtime2;
|
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 )
|
if ( size1 == size2 )
|
||||||
return id1 < id2;
|
return id1 < id2;
|
||||||
|
|
||||||
return size1 < size2;
|
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 )
|
if ( discnumber1 != discnumber2 )
|
||||||
{
|
{
|
||||||
@@ -283,11 +283,11 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
|||||||
|
|
||||||
|
|
||||||
Tomahawk::playlistinterface_ptr
|
Tomahawk::playlistinterface_ptr
|
||||||
TrackProxyModel::playlistInterface()
|
PlayableProxyModel::playlistInterface()
|
||||||
{
|
{
|
||||||
if ( m_playlistInterface.isNull() )
|
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;
|
return m_playlistInterface;
|
@@ -23,20 +23,20 @@
|
|||||||
#include <QtGui/QSortFilterProxyModel>
|
#include <QtGui/QSortFilterProxyModel>
|
||||||
|
|
||||||
#include "PlaylistInterface.h"
|
#include "PlaylistInterface.h"
|
||||||
#include "playlist/TrackModel.h"
|
#include "playlist/PlayableModel.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
class DLLEXPORT TrackProxyModel : public QSortFilterProxyModel
|
class DLLEXPORT PlayableProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TrackProxyModel ( QObject* parent = 0 );
|
explicit PlayableProxyModel ( QObject* parent = 0 );
|
||||||
virtual ~TrackProxyModel() {}
|
virtual ~PlayableProxyModel() {}
|
||||||
|
|
||||||
virtual TrackModel* sourceModel() const { return m_model; }
|
virtual PlayableModel* sourceModel() const { return m_model; }
|
||||||
virtual void setSourceTrackModel( TrackModel* sourceModel );
|
virtual void setSourcePlayableModel( PlayableModel* sourceModel );
|
||||||
virtual void setSourceModel( QAbstractItemModel* model );
|
virtual void setSourceModel( QAbstractItemModel* model );
|
||||||
|
|
||||||
virtual QPersistentModelIndex currentIndex() const { return mapFromSource( m_model->currentItem() ); }
|
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 filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const;
|
||||||
virtual bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
|
virtual bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
|
||||||
|
|
||||||
TrackModel* m_model;
|
PlayableModel* m_model;
|
||||||
bool m_showOfflineResults;
|
bool m_showOfflineResults;
|
||||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||||
};
|
};
|
@@ -17,9 +17,9 @@
|
|||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
* 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 "Artist.h"
|
||||||
#include "Album.h"
|
#include "Album.h"
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
TrackProxyModelPlaylistInterface::TrackProxyModelPlaylistInterface( TrackProxyModel* proxyModel )
|
PlayableProxyModelPlaylistInterface::PlayableProxyModelPlaylistInterface( PlayableProxyModel* proxyModel )
|
||||||
: PlaylistInterface()
|
: PlaylistInterface()
|
||||||
, m_proxyModel( proxyModel )
|
, m_proxyModel( proxyModel )
|
||||||
, m_repeatMode( PlaylistModes::NoRepeat )
|
, m_repeatMode( PlaylistModes::NoRepeat )
|
||||||
@@ -39,35 +39,35 @@ TrackProxyModelPlaylistInterface::TrackProxyModelPlaylistInterface( TrackProxyMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TrackProxyModelPlaylistInterface::~TrackProxyModelPlaylistInterface()
|
PlayableProxyModelPlaylistInterface::~PlayableProxyModelPlaylistInterface()
|
||||||
{
|
{
|
||||||
m_proxyModel.clear();
|
m_proxyModel.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TrackProxyModelPlaylistInterface::unfilteredTrackCount() const
|
PlayableProxyModelPlaylistInterface::unfilteredTrackCount() const
|
||||||
{
|
{
|
||||||
return ( m_proxyModel.isNull() ? 0 : m_proxyModel.data()->sourceModel()->trackCount() );
|
return ( m_proxyModel.isNull() ? 0 : m_proxyModel.data()->sourceModel()->trackCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TrackProxyModelPlaylistInterface::trackCount() const
|
PlayableProxyModelPlaylistInterface::trackCount() const
|
||||||
{
|
{
|
||||||
return ( m_proxyModel.isNull() ? 0 : m_proxyModel.data()->rowCount( QModelIndex() ) );
|
return ( m_proxyModel.isNull() ? 0 : m_proxyModel.data()->rowCount( QModelIndex() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
TrackProxyModelPlaylistInterface::filter() const
|
PlayableProxyModelPlaylistInterface::filter() const
|
||||||
{
|
{
|
||||||
return ( m_proxyModel.isNull() ? QString() : m_proxyModel.data()->filterRegExp().pattern() );
|
return ( m_proxyModel.isNull() ? QString() : m_proxyModel.data()->filterRegExp().pattern() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackProxyModelPlaylistInterface::setFilter( const QString& pattern )
|
PlayableProxyModelPlaylistInterface::setFilter( const QString& pattern )
|
||||||
{
|
{
|
||||||
if ( m_proxyModel.isNull() )
|
if ( m_proxyModel.isNull() )
|
||||||
return;
|
return;
|
||||||
@@ -80,12 +80,12 @@ TrackProxyModelPlaylistInterface::setFilter( const QString& pattern )
|
|||||||
|
|
||||||
|
|
||||||
QList< Tomahawk::query_ptr >
|
QList< Tomahawk::query_ptr >
|
||||||
TrackProxyModelPlaylistInterface::tracks()
|
PlayableProxyModelPlaylistInterface::tracks()
|
||||||
{
|
{
|
||||||
if ( m_proxyModel.isNull() )
|
if ( m_proxyModel.isNull() )
|
||||||
return QList< Tomahawk::query_ptr >();
|
return QList< Tomahawk::query_ptr >();
|
||||||
|
|
||||||
TrackProxyModel* proxyModel = m_proxyModel.data();
|
PlayableProxyModel* proxyModel = m_proxyModel.data();
|
||||||
QList<Tomahawk::query_ptr> queries;
|
QList<Tomahawk::query_ptr> queries;
|
||||||
|
|
||||||
for ( int i = 0; i < proxyModel->rowCount( QModelIndex() ); i++ )
|
for ( int i = 0; i < proxyModel->rowCount( QModelIndex() ); i++ )
|
||||||
@@ -100,28 +100,28 @@ TrackProxyModelPlaylistInterface::tracks()
|
|||||||
|
|
||||||
|
|
||||||
Tomahawk::result_ptr
|
Tomahawk::result_ptr
|
||||||
TrackProxyModelPlaylistInterface::siblingItem( int itemsAway )
|
PlayableProxyModelPlaylistInterface::siblingItem( int itemsAway )
|
||||||
{
|
{
|
||||||
return siblingItem( itemsAway, false );
|
return siblingItem( itemsAway, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TrackProxyModelPlaylistInterface::hasNextItem()
|
PlayableProxyModelPlaylistInterface::hasNextItem()
|
||||||
{
|
{
|
||||||
return !( siblingItem( 1, true ).isNull() );
|
return !( siblingItem( 1, true ).isNull() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::result_ptr
|
Tomahawk::result_ptr
|
||||||
TrackProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly )
|
PlayableProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
if ( m_proxyModel.isNull() )
|
if ( m_proxyModel.isNull() )
|
||||||
return Tomahawk::result_ptr();
|
return Tomahawk::result_ptr();
|
||||||
|
|
||||||
TrackProxyModel* proxyModel = m_proxyModel.data();
|
PlayableProxyModel* proxyModel = m_proxyModel.data();
|
||||||
|
|
||||||
QModelIndex idx = proxyModel->index( 0, 0 );
|
QModelIndex idx = proxyModel->index( 0, 0 );
|
||||||
if ( proxyModel->rowCount() )
|
if ( proxyModel->rowCount() )
|
||||||
@@ -182,12 +182,12 @@ TrackProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly )
|
|||||||
|
|
||||||
|
|
||||||
Tomahawk::result_ptr
|
Tomahawk::result_ptr
|
||||||
TrackProxyModelPlaylistInterface::currentItem() const
|
PlayableProxyModelPlaylistInterface::currentItem() const
|
||||||
{
|
{
|
||||||
if ( m_proxyModel.isNull() )
|
if ( m_proxyModel.isNull() )
|
||||||
return Tomahawk::result_ptr();
|
return Tomahawk::result_ptr();
|
||||||
|
|
||||||
TrackProxyModel* proxyModel = m_proxyModel.data();
|
PlayableProxyModel* proxyModel = m_proxyModel.data();
|
||||||
|
|
||||||
PlayableItem* item = proxyModel->itemFromIndex( proxyModel->mapToSource( proxyModel->currentIndex() ) );
|
PlayableItem* item = proxyModel->itemFromIndex( proxyModel->mapToSource( proxyModel->currentIndex() ) );
|
||||||
if ( item && !item->query().isNull() && item->query()->playable() )
|
if ( item && !item->query().isNull() && item->query()->playable() )
|
@@ -23,21 +23,21 @@
|
|||||||
#include <QtGui/QSortFilterProxyModel>
|
#include <QtGui/QSortFilterProxyModel>
|
||||||
|
|
||||||
#include "PlaylistInterface.h"
|
#include "PlaylistInterface.h"
|
||||||
#include "playlist/TrackModel.h"
|
#include "playlist/PlayableModel.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
class TrackProxyModel;
|
class PlayableProxyModel;
|
||||||
|
|
||||||
namespace Tomahawk {
|
namespace Tomahawk {
|
||||||
|
|
||||||
class DLLEXPORT TrackProxyModelPlaylistInterface : public Tomahawk::PlaylistInterface
|
class DLLEXPORT PlayableProxyModelPlaylistInterface : public Tomahawk::PlaylistInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TrackProxyModelPlaylistInterface( TrackProxyModel* proxyModel );
|
explicit PlayableProxyModelPlaylistInterface( PlayableProxyModel* proxyModel );
|
||||||
virtual ~TrackProxyModelPlaylistInterface();
|
virtual ~PlayableProxyModelPlaylistInterface();
|
||||||
|
|
||||||
virtual QList<Tomahawk::query_ptr> tracks();
|
virtual QList<Tomahawk::query_ptr> tracks();
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ public slots:
|
|||||||
virtual void setShuffled( bool enabled ) { m_shuffled = enabled; emit shuffleModeChanged( enabled ); }
|
virtual void setShuffled( bool enabled ) { m_shuffled = enabled; emit shuffleModeChanged( enabled ); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QWeakPointer< TrackProxyModel > m_proxyModel;
|
QWeakPointer< PlayableProxyModel > m_proxyModel;
|
||||||
PlaylistModes::RepeatMode m_repeatMode;
|
PlaylistModes::RepeatMode m_repeatMode;
|
||||||
bool m_shuffled;
|
bool m_shuffled;
|
||||||
};
|
};
|
@@ -28,9 +28,9 @@
|
|||||||
#include "SourceList.h"
|
#include "SourceList.h"
|
||||||
|
|
||||||
#include "PlaylistView.h"
|
#include "PlaylistView.h"
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
#include "PlayableItem.h"
|
#include "PlayableItem.h"
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "TrackView.h"
|
#include "TrackView.h"
|
||||||
#include "TrackHeader.h"
|
#include "TrackHeader.h"
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
PlaylistChartItemDelegate::PlaylistChartItemDelegate( TrackView* parent, TrackProxyModel* proxy )
|
PlaylistChartItemDelegate::PlaylistChartItemDelegate( TrackView* parent, PlayableProxyModel* proxy )
|
||||||
: QStyledItemDelegate( (QObject*)parent )
|
: QStyledItemDelegate( (QObject*)parent )
|
||||||
, m_view( parent )
|
, m_view( parent )
|
||||||
, m_model( proxy )
|
, m_model( proxy )
|
||||||
|
@@ -32,7 +32,7 @@ class PixmapDelegateFader;
|
|||||||
|
|
||||||
class TrackModel;
|
class TrackModel;
|
||||||
class PlayableItem;
|
class PlayableItem;
|
||||||
class TrackProxyModel;
|
class PlayableProxyModel;
|
||||||
class TrackView;
|
class TrackView;
|
||||||
|
|
||||||
class DLLEXPORT PlaylistChartItemDelegate : public QStyledItemDelegate
|
class DLLEXPORT PlaylistChartItemDelegate : public QStyledItemDelegate
|
||||||
@@ -40,7 +40,7 @@ class DLLEXPORT PlaylistChartItemDelegate : public QStyledItemDelegate
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlaylistChartItemDelegate( TrackView* parent = 0, TrackProxyModel* proxy = 0 );
|
PlaylistChartItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0 );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateRequest( const QModelIndex& idx );
|
void updateRequest( const QModelIndex& idx );
|
||||||
@@ -63,7 +63,7 @@ private:
|
|||||||
QTextOption m_bottomOption;
|
QTextOption m_bottomOption;
|
||||||
|
|
||||||
TrackView* m_view;
|
TrackView* m_view;
|
||||||
TrackProxyModel* m_model;
|
PlayableProxyModel* m_model;
|
||||||
|
|
||||||
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps;
|
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps;
|
||||||
};
|
};
|
||||||
|
@@ -28,9 +28,9 @@
|
|||||||
#include "Source.h"
|
#include "Source.h"
|
||||||
#include "SourceList.h"
|
#include "SourceList.h"
|
||||||
|
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
#include "PlayableItem.h"
|
#include "PlayableItem.h"
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "TrackView.h"
|
#include "TrackView.h"
|
||||||
#include "TrackHeader.h"
|
#include "TrackHeader.h"
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
PlaylistItemDelegate::PlaylistItemDelegate( TrackView* parent, TrackProxyModel* proxy )
|
PlaylistItemDelegate::PlaylistItemDelegate( TrackView* parent, PlayableProxyModel* proxy )
|
||||||
: QStyledItemDelegate( (QObject*)parent )
|
: QStyledItemDelegate( (QObject*)parent )
|
||||||
, m_view( parent )
|
, m_view( parent )
|
||||||
, m_model( proxy )
|
, m_model( proxy )
|
||||||
@@ -67,8 +67,8 @@ PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel
|
|||||||
|
|
||||||
if ( index.isValid() )
|
if ( index.isValid() )
|
||||||
{
|
{
|
||||||
int style = index.data( TrackModel::StyleRole ).toInt();
|
int style = index.data( PlayableModel::StyleRole ).toInt();
|
||||||
if ( style == TrackModel::Short || style == TrackModel::ShortWithAvatars )
|
if ( style == PlayableModel::Short || style == PlayableModel::ShortWithAvatars )
|
||||||
{
|
{
|
||||||
int rowHeight = option.fontMetrics.height() + 8;
|
int rowHeight = option.fontMetrics.height() + 8;
|
||||||
size.setHeight( rowHeight * 2 );
|
size.setHeight( rowHeight * 2 );
|
||||||
@@ -101,17 +101,17 @@ PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, const
|
|||||||
void
|
void
|
||||||
PlaylistItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
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 )
|
switch ( style )
|
||||||
{
|
{
|
||||||
case TrackModel::Detailed:
|
case PlayableModel::Detailed:
|
||||||
paintDetailed( painter, option, index );
|
paintDetailed( painter, option, index );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TrackModel::Short:
|
case PlayableModel::Short:
|
||||||
paintShort( painter, option, index );
|
paintShort( painter, option, index );
|
||||||
break;
|
break;
|
||||||
case TrackModel::ShortWithAvatars:
|
case PlayableModel::ShortWithAvatars:
|
||||||
paintShort( painter, option, index, true );
|
paintShort( painter, option, index, true );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
|||||||
qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
|
qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
|
||||||
|
|
||||||
if ( m_view->hoveredIndex().row() == index.row() && m_view->hoveredIndex().column() == index.column() &&
|
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 );
|
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 );
|
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();
|
painter->save();
|
||||||
|
|
||||||
if ( index.column() == TrackModel::Score )
|
if ( index.column() == PlayableModel::Score )
|
||||||
{
|
{
|
||||||
QColor barColor( 167, 183, 211 ); // This matches the sidebar (sourcetreeview.cpp:672)
|
QColor barColor( 167, 183, 211 ); // This matches the sidebar (sourcetreeview.cpp:672)
|
||||||
if ( opt.state & QStyle::State_Selected )
|
if ( opt.state & QStyle::State_Selected )
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
class TrackModel;
|
class TrackModel;
|
||||||
class PlayableItem;
|
class PlayableItem;
|
||||||
class TrackProxyModel;
|
class PlayableProxyModel;
|
||||||
class TrackView;
|
class TrackView;
|
||||||
|
|
||||||
class DLLEXPORT PlaylistItemDelegate : public QStyledItemDelegate
|
class DLLEXPORT PlaylistItemDelegate : public QStyledItemDelegate
|
||||||
@@ -34,7 +34,7 @@ class DLLEXPORT PlaylistItemDelegate : public QStyledItemDelegate
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlaylistItemDelegate( TrackView* parent = 0, TrackProxyModel* proxy = 0 );
|
PlaylistItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0 );
|
||||||
|
|
||||||
void updateRowSize( const QModelIndex& index );
|
void updateRowSize( const QModelIndex& index );
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ private:
|
|||||||
QTextOption m_bottomOption;
|
QTextOption m_bottomOption;
|
||||||
|
|
||||||
TrackView* m_view;
|
TrackView* m_view;
|
||||||
TrackProxyModel* m_model;
|
PlayableProxyModel* m_model;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLAYLISTITEMDELEGATE_H
|
#endif // PLAYLISTITEMDELEGATE_H
|
||||||
|
@@ -29,9 +29,9 @@
|
|||||||
#include "SourceList.h"
|
#include "SourceList.h"
|
||||||
|
|
||||||
#include "PlaylistView.h"
|
#include "PlaylistView.h"
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
#include "PlayableItem.h"
|
#include "PlayableItem.h"
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "TrackView.h"
|
#include "TrackView.h"
|
||||||
#include "TrackHeader.h"
|
#include "TrackHeader.h"
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
PlaylistLargeItemDelegate::PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent, TrackProxyModel* proxy )
|
PlaylistLargeItemDelegate::PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent, PlayableProxyModel* proxy )
|
||||||
: QStyledItemDelegate( (QObject*)parent )
|
: QStyledItemDelegate( (QObject*)parent )
|
||||||
, m_view( parent )
|
, m_view( parent )
|
||||||
, m_model( proxy )
|
, m_model( proxy )
|
||||||
|
@@ -32,7 +32,7 @@ class PixmapDelegateFader;
|
|||||||
|
|
||||||
class TrackModel;
|
class TrackModel;
|
||||||
class PlayableItem;
|
class PlayableItem;
|
||||||
class TrackProxyModel;
|
class PlayableProxyModel;
|
||||||
class TrackView;
|
class TrackView;
|
||||||
|
|
||||||
class DLLEXPORT PlaylistLargeItemDelegate : public QStyledItemDelegate
|
class DLLEXPORT PlaylistLargeItemDelegate : public QStyledItemDelegate
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
enum DisplayMode
|
enum DisplayMode
|
||||||
{ LovedTracks, RecentlyPlayed, LatestAdditions };
|
{ LovedTracks, RecentlyPlayed, LatestAdditions };
|
||||||
|
|
||||||
PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent = 0, TrackProxyModel* proxy = 0 );
|
PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent = 0, PlayableProxyModel* proxy = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||||
@@ -68,7 +68,7 @@ private:
|
|||||||
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps;
|
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps;
|
||||||
|
|
||||||
TrackView* m_view;
|
TrackView* m_view;
|
||||||
TrackProxyModel* m_model;
|
PlayableProxyModel* m_model;
|
||||||
DisplayMode m_mode;
|
DisplayMode m_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
|
|
||||||
PlaylistModel::PlaylistModel( QObject* parent )
|
PlaylistModel::PlaylistModel( QObject* parent )
|
||||||
: TrackModel( parent )
|
: PlayableModel( parent )
|
||||||
, m_isTemporary( false )
|
, m_isTemporary( false )
|
||||||
, m_changesOngoing( false )
|
, m_changesOngoing( false )
|
||||||
, m_isLoading( false )
|
, m_isLoading( false )
|
||||||
@@ -106,7 +106,7 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn
|
|||||||
void
|
void
|
||||||
PlaylistModel::clear()
|
PlaylistModel::clear()
|
||||||
{
|
{
|
||||||
TrackModel::clear();
|
PlayableModel::clear();
|
||||||
|
|
||||||
m_waitingForResolved.clear();
|
m_waitingForResolved.clear();
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ PlaylistModel::append( const Tomahawk::artist_ptr& artist )
|
|||||||
void
|
void
|
||||||
PlaylistModel::insert( const Tomahawk::query_ptr& query, int row )
|
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
|
PlaylistModel::mimeData( const QModelIndexList& indexes ) const
|
||||||
{
|
{
|
||||||
// Add the playlist id to the mime data so that we can detect dropping on ourselves
|
// 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() )
|
if ( !m_playlist.isNull() )
|
||||||
d->setData( "application/tomahawk.playlist.id", m_playlist->guid().toLatin1() );
|
d->setData( "application/tomahawk.playlist.id", m_playlist->guid().toLatin1() );
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ PlaylistModel::playlistEntries() const
|
|||||||
void
|
void
|
||||||
PlaylistModel::remove( int row, bool moreToCome )
|
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 )
|
if ( item && !m_isLoading )
|
||||||
m_savedRemoveTracks << item->query();
|
m_savedRemoveTracks << item->query();
|
||||||
|
|
||||||
TrackModel::remove( index, moreToCome );
|
PlayableModel::remove( index, moreToCome );
|
||||||
|
|
||||||
if ( !moreToCome )
|
if ( !moreToCome )
|
||||||
endPlaylistChanges();
|
endPlaylistChanges();
|
||||||
@@ -522,14 +522,14 @@ PlaylistModel::remove( const QModelIndex& index, bool moreToCome )
|
|||||||
void
|
void
|
||||||
PlaylistModel::remove( const QList<QModelIndex>& indexes )
|
PlaylistModel::remove( const QList<QModelIndex>& indexes )
|
||||||
{
|
{
|
||||||
TrackModel::remove( indexes );
|
PlayableModel::remove( indexes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistModel::remove( const QList<QPersistentModelIndex>& indexes )
|
PlaylistModel::remove( const QList<QPersistentModelIndex>& indexes )
|
||||||
{
|
{
|
||||||
TrackModel::remove( indexes );
|
PlayableModel::remove( indexes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
#include "Playlist.h"
|
#include "Playlist.h"
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
#include "PlaylistInterface.h"
|
#include "PlaylistInterface.h"
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
class QMimeData;
|
class QMimeData;
|
||||||
class QMetaData;
|
class QMetaData;
|
||||||
|
|
||||||
class DLLEXPORT PlaylistModel : public TrackModel
|
class DLLEXPORT PlaylistModel : public PlayableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
PlaylistProxyModel::PlaylistProxyModel( QObject* parent )
|
PlaylistProxyModel::PlaylistProxyModel( QObject* parent )
|
||||||
: TrackProxyModel( parent )
|
: PlayableProxyModel( parent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,11 +20,11 @@
|
|||||||
#ifndef PLAYLISTPROXYMODEL_H
|
#ifndef PLAYLISTPROXYMODEL_H
|
||||||
#define PLAYLISTPROXYMODEL_H
|
#define PLAYLISTPROXYMODEL_H
|
||||||
|
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
class DLLEXPORT PlaylistProxyModel : public TrackProxyModel
|
class DLLEXPORT PlaylistProxyModel : public PlayableProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
PlaylistProxyModelPlaylistInterface::PlaylistProxyModelPlaylistInterface( PlaylistProxyModel *proxyModel )
|
PlaylistProxyModelPlaylistInterface::PlaylistProxyModelPlaylistInterface( PlaylistProxyModel *proxyModel )
|
||||||
: TrackProxyModelPlaylistInterface( proxyModel )
|
: PlayableProxyModelPlaylistInterface( proxyModel )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#ifndef PLAYLISTPROXYMODELPLAYLISTINTERFACE_H
|
#ifndef PLAYLISTPROXYMODELPLAYLISTINTERFACE_H
|
||||||
#define PLAYLISTPROXYMODELPLAYLISTINTERFACE_H
|
#define PLAYLISTPROXYMODELPLAYLISTINTERFACE_H
|
||||||
|
|
||||||
#include "TrackProxyModelPlaylistInterface.h"
|
#include "PlayableProxyModelPlaylistInterface.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ class PlaylistProxyModel;
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
class DLLEXPORT PlaylistProxyModelPlaylistInterface : public TrackProxyModelPlaylistInterface
|
class DLLEXPORT PlaylistProxyModelPlaylistInterface : public PlayableProxyModelPlaylistInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -61,9 +61,9 @@ PlaylistView::setPlaylistModel( PlaylistModel* model )
|
|||||||
{
|
{
|
||||||
m_model = model;
|
m_model = model;
|
||||||
|
|
||||||
TrackView::setTrackModel( m_model );
|
TrackView::setPlayableModel( m_model );
|
||||||
setColumnHidden( TrackModel::Age, true ); // Hide age column per default
|
setColumnHidden( PlayableModel::Age, true ); // Hide age column per default
|
||||||
setColumnHidden( TrackModel::Composer, true ); // Hide composer column per default
|
setColumnHidden( PlayableModel::Composer, true ); // Hide composer column per default
|
||||||
|
|
||||||
if ( guid().isEmpty() )
|
if ( guid().isEmpty() )
|
||||||
{
|
{
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#ifndef PLAYLISTVIEW_H
|
#ifndef PLAYLISTVIEW_H
|
||||||
#define PLAYLISTVIEW_H
|
#define PLAYLISTVIEW_H
|
||||||
|
|
||||||
#include "playlist/TrackProxyModel.h"
|
#include "playlist/PlayableProxyModel.h"
|
||||||
#include "playlist/PlaylistModel.h"
|
#include "playlist/PlaylistModel.h"
|
||||||
#include "TrackView.h"
|
#include "TrackView.h"
|
||||||
#include "ViewPage.h"
|
#include "ViewPage.h"
|
||||||
|
@@ -34,7 +34,7 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
|
|
||||||
RecentlyAddedModel::RecentlyAddedModel( const source_ptr& source, QObject* parent )
|
RecentlyAddedModel::RecentlyAddedModel( const source_ptr& source, QObject* parent )
|
||||||
: TrackModel( parent )
|
: PlayableModel( parent )
|
||||||
, m_source( source )
|
, m_source( source )
|
||||||
, m_limit( LATEST_TRACK_ITEMS )
|
, m_limit( LATEST_TRACK_ITEMS )
|
||||||
{
|
{
|
||||||
|
@@ -23,11 +23,11 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
class DLLEXPORT RecentlyAddedModel : public TrackModel
|
class DLLEXPORT RecentlyAddedModel : public PlayableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
#include "TrackHeader.h"
|
#include "TrackHeader.h"
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
#include "TrackModel.h"
|
#include "PlayableModel.h"
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "PlayableItem.h"
|
#include "PlayableItem.h"
|
||||||
#include "audio/AudioEngine.h"
|
#include "audio/AudioEngine.h"
|
||||||
#include "context/ContextWidget.h"
|
#include "context/ContextWidget.h"
|
||||||
@@ -112,7 +112,7 @@ TrackView::setGuid( const QString& guid )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackView::setProxyModel( TrackProxyModel* model )
|
TrackView::setProxyModel( PlayableProxyModel* model )
|
||||||
{
|
{
|
||||||
m_proxyModel = model;
|
m_proxyModel = model;
|
||||||
|
|
||||||
@@ -127,19 +127,19 @@ void
|
|||||||
TrackView::setModel( QAbstractItemModel* model )
|
TrackView::setModel( QAbstractItemModel* model )
|
||||||
{
|
{
|
||||||
Q_UNUSED( model );
|
Q_UNUSED( model );
|
||||||
tDebug() << "Explicitly use setTrackModel instead";
|
tDebug() << "Explicitly use setPlayableModel instead";
|
||||||
Q_ASSERT( false );
|
Q_ASSERT( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackView::setTrackModel( TrackModel* model )
|
TrackView::setPlayableModel( PlayableModel* model )
|
||||||
{
|
{
|
||||||
m_model = model;
|
m_model = model;
|
||||||
|
|
||||||
if ( m_proxyModel )
|
if ( m_proxyModel )
|
||||||
{
|
{
|
||||||
m_proxyModel->setSourceTrackModel( m_model );
|
m_proxyModel->setSourcePlayableModel( m_model );
|
||||||
}
|
}
|
||||||
|
|
||||||
connect( m_model, SIGNAL( loadingStarted() ), m_loadingSpinner, SLOT( fadeIn() ) );
|
connect( m_model, SIGNAL( loadingStarted() ), m_loadingSpinner, SLOT( fadeIn() ) );
|
||||||
@@ -152,9 +152,9 @@ TrackView::setTrackModel( TrackModel* model )
|
|||||||
|
|
||||||
switch( model->style() )
|
switch( model->style() )
|
||||||
{
|
{
|
||||||
case TrackModel::Short:
|
case PlayableModel::Short:
|
||||||
case TrackModel::ShortWithAvatars:
|
case PlayableModel::ShortWithAvatars:
|
||||||
case TrackModel::Large:
|
case PlayableModel::Large:
|
||||||
setHeaderHidden( true );
|
setHeaderHidden( true );
|
||||||
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||||
break;
|
break;
|
||||||
@@ -169,7 +169,7 @@ TrackView::setTrackModel( TrackModel* model )
|
|||||||
void
|
void
|
||||||
TrackView::onViewChanged()
|
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;
|
return;
|
||||||
|
|
||||||
if ( m_timer.isActive() )
|
if ( m_timer.isActive() )
|
||||||
@@ -597,10 +597,10 @@ TrackView::updateHoverIndex( const QPoint& pos )
|
|||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_model || m_model->style() != TrackModel::Detailed )
|
if ( !m_model || m_model->style() != PlayableModel::Detailed )
|
||||||
return;
|
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 &&
|
if ( pos.x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 &&
|
||||||
pos.x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) )
|
pos.x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) )
|
||||||
@@ -649,7 +649,7 @@ TrackView::mousePressEvent( QMouseEvent* event )
|
|||||||
{
|
{
|
||||||
QTreeView::mousePressEvent( event );
|
QTreeView::mousePressEvent( event );
|
||||||
|
|
||||||
if ( !m_model || m_model->style() != TrackModel::Detailed )
|
if ( !m_model || m_model->style() != PlayableModel::Detailed )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QModelIndex idx = indexAt( event->pos() );
|
QModelIndex idx = indexAt( event->pos() );
|
||||||
@@ -659,7 +659,7 @@ TrackView::mousePressEvent( QMouseEvent* event )
|
|||||||
PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( idx ) );
|
PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( idx ) );
|
||||||
switch ( idx.column() )
|
switch ( idx.column() )
|
||||||
{
|
{
|
||||||
case TrackModel::Artist:
|
case PlayableModel::Artist:
|
||||||
{
|
{
|
||||||
if ( item->query()->numResults() )
|
if ( item->query()->numResults() )
|
||||||
{
|
{
|
||||||
@@ -672,7 +672,7 @@ TrackView::mousePressEvent( QMouseEvent* event )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TrackModel::Album:
|
case PlayableModel::Album:
|
||||||
{
|
{
|
||||||
if ( item->query()->numResults() )
|
if ( item->query()->numResults() )
|
||||||
{
|
{
|
||||||
@@ -686,7 +686,7 @@ TrackView::mousePressEvent( QMouseEvent* event )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TrackModel::Track:
|
case PlayableModel::Track:
|
||||||
{
|
{
|
||||||
ViewManager::instance()->show( item->query() );
|
ViewManager::instance()->show( item->query() );
|
||||||
break;
|
break;
|
||||||
|
@@ -32,8 +32,8 @@
|
|||||||
class QAction;
|
class QAction;
|
||||||
class AnimatedSpinner;
|
class AnimatedSpinner;
|
||||||
class TrackHeader;
|
class TrackHeader;
|
||||||
class TrackModel;
|
class PlayableModel;
|
||||||
class TrackProxyModel;
|
class PlayableProxyModel;
|
||||||
class OverlayWidget;
|
class OverlayWidget;
|
||||||
|
|
||||||
class DLLEXPORT TrackView : public QTreeView
|
class DLLEXPORT TrackView : public QTreeView
|
||||||
@@ -47,12 +47,12 @@ public:
|
|||||||
virtual QString guid() const { return m_guid; }
|
virtual QString guid() const { return m_guid; }
|
||||||
virtual void setGuid( const QString& guid );
|
virtual void setGuid( const QString& guid );
|
||||||
|
|
||||||
virtual void setTrackModel( TrackModel* model );
|
virtual void setPlayableModel( PlayableModel* model );
|
||||||
virtual void setModel( QAbstractItemModel* model );
|
virtual void setModel( QAbstractItemModel* model );
|
||||||
void setProxyModel( TrackProxyModel* model );
|
void setProxyModel( PlayableProxyModel* model );
|
||||||
|
|
||||||
virtual TrackModel* model() const { return m_model; }
|
virtual PlayableModel* model() const { return m_model; }
|
||||||
TrackProxyModel* proxyModel() const { return m_proxyModel; }
|
PlayableProxyModel* proxyModel() const { return m_proxyModel; }
|
||||||
PlaylistItemDelegate* delegate() const { return m_delegate; }
|
PlaylistItemDelegate* delegate() const { return m_delegate; }
|
||||||
TrackHeader* header() const { return m_header; }
|
TrackHeader* header() const { return m_header; }
|
||||||
OverlayWidget* overlay() const { return m_overlay; }
|
OverlayWidget* overlay() const { return m_overlay; }
|
||||||
@@ -114,8 +114,8 @@ private:
|
|||||||
void updateHoverIndex( const QPoint& pos );
|
void updateHoverIndex( const QPoint& pos );
|
||||||
|
|
||||||
QString m_guid;
|
QString m_guid;
|
||||||
TrackModel* m_model;
|
PlayableModel* m_model;
|
||||||
TrackProxyModel* m_proxyModel;
|
PlayableProxyModel* m_proxyModel;
|
||||||
PlaylistItemDelegate* m_delegate;
|
PlaylistItemDelegate* m_delegate;
|
||||||
TrackHeader* m_header;
|
TrackHeader* m_header;
|
||||||
OverlayWidget* m_overlay;
|
OverlayWidget* m_overlay;
|
||||||
|
@@ -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
|
{ // if the user is manually removing the last one, re-add as we're a station
|
||||||
newTrackLoading();
|
newTrackLoading();
|
||||||
}
|
}
|
||||||
TrackModel::remove( idx );
|
PlayableModel::remove( idx );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PlaylistModel::remove( idx, moreToCome );
|
PlaylistModel::remove( idx, moreToCome );
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
#include "PlaylistModel.h"
|
#include "PlaylistModel.h"
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "TrackHeader.h"
|
#include "TrackHeader.h"
|
||||||
#include "DynamicModel.h"
|
#include "DynamicModel.h"
|
||||||
#include "widgets/OverlayWidget.h"
|
#include "widgets/OverlayWidget.h"
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "DynamicControlList.h"
|
#include "DynamicControlList.h"
|
||||||
#include "dynamic/DynamicModel.h"
|
#include "dynamic/DynamicModel.h"
|
||||||
#include "TrackProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "PlayableItem.h"
|
#include "PlayableItem.h"
|
||||||
#include "dynamic/GeneratorInterface.h"
|
#include "dynamic/GeneratorInterface.h"
|
||||||
#include "dynamic/GeneratorFactory.h"
|
#include "dynamic/GeneratorFactory.h"
|
||||||
|
@@ -72,7 +72,7 @@ SocialPlaylistWidget::SocialPlaylistWidget ( QWidget* parent )
|
|||||||
|
|
||||||
m_topForeignTracksModel = new PlaylistModel( ui->newTracksView );
|
m_topForeignTracksModel = new PlaylistModel( ui->newTracksView );
|
||||||
ui->newTracksView->setPlaylistModel( m_topForeignTracksModel );
|
ui->newTracksView->setPlaylistModel( m_topForeignTracksModel );
|
||||||
m_topForeignTracksModel->setStyle( TrackModel::Short );
|
m_topForeignTracksModel->setStyle( PlayableModel::Short );
|
||||||
ui->newTracksView->overlay()->setEnabled( false );
|
ui->newTracksView->overlay()->setEnabled( false );
|
||||||
|
|
||||||
m_popularNewAlbumsModel = new AlbumModel( ui->newAlbumsView );
|
m_popularNewAlbumsModel = new AlbumModel( ui->newAlbumsView );
|
||||||
|
@@ -72,7 +72,7 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
|||||||
updatePlaylists();
|
updatePlaylists();
|
||||||
|
|
||||||
m_tracksModel = new RecentlyPlayedModel( source_ptr(), ui->tracksView );
|
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->overlay()->setEnabled( false );
|
||||||
ui->tracksView->setPlaylistModel( m_tracksModel );
|
ui->tracksView->setPlaylistModel( m_tracksModel );
|
||||||
|
|
||||||
|
@@ -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 > ) ) );
|
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 );
|
PlaylistModel* trackModel = new PlaylistModel( ui->tracksViewLeft );
|
||||||
trackModel->setStyle( TrackModel::Large );
|
trackModel->setStyle( PlayableModel::Large );
|
||||||
|
|
||||||
m_trackModels[ chartId ] = trackModel;
|
m_trackModels[ chartId ] = trackModel;
|
||||||
|
|
||||||
|
@@ -76,8 +76,8 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
|||||||
ui->relatedArtists->proxyModel()->sort( -1 );
|
ui->relatedArtists->proxyModel()->sort( -1 );
|
||||||
|
|
||||||
m_topHitsModel = new PlaylistModel( ui->topHits );
|
m_topHitsModel = new PlaylistModel( ui->topHits );
|
||||||
m_topHitsModel->setStyle( TrackModel::Short );
|
m_topHitsModel->setStyle( PlayableModel::Short );
|
||||||
ui->topHits->setTrackModel( m_topHitsModel );
|
ui->topHits->setPlayableModel( m_topHitsModel );
|
||||||
ui->topHits->setSortingEnabled( false );
|
ui->topHits->setSortingEnabled( false );
|
||||||
|
|
||||||
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( 48, 48 ) );
|
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( 48, 48 ) );
|
||||||
|
@@ -62,12 +62,12 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget*
|
|||||||
ui->historyView->overlay()->setEnabled( false );
|
ui->historyView->overlay()->setEnabled( false );
|
||||||
|
|
||||||
m_recentTracksModel = new RecentlyAddedModel( source, ui->recentCollectionView );
|
m_recentTracksModel = new RecentlyAddedModel( source, ui->recentCollectionView );
|
||||||
m_recentTracksModel->setStyle( TrackModel::Short );
|
m_recentTracksModel->setStyle( PlayableModel::Short );
|
||||||
ui->recentCollectionView->setTrackModel( m_recentTracksModel );
|
ui->recentCollectionView->setPlayableModel( m_recentTracksModel );
|
||||||
ui->recentCollectionView->sortByColumn( TrackModel::Age, Qt::DescendingOrder );
|
ui->recentCollectionView->sortByColumn( PlayableModel::Age, Qt::DescendingOrder );
|
||||||
|
|
||||||
m_historyModel = new RecentlyPlayedModel( source, ui->historyView );
|
m_historyModel = new RecentlyPlayedModel( source, ui->historyView );
|
||||||
m_historyModel->setStyle( TrackModel::Short );
|
m_historyModel->setStyle( PlayableModel::Short );
|
||||||
ui->historyView->setPlaylistModel( m_historyModel );
|
ui->historyView->setPlaylistModel( m_historyModel );
|
||||||
|
|
||||||
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
|
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
|
||||||
|
@@ -533,7 +533,7 @@ SourceItem::latestAdditionsClicked()
|
|||||||
cv->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
cv->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
|
||||||
RecentlyAddedModel* raModel = new RecentlyAddedModel( m_source, cv );
|
RecentlyAddedModel* raModel = new RecentlyAddedModel( m_source, cv );
|
||||||
raModel->setStyle( TrackModel::Large );
|
raModel->setStyle( PlayableModel::Large );
|
||||||
raModel->setTitle( tr( "Latest Additions" ) );
|
raModel->setTitle( tr( "Latest Additions" ) );
|
||||||
|
|
||||||
if ( m_source->isLocal() )
|
if ( m_source->isLocal() )
|
||||||
@@ -545,8 +545,8 @@ SourceItem::latestAdditionsClicked()
|
|||||||
connect( del, SIGNAL( updateIndex( QModelIndex ) ), cv, SLOT( update( QModelIndex ) ) );
|
connect( del, SIGNAL( updateIndex( QModelIndex ) ), cv, SLOT( update( QModelIndex ) ) );
|
||||||
cv->setItemDelegate( del );
|
cv->setItemDelegate( del );
|
||||||
|
|
||||||
cv->setTrackModel( raModel );
|
cv->setPlayableModel( raModel );
|
||||||
cv->sortByColumn( TrackModel::Age, Qt::DescendingOrder );
|
cv->sortByColumn( PlayableModel::Age, Qt::DescendingOrder );
|
||||||
|
|
||||||
m_latestAdditionsPage = cv;
|
m_latestAdditionsPage = cv;
|
||||||
}
|
}
|
||||||
@@ -573,7 +573,7 @@ SourceItem::recentPlaysClicked()
|
|||||||
pv->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
pv->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
|
||||||
RecentlyPlayedModel* raModel = new RecentlyPlayedModel( m_source, pv );
|
RecentlyPlayedModel* raModel = new RecentlyPlayedModel( m_source, pv );
|
||||||
raModel->setStyle( TrackModel::Large );
|
raModel->setStyle( PlayableModel::Large );
|
||||||
raModel->setTitle( tr( "Recently Played Tracks" ) );
|
raModel->setTitle( tr( "Recently Played Tracks" ) );
|
||||||
|
|
||||||
if ( m_source->isLocal() )
|
if ( m_source->isLocal() )
|
||||||
|
Reference in New Issue
Block a user