mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
Fixed the PlaybackQueue::CurrentTrackChanged signal to be called even with empty track.
This commit is contained in:
parent
94f71d27c5
commit
c405f1d7f6
@ -112,10 +112,9 @@ void PlaybackQueue::Play(){
|
|||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
void PlaybackQueue::Next(){
|
void PlaybackQueue::Next(){
|
||||||
musik::core::TrackPtr track( this->nowPlaying->NextTrack() );
|
musik::core::TrackPtr track( this->nowPlaying->NextTrack() );
|
||||||
if(track){
|
|
||||||
this->SetCurrentTrack(track->Copy());
|
this->SetCurrentTrack(track);
|
||||||
this->Play();
|
this->Play();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
@ -124,10 +123,10 @@ void PlaybackQueue::Next(){
|
|||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
void PlaybackQueue::Previous(){
|
void PlaybackQueue::Previous(){
|
||||||
musik::core::TrackPtr track( this->nowPlaying->PreviousTrack() );
|
musik::core::TrackPtr track( this->nowPlaying->PreviousTrack() );
|
||||||
if(track){
|
|
||||||
this->SetCurrentTrack(track->Copy());
|
this->SetCurrentTrack(track);
|
||||||
this->Play();
|
this->Play();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
@ -155,8 +154,7 @@ TrackPtr PlaybackQueue::CurrentTrack(){
|
|||||||
|
|
||||||
if(!this->currentTrack){
|
if(!this->currentTrack){
|
||||||
// If the current track is empty, get a track from the nowPlaying tracklist
|
// If the current track is empty, get a track from the nowPlaying tracklist
|
||||||
this->SetCurrentTrack( this->nowPlaying->CurrentTrack()->Copy() );
|
this->SetCurrentTrack( this->nowPlaying->CurrentTrack() );
|
||||||
|
|
||||||
}
|
}
|
||||||
return this->currentTrack;
|
return this->currentTrack;
|
||||||
}
|
}
|
||||||
@ -169,20 +167,24 @@ TrackPtr PlaybackQueue::CurrentTrack(){
|
|||||||
///for all the tracks metadata
|
///for all the tracks metadata
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
void PlaybackQueue::SetCurrentTrack(TrackPtr track){
|
void PlaybackQueue::SetCurrentTrack(TrackPtr track){
|
||||||
if(this->currentTrack!=track){
|
|
||||||
this->currentTrack = track;
|
|
||||||
|
|
||||||
// Get all metadata to the track
|
if(track){
|
||||||
if(this->currentTrack){
|
this->currentTrack = track->Copy();
|
||||||
this->metadataQuery.Clear();
|
}else{
|
||||||
this->metadataQuery.RequestAllMetakeys();
|
this->currentTrack = musik::core::TrackPtr();
|
||||||
this->metadataQuery.RequestTrack(this->currentTrack);
|
}
|
||||||
this->nowPlaying->Library()->AddQuery(this->metadataQuery,musik::core::Query::Wait|musik::core::Query::AutoCallback|musik::core::Query::UnCanceable|musik::core::Query::Prioritize);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call the signal if track updates
|
// Get all metadata to the track
|
||||||
this->CurrentTrackChanged(track);
|
if(this->currentTrack){
|
||||||
|
this->metadataQuery.Clear();
|
||||||
|
this->metadataQuery.RequestAllMetakeys();
|
||||||
|
this->metadataQuery.RequestTrack(this->currentTrack);
|
||||||
|
this->nowPlaying->Library()->AddQuery(this->metadataQuery,musik::core::Query::Wait|musik::core::Query::AutoCallback|musik::core::Query::UnCanceable|musik::core::Query::Prioritize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call the signal if track updates
|
||||||
|
this->CurrentTrackChanged(this->currentTrack);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
@ -115,12 +115,15 @@ void TransportController::OnTrackChange(musik::core::TrackPtr track){
|
|||||||
win32cpp::uistring title(_T("-"));
|
win32cpp::uistring title(_T("-"));
|
||||||
win32cpp::uistring artist(_T("-"));
|
win32cpp::uistring artist(_T("-"));
|
||||||
|
|
||||||
if(track->GetValue("title"))
|
if(track){
|
||||||
title.assign( track->GetValue("title") );
|
|
||||||
|
|
||||||
if(track->GetValue("visual_artist"))
|
if(track->GetValue("title"))
|
||||||
artist.assign( track->GetValue("visual_artist") );
|
title.assign( track->GetValue("title") );
|
||||||
|
|
||||||
|
if(track->GetValue("visual_artist"))
|
||||||
|
artist.assign( track->GetValue("visual_artist") );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
this->transportView.titleLabel->SetCaption(title);
|
this->transportView.titleLabel->SetCaption(title);
|
||||||
this->transportView.artistLabel->SetCaption(artist);
|
this->transportView.artistLabel->SetCaption(artist);
|
||||||
|
Loading…
Reference in New Issue
Block a user