Skip to content

Commit

Permalink
AutoDJ: handle "enabled" CO change requests like clicks on the GUI bu…
Browse files Browse the repository at this point in the history
…tton

otherwise, if AutoDJ refuses to start because of unmet conditions, no error messages are shown
and the CO remains in 'enabled' state.
  • Loading branch information
ronso0 committed Apr 18, 2023
1 parent f50e142 commit 7827453
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ AutoDJProcessor::AutoDJProcessor(
m_pEnabledAutoDJ = new ControlPushButton(
ConfigKey("[AutoDJ]", "enabled"));
m_pEnabledAutoDJ->setButtonMode(ControlPushButton::TOGGLE);
connect(m_pEnabledAutoDJ, &ControlObject::valueChanged,
this, &AutoDJProcessor::controlEnable);
m_pEnabledAutoDJ->connectValueChangeRequest(this,
&AutoDJProcessor::autoDJStateChangeRequest);

// TODO(rryan) listen to signals from PlayerManager and add/remove as decks
// are created.
Expand Down
1 change: 1 addition & 0 deletions src/library/autodj/autodjprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class AutoDJProcessor : public QObject {
signals:
void loadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play);
void autoDJStateChanged(AutoDJProcessor::AutoDJState state);
void autoDJStateChangeRequest(bool enable);
void transitionTimeChanged(int time);
void randomTrackRequested(int tracksToAdd);

Expand Down
6 changes: 6 additions & 0 deletions src/library/autodj/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ DlgAutoDJ::DlgAutoDJ(
&QPushButton::clicked,
this,
&DlgAutoDJ::toggleAutoDJButton);
// Connect the 'enabled' ControlPushButton to the same slot so we can show
// potential error messages here
connect(m_pAutoDJProcessor,
&AutoDJProcessor::autoDJStateChangeRequest,
this,
&DlgAutoDJ::toggleAutoDJButton);

setupActionButton(pushButtonFadeNow, &DlgAutoDJ::fadeNowButton, tr("Fade"));
setupActionButton(pushButtonSkipNext, &DlgAutoDJ::skipNextButton, tr("Skip"));
Expand Down

0 comments on commit 7827453

Please sign in to comment.