Skip to content

Commit 9372266

Browse files
teodschmidt
authored andcommitted
Get the discnumber in databaseimpl.cpp as well.
1 parent b8a38f7 commit 9372266

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

src/libtomahawk/album.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,4 @@ Album::playlistInterface()
154154
}
155155

156156
return m_playlistInterface;
157-
}
157+
}

src/libtomahawk/albumplaylistinterface.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ AlbumPlaylistInterface::tracks()
9090
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks();
9191
cmd->setAlbum( m_album );
9292
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
93+
//this takes discnumber into account as well
9394

9495
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
9596
m_album.data(), SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );

src/libtomahawk/database/databaseimpl.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,11 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
569569
"composer.name as cmpname, " //14
570570
"file.source, " //15
571571
"file_join.albumpos, " //16
572-
"artist.id as artid, " //17
573-
"album.id as albid, " //18
574-
"composer.id as cmpid, " //19
575-
"track_attributes.v as year " //20
572+
"file_join.discnumber, " //17
573+
"artist.id as artid, " //18
574+
"album.id as albid, " //19
575+
"composer.id as cmpid, " //20
576+
"track_attributes.v as year " //21
576577
"FROM file, file_join, artist, track, track_attributes "
577578
"LEFT JOIN album ON album.id = file_join.album "
578579
"LEFT JOIN artist AS composer on composer.id = file_join.composer "
@@ -610,9 +611,9 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
610611
}
611612

612613
res = Tomahawk::Result::get( url );
613-
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 17 ).toUInt(), query.value( 11 ).toString() );
614-
Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 18 ).toUInt(), query.value( 12 ).toString(), artist );
615-
Tomahawk::artist_ptr composer = Tomahawk::Artist::get( query.value( 19 ).toUInt(), query.value( 14 ).toString() );
614+
Tomahawk::artist_ptr artist = Tomahawk::Artist::get( query.value( 18 ).toUInt(), query.value( 11 ).toString() );
615+
Tomahawk::album_ptr album = Tomahawk::Album::get( query.value( 19 ).toUInt(), query.value( 12 ).toString(), artist );
616+
Tomahawk::artist_ptr composer = Tomahawk::Artist::get( query.value( 20 ).toUInt(), query.value( 14 ).toString() );
616617

617618
res->setModificationTime( query.value( 1 ).toUInt() );
618619
res->setSize( query.value( 2 ).toUInt() );
@@ -625,10 +626,11 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
625626
res->setScore( 1.0 );
626627
res->setTrack( query.value( 13 ).toString() );
627628
res->setAlbumPos( query.value( 16 ).toUInt() );
629+
res->setDiscNumber( query.value( 17 ).toUInt() );
628630
res->setRID( uuid() );
629631
res->setTrackId( query.value( 9 ).toUInt() );
630632
res->setCollection( s->collection() );
631-
res->setYear( query.value( 20 ).toUInt() );
633+
res->setYear( query.value( 21 ).toUInt() );
632634
}
633635

634636
return res;

src/libtomahawk/playlist/treemodel.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,9 @@ TreeModel::data( const QModelIndex& index, int role ) const
330330
switch( index.column() )
331331
{
332332
case Name:
333-
return QString( "%1%2" ).arg( query->albumpos() > 0 ? QString( "%1. ").arg( query->albumpos() ) : QString() )
334-
.arg( query->track() );
333+
return QString( "%1%2%3" ).arg( query->discnumber() > 0 ? QString( "%1." ).arg( query->discnumber() ) : QString() )
334+
.arg( query->albumpos() > 0 ? QString( "%1. ").arg( query->albumpos() ) : QString() )
335+
.arg( query->track() );
335336

336337
case AlbumPosition:
337338
return entry->query()->albumpos();

0 commit comments

Comments
 (0)