Skip to content

Commit

Permalink
Merge branch 'fix-next-track-after-stop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
gogglesguy committed Jul 30, 2015
2 parents 5180065 + 104fc87 commit fd5aa94
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 24 deletions.
21 changes: 13 additions & 8 deletions src/GMPlayerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,9 +1341,11 @@ void GMPlayerManager::notify_playback_finished() {
source=NULL;
}

/// Nothing else to do
if (stop_playback)
/// Nothing else to do, mark current as played
if (stop_playback) {
queue->getNext();
return;
}

//FIXME handle stop_playback
track = queue->getNext();
Expand Down Expand Up @@ -1372,13 +1374,16 @@ void GMPlayerManager::notify_playback_finished() {

/// Reset Source
if (source) {
source->resetCurrent();
source=NULL;
}
source->resetCurrent();
source=NULL;
}

//reset_track_display();
return;
}
if(preferences.play_repeat!=REPEAT_TRACK) {
track = getTrackView()->getNext();
if (track!=-1) getTrackView()->setCurrent(track);
}
return;
}

if (source) {
source->resetCurrent();
Expand Down
4 changes: 4 additions & 0 deletions src/GMTrackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,10 @@ void GMTrackView::setActive(FXint item,FXbool showactive/*=true*/) {
if (showactive) tracklist->setActiveItem(item);
}

void GMTrackView::setCurrent(FXint item) {
tracklist->setCurrentItem(item);
}

void GMTrackView::showCurrent() {
source->findCurrent(tracklist,GMPlayerManager::instance()->getSource());
}
Expand Down
2 changes: 2 additions & 0 deletions src/GMTrackView.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ FXDECLARE(GMTrackView)

void setActive(FXint item,FXbool show=true);

void setCurrent(FXint item);

void showCurrent();

void setSortMethod(FXint hdr,FXbool reverse=false);
Expand Down
56 changes: 40 additions & 16 deletions src/GMWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,10 +1057,16 @@ long GMWindow::onCmdRepeatOff(FXObject*,FXSelector,void*){
}

long GMWindow::onUpdRepeatOff(FXObject*sender,FXSelector,void*){
if (GMPlayerManager::instance()->getPreferences().play_repeat==REPEAT_OFF)
sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
else
sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
if (GMPlayerManager::instance()->getPlayQueue()==nullptr) {
sender->handle(this,FXSEL(SEL_COMMAND,ID_ENABLE),NULL);
if (GMPlayerManager::instance()->getPreferences().play_repeat==REPEAT_OFF)
sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
else
sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
}
else {
sender->handle(this,FXSEL(SEL_COMMAND,ID_DISABLE),NULL);
}
return 1;
}

Expand All @@ -1070,10 +1076,16 @@ long GMWindow::onCmdRepeat(FXObject*,FXSelector,void*){
}

long GMWindow::onUpdRepeat(FXObject*sender,FXSelector,void*){
if (GMPlayerManager::instance()->getPreferences().play_repeat==REPEAT_TRACK)
sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
else
sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
if (GMPlayerManager::instance()->getPlayQueue()==nullptr) {
sender->handle(this,FXSEL(SEL_COMMAND,ID_ENABLE),NULL);
if (GMPlayerManager::instance()->getPreferences().play_repeat==REPEAT_TRACK)
sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
else
sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
}
else {
sender->handle(this,FXSEL(SEL_COMMAND,ID_DISABLE),NULL);
}
return 1;
}

Expand All @@ -1084,10 +1096,16 @@ long GMWindow::onCmdRepeatAll(FXObject*,FXSelector,void*){
}

long GMWindow::onUpdRepeatAll(FXObject*sender,FXSelector,void*){
if (GMPlayerManager::instance()->getPreferences().play_repeat==REPEAT_ALL)
sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
else
sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
if (GMPlayerManager::instance()->getPlayQueue()==nullptr) {
sender->handle(this,FXSEL(SEL_COMMAND,ID_ENABLE),NULL);
if (GMPlayerManager::instance()->getPreferences().play_repeat==REPEAT_ALL)
sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
else
sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
}
else {
sender->handle(this,FXSEL(SEL_COMMAND,ID_DISABLE),NULL);
}
return 1;
}

Expand All @@ -1098,10 +1116,16 @@ long GMWindow::onCmdShuffle(FXObject*,FXSelector,void*ptr){
}

long GMWindow::onUpdShuffle(FXObject*sender,FXSelector,void*){
if (GMPlayerManager::instance()->getPreferences().play_shuffle)
sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
else
sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
if (GMPlayerManager::instance()->getPlayQueue()==nullptr) {
sender->handle(this,FXSEL(SEL_COMMAND,ID_ENABLE),NULL);
if (GMPlayerManager::instance()->getPreferences().play_shuffle)
sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
else
sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
}
else {
sender->handle(this,FXSEL(SEL_COMMAND,ID_DISABLE),NULL);
}
return 1;
}

Expand Down

0 comments on commit fd5aa94

Please sign in to comment.