1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 09:04:33 +02:00

Merge branch 'decltest' of github.com:tomahawk-player/tomahawk into decltest

This commit is contained in:
Michael Zanetti
2012-07-04 12:08:45 +02:00
3 changed files with 30 additions and 5 deletions

View File

@@ -259,15 +259,22 @@ PlayableModel::data( const QModelIndex& index, int role ) const
{ {
return QVariant(); return QVariant();
} }
else if ( role == Qt::TextAlignmentRole )
if ( role == Qt::TextAlignmentRole )
{ {
return QVariant( columnAlignment( index.column() ) ); return QVariant( columnAlignment( index.column() ) );
} }
int column = index.column();
if ( role >= Qt::UserRole )
{
// Map user-role to column
column = role - Qt::UserRole;
role = Qt::DisplayRole;
}
if ( !entry->query().isNull() ) if ( !entry->query().isNull() )
{ {
return queryData( entry->query()->displayQuery(), index.column(), role ); return queryData( entry->query()->displayQuery(), column, role );
} }
else if ( !entry->artist().isNull() ) else if ( !entry->artist().isNull() )
{ {

View File

@@ -38,7 +38,8 @@ class DLLEXPORT PlayableModel : public QAbstractItemModel
Q_OBJECT Q_OBJECT
public: public:
enum Columns { enum Columns
{
Artist = 0, Artist = 0,
Track = 1, Track = 1,
Composer = 2, Composer = 2,
@@ -54,6 +55,24 @@ public:
Name = 12 Name = 12
}; };
enum PlayableRoles
{
ArtistRole = Qt::UserRole,
TrackRole,
ComposerRole,
AlbumRole,
AlbumPosRole,
DurationRole,
BitrateRole,
AgeRole,
YearRole,
FilesizeRole,
OriginRole,
ScoreRole,
NameRole
};
explicit PlayableModel( QObject* parent = 0, bool loading = true ); explicit PlayableModel( QObject* parent = 0, bool loading = true );
virtual ~PlayableModel(); virtual ~PlayableModel();

View File

@@ -31,7 +31,6 @@ DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* pa
m_model->startOnDemand(); m_model->startOnDemand();
setSource( QUrl( "qrc" RESPATH "qml/StationScene.qml" ) ); setSource( QUrl( "qrc" RESPATH "qml/StationScene.qml" ) );
// TODO: fill m_model with the station stuff
} }