1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 23:39:42 +01: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::Origin, true ); // Hide origin column per default
setColumnHidden( TrackModel::Composer, true ); //Hide composer column per default
setGuid( QString( "collectionview/%1" ).arg( model->columnCount() ) );
sortByColumn( TrackModel::Artist, Qt::AscendingOrder );

View File

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

View File

@ -93,7 +93,7 @@ TrackModel::columnCount( const QModelIndex& parent ) const
case Detailed:
default:
return 11;
return 12;
break;
}
}
@ -178,6 +178,10 @@ TrackModel::data( const QModelIndex& index, int role ) const
return query->results().first()->album()->name();
break;
case Composer:
return query->results().first()->composer()->name();
break;
case Duration:
return TomahawkUtils::timeToString( query->results().first()->duration() );
break;
@ -230,7 +234,7 @@ TrackModel::headerData( int section, Qt::Orientation orientation, int role ) con
Q_UNUSED( orientation );
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 )
{
return headers.at( section );

View File

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

View File

@ -349,7 +349,7 @@ QVariant
TreeModel::headerData( int section, Qt::Orientation orientation, int role ) const
{
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 )
{
return headers.at( section );

View File

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