diff --git a/src/libtomahawk/album.cpp b/src/libtomahawk/album.cpp index 15d28261d..fd56e8409 100644 --- a/src/libtomahawk/album.cpp +++ b/src/libtomahawk/album.cpp @@ -154,4 +154,4 @@ Album::playlistInterface() } return m_playlistInterface; -} \ No newline at end of file +} diff --git a/src/libtomahawk/albumplaylistinterface.cpp b/src/libtomahawk/albumplaylistinterface.cpp index 3d44e32dc..912273f09 100644 --- a/src/libtomahawk/albumplaylistinterface.cpp +++ b/src/libtomahawk/albumplaylistinterface.cpp @@ -90,6 +90,7 @@ AlbumPlaylistInterface::tracks() DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks(); cmd->setAlbum( m_album ); cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition ); + //this takes discnumber into account as well connect( cmd, SIGNAL( tracks( QList, QVariant ) ), m_album.data(), SLOT( onTracksAdded( QList ) ) ); diff --git a/src/libtomahawk/database/databaseimpl.cpp b/src/libtomahawk/database/databaseimpl.cpp index d8bfe7c4b..9d8bd3d7a 100644 --- a/src/libtomahawk/database/databaseimpl.cpp +++ b/src/libtomahawk/database/databaseimpl.cpp @@ -569,10 +569,11 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery ) "composer.name as cmpname, " //14 "file.source, " //15 "file_join.albumpos, " //16 - "artist.id as artid, " //17 - "album.id as albid, " //18 - "composer.id as cmpid, " //19 - "track_attributes.v as year " //20 + "file_join.discnumber, " //17 + "artist.id as artid, " //18 + "album.id as albid, " //19 + "composer.id as cmpid, " //20 + "track_attributes.v as year " //21 "FROM file, file_join, artist, track, track_attributes " "LEFT JOIN album ON album.id = file_join.album " "LEFT JOIN artist AS composer on composer.id = file_join.composer " @@ -610,9 +611,9 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery ) } res = Tomahawk::Result::get( url ); - Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 17 ).toUInt(), query.value( 11 ).toString() ); - Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 18 ).toUInt(), query.value( 12 ).toString(), artist ); - Tomahawk::artist_ptr composer = Tomahawk::Artist::get( query.value( 19 ).toUInt(), query.value( 14 ).toString() ); + Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 18 ).toUInt(), query.value( 11 ).toString() ); + Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 19 ).toUInt(), query.value( 12 ).toString(), artist ); + Tomahawk::artist_ptr composer = Tomahawk::Artist::get( query.value( 20 ).toUInt(), query.value( 14 ).toString() ); res->setModificationTime( query.value( 1 ).toUInt() ); res->setSize( query.value( 2 ).toUInt() ); @@ -625,10 +626,11 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery ) res->setScore( 1.0 ); res->setTrack( query.value( 13 ).toString() ); res->setAlbumPos( query.value( 16 ).toUInt() ); + res->setDiscNumber( query.value( 17 ).toUInt() ); res->setRID( uuid() ); res->setTrackId( query.value( 9 ).toUInt() ); res->setCollection( s->collection() ); - res->setYear( query.value( 20 ).toUInt() ); + res->setYear( query.value( 21 ).toUInt() ); } return res; diff --git a/src/libtomahawk/playlist/treemodel.cpp b/src/libtomahawk/playlist/treemodel.cpp index 43727f576..94808c200 100644 --- a/src/libtomahawk/playlist/treemodel.cpp +++ b/src/libtomahawk/playlist/treemodel.cpp @@ -330,8 +330,9 @@ TreeModel::data( const QModelIndex& index, int role ) const switch( index.column() ) { case Name: - return QString( "%1%2" ).arg( query->albumpos() > 0 ? QString( "%1. ").arg( query->albumpos() ) : QString() ) - .arg( query->track() ); + return QString( "%1%2%3" ).arg( query->discnumber() > 0 ? QString( "%1." ).arg( query->discnumber() ) : QString() ) + .arg( query->albumpos() > 0 ? QString( "%1. ").arg( query->albumpos() ) : QString() ) + .arg( query->track() ); case AlbumPosition: return entry->query()->albumpos();