Skip to content

Commit

Permalink
AutoDJ: show error message when deck orientaton requirements are unmet
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Apr 19, 2023
1 parent ce55ce3 commit c2e715c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ void AutoDJProcessor::fadeNow() {
if (!pLeftDeck || !pRightDeck) {
// User has changed the orientation, disable Auto DJ
toggleAutoDJ(false);
emit autoDJError(ADJ_NOT_TWO_DECKS);
return;
}

Expand Down Expand Up @@ -258,6 +259,7 @@ void AutoDJProcessor::fadeNow() {
// Deck is empty or track too short, disable AutoDJ
// This happens only if the user has changed deck orientation to such deck.
toggleAutoDJ(false);
emit autoDJError(ADJ_NOT_TWO_DECKS);
return;
}

Expand Down Expand Up @@ -624,7 +626,11 @@ void AutoDJProcessor::crossfaderChanged(double value) {
}
pToDeck->play();
} else {
// TODO Is this also only possible if the user changed the
// deck orientation?
toggleAutoDJ(false);
// If yes
// emit autoDJError(ADJ_NOT_TWO_DECKS);
return;
}
}
Expand Down Expand Up @@ -1517,6 +1523,7 @@ void AutoDJProcessor::playerTrackLoaded(DeckAttributes* pDeck, TrackPointer pTra
}
// User has changed the orientation, disable Auto DJ
toggleAutoDJ(false);
emit autoDJError(ADJ_NOT_TWO_DECKS);
return;
}
pDeck->startPos = kKeepPosition;
Expand Down Expand Up @@ -1625,6 +1632,7 @@ void AutoDJProcessor::setTransitionTime(int time) {
if (!pLeftDeck || !pRightDeck) {
// User has changed the orientation, disable Auto DJ
toggleAutoDJ(false);
emit autoDJError(ADJ_NOT_TWO_DECKS);
return;
}
if (pLeftDeck->isPlaying()) {
Expand Down Expand Up @@ -1653,6 +1661,7 @@ void AutoDJProcessor::setTransitionMode(TransitionMode newMode) {
if (!pLeftDeck || !pRightDeck) {
// User has changed the orientation, disable Auto DJ
toggleAutoDJ(false);
emit autoDJError(ADJ_NOT_TWO_DECKS);
return;
}

Expand Down
2 changes: 2 additions & 0 deletions src/library/autodj/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ void DlgAutoDJ::toggleAutoDJButton(bool enable) {
m_pAutoDJProcessor->toggleAutoDJ(enable);
}

// TODO If there's a way to migrate the translations move this
// to AutoDJProcessor in order to keep this class minimal
void DlgAutoDJ::autoDJError(AutoDJProcessor::AutoDJError error) {
switch (error) {
case AutoDJProcessor::ADJ_NOT_TWO_DECKS:
Expand Down

0 comments on commit c2e715c

Please sign in to comment.