1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 11:50:37 +02:00

Added Composer column to the collection and playlist model/views.

This commit is contained in:
Teo Mrnjavac
2011-11-18 16:23:04 +01:00
committed by Dominik Schmidt
parent 47e9f27199
commit 9661a38c10
6 changed files with 21 additions and 14 deletions

View File

@@ -60,6 +60,7 @@ CollectionView::setTrackModel( TrackModel* model )
setColumnHidden( TrackModel::Score, true ); // Hide score column per default setColumnHidden( TrackModel::Score, true ); // Hide score column per default
setColumnHidden( TrackModel::Origin, true ); // Hide origin column per default setColumnHidden( TrackModel::Origin, true ); // Hide origin column per default
setColumnHidden( TrackModel::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( TrackModel::Artist, Qt::AscendingOrder );

View File

@@ -62,6 +62,7 @@ PlaylistView::setPlaylistModel( PlaylistModel* model )
TrackView::setTrackModel( m_model ); TrackView::setTrackModel( m_model );
setColumnHidden( TrackModel::Age, true ); // Hide age column per default setColumnHidden( TrackModel::Age, true ); // Hide age column per default
setColumnHidden( TrackModel::Composer, true ); // Hide composer column per default
if ( guid().isEmpty() ) if ( guid().isEmpty() )
{ {

View File

@@ -93,7 +93,7 @@ TrackModel::columnCount( const QModelIndex& parent ) const
case Detailed: case Detailed:
default: default:
return 11; return 12;
break; break;
} }
} }
@@ -178,6 +178,10 @@ TrackModel::data( const QModelIndex& index, int role ) const
return query->results().first()->album()->name(); return query->results().first()->album()->name();
break; break;
case Composer:
return query->results().first()->composer()->name();
break;
case Duration: case Duration:
return TomahawkUtils::timeToString( query->results().first()->duration() ); return TomahawkUtils::timeToString( query->results().first()->duration() );
break; break;
@@ -230,7 +234,7 @@ TrackModel::headerData( int section, Qt::Orientation orientation, int role ) con
Q_UNUSED( orientation ); Q_UNUSED( orientation );
QStringList headers; QStringList headers;
headers << tr( "Artist" ) << tr( "Title" ) << tr( "Album" ) << tr( "Track" ) << tr( "Duration" ) << tr( "Bitrate" ) << tr( "Age" ) << tr( "Year" ) << tr( "Size" ) << tr( "Origin" ) << tr( "Score" ); headers << tr( "Artist" ) << tr( "Title" ) << tr( "Composer" ) << tr( "Album" ) << tr( "Track" ) << tr( "Duration" ) << tr( "Bitrate" ) << tr( "Age" ) << tr( "Year" ) << tr( "Size" ) << tr( "Origin" ) << tr( "Score" );
if ( role == Qt::DisplayRole && section >= 0 ) if ( role == Qt::DisplayRole && section >= 0 )
{ {
return headers.at( section ); return headers.at( section );

View File

@@ -44,15 +44,16 @@ public:
enum Columns { enum Columns {
Artist = 0, Artist = 0,
Track = 1, Track = 1,
Album = 2, Composer = 2,
AlbumPos = 3, Album = 3,
Duration = 4, AlbumPos = 4,
Bitrate = 5, Duration = 5,
Age = 6, Bitrate = 6,
Year = 7, Age = 7,
Filesize = 8, Year = 8,
Origin = 9, Filesize = 9,
Score = 10, Origin = 10,
Score = 11
}; };
explicit TrackModel( QObject* parent = 0 ); explicit TrackModel( QObject* parent = 0 );

View File

@@ -349,7 +349,7 @@ QVariant
TreeModel::headerData( int section, Qt::Orientation orientation, int role ) const TreeModel::headerData( int section, Qt::Orientation orientation, int role ) const
{ {
QStringList headers; QStringList headers;
headers << tr( "Name" ) << tr( "Duration" ) << tr( "Bitrate" ) << tr( "Age" ) << tr( "Year" ) << tr( "Size" ) << tr( "Origin" ); headers << tr( "Name" ) << tr( "Composer" ) << tr( "Duration" ) << tr( "Bitrate" ) << tr( "Age" ) << tr( "Year" ) << tr( "Size" ) << tr( "Origin" );
if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 ) if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 )
{ {
return headers.at( section ); return headers.at( section );

View File

@@ -44,14 +44,14 @@ Q_OBJECT
public: public:
enum Columns { enum Columns {
Name = 0, Name = 0,
Composer,
Duration, Duration,
Bitrate, Bitrate,
Age, Age,
Year, Year,
Filesize, Filesize,
Origin, Origin,
AlbumPosition, AlbumPosition
Composer
}; };
enum ColumnStyle enum ColumnStyle