From 3dccf145b1a8aa0435fefa2ac1c61ceb5dc121c6 Mon Sep 17 00:00:00 2001 From: Sanskar Bajpai Date: Fri, 4 Sep 2020 21:38:10 +0530 Subject: [PATCH 1/4] AutoDJ: Add Random Track Control to AutoDJ. This commit introduces the Random Track Control to AutoDJ. It replaces add_random with add_random_track in the whole codebase, and changing the function names and QT class members to maintain consisistency. --- res/skins/Deere/style.qss | 2 +- res/skins/LateNight/style_classic.qss | 2 +- res/skins/LateNight/style_palemoon.qss | 2 +- res/skins/Shade/style.qss | 2 +- res/skins/Tango/style.qss | 4 ++-- src/controllers/controlpickermenu.cpp | 3 +++ src/library/autodj/autodjfeature.cpp | 2 +- src/library/autodj/autodjprocessor.cpp | 12 ++++++++++++ src/library/autodj/autodjprocessor.h | 2 ++ src/library/autodj/dlgautodj.cpp | 8 ++++---- src/library/autodj/dlgautodj.h | 2 +- src/library/autodj/dlgautodj.ui | 2 +- 12 files changed, 30 insertions(+), 13 deletions(-) diff --git a/res/skins/Deere/style.qss b/res/skins/Deere/style.qss index ee4d0f9cb74..88102dc6cd4 100644 --- a/res/skins/Deere/style.qss +++ b/res/skins/Deere/style.qss @@ -640,7 +640,7 @@ QPushButton#pushButtonSkipNext:!enabled { QPushButton#pushButtonShuffle { image: url(skin:/icon/ic_autodj_shuffle.svg) no-repeat center center; } -QPushButton#pushButtonAddRandom { +QPushButton#pushButtonAddRandomTrack { image: url(skin:/icon/ic_autodj_addrandom.svg) no-repeat center center; } QPushButton#pushButtonRepeatPlaylist { diff --git a/res/skins/LateNight/style_classic.qss b/res/skins/LateNight/style_classic.qss index eba976152bb..bb3bb96a706 100644 --- a/res/skins/LateNight/style_classic.qss +++ b/res/skins/LateNight/style_classic.qss @@ -1867,7 +1867,7 @@ QPushButton#pushButtonShuffle:enabled { image: url(skin:/classic/buttons/btn__autodj_shuffle.svg) no-repeat center center; } -QPushButton#pushButtonAddRandom:enabled { +QPushButton#pushButtonAddRandomTrack:enabled { image: url(skin:/classic/buttons/btn__autodj_addrandom.svg) no-repeat center center; } diff --git a/res/skins/LateNight/style_palemoon.qss b/res/skins/LateNight/style_palemoon.qss index dc2daefe10a..e0797f6cf4d 100644 --- a/res/skins/LateNight/style_palemoon.qss +++ b/res/skins/LateNight/style_palemoon.qss @@ -2302,7 +2302,7 @@ QPushButton#pushButtonShuffle:enabled { image: url(skin:/palemoon/buttons/btn__autodj_shuffle.svg) no-repeat center center; } -QPushButton#pushButtonAddRandom:enabled { +QPushButton#pushButtonAddRandomTrack:enabled { image: url(skin:/palemoon/buttons/btn__autodj_addrandom.svg) no-repeat center center; } diff --git a/res/skins/Shade/style.qss b/res/skins/Shade/style.qss index a483ea390fd..b4550c20016 100644 --- a/res/skins/Shade/style.qss +++ b/res/skins/Shade/style.qss @@ -872,7 +872,7 @@ QPushButton#pushButtonSkipNext:!enabled { QPushButton#pushButtonShuffle { image: url(skin:/btn/btn_autodj_shuffle.svg) no-repeat center center; } -QPushButton#pushButtonAddRandom { +QPushButton#pushButtonAddRandomTrack { image: url(skin:/btn/btn_autodj_addrandom.svg) no-repeat center center; } QPushButton#pushButtonRepeatPlaylist { diff --git a/res/skins/Tango/style.qss b/res/skins/Tango/style.qss index 33951939759..8177e2da496 100644 --- a/res/skins/Tango/style.qss +++ b/res/skins/Tango/style.qss @@ -2689,7 +2689,7 @@ Library features and their buttons: QPushButton# DlgAutoDJ QPushButton#pushButtonShuffle - QPushButton#pushButtonAddRandom + QPushButton#pushButtonAddRandomTrack QPushButton#pushButtonSkipNext QPushButton#pushButtonFadeNow QSpinBox#spinBoxTransition @@ -2826,7 +2826,7 @@ QPushButton#pushButtonSkipNext:!enabled { QPushButton#pushButtonShuffle { image: url(skin:/buttons/btn_autodj_shuffle.svg) no-repeat center center; } -QPushButton#pushButtonAddRandom { +QPushButton#pushButtonAddRandomTrack { image: url(skin:/buttons/btn_autodj_addrandom.svg) no-repeat center center; } QPushButton#pushButtonRepeatPlaylist:!checked { diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp index 6ddfd3e6ef2..dcdff8f4f26 100644 --- a/src/controllers/controlpickermenu.cpp +++ b/src/controllers/controlpickermenu.cpp @@ -737,6 +737,9 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent) addControl("[AutoDJ]", "skip_next", tr("Auto DJ Skip Next"), tr("Skip the next track in the Auto DJ queue"), autodjMenu); + addControl("[AutoDJ]", "add_random_track", + tr("Auto DJ Add Random Track"), + tr("Add random track to the Auto DJ queue"), autodjMenu); addControl("[AutoDJ]", "fade_now", tr("Auto DJ Fade To Next"), tr("Trigger the transition to the next track"), autodjMenu); diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index 659338d0913..0f2f4eb19b5 100644 --- a/src/library/autodj/autodjfeature.cpp +++ b/src/library/autodj/autodjfeature.cpp @@ -144,7 +144,7 @@ void AutoDJFeature::bindLibraryWidget( this, &AutoDJFeature::slotRandomQueue); connect(m_pAutoDJView, - &DlgAutoDJ::addRandomButton, + &DlgAutoDJ::addRandomTrackButton, this, &AutoDJFeature::slotAddRandomTrack); } diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index 252171bed4b..d29c86725d9 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -133,6 +133,11 @@ AutoDJProcessor::AutoDJProcessor( connect(m_pSkipNext, &ControlObject::valueChanged, this, &AutoDJProcessor::controlSkipNext); + m_pAddRandomTrack = new ControlPushButton( + ConfigKey("[AutoDJ]", "add_random_track")); + connect(m_pAddRandomTrack, &ControlObject::valueChanged, + this, &AutoDJProcessor::controlAddRandomTrack); + m_pFadeNow = new ControlPushButton( ConfigKey("[AutoDJ]", "fade_now")); connect(m_pFadeNow, &ControlObject::valueChanged, @@ -183,6 +188,7 @@ AutoDJProcessor::~AutoDJProcessor() { delete m_pCOCrossfaderReverse; delete m_pSkipNext; + delete m_pAddRandomTrack; delete m_pShufflePlaylist; delete m_pEnabledAutoDJ; delete m_pFadeNow; @@ -578,6 +584,12 @@ void AutoDJProcessor::controlSkipNext(double value) { } } +void AutoDJProcessor::controlAddRandomTrack(double value) { + if (value > 0.0) { + emit randomTrackRequested(1); + } +} + void AutoDJProcessor::crossfaderChanged(double value) { if (m_eState == ADJ_IDLE) { // The user is changing the crossfader manually. If the user has diff --git a/src/library/autodj/autodjprocessor.h b/src/library/autodj/autodjprocessor.h index ff1f004b8f7..3a33a5fcf91 100644 --- a/src/library/autodj/autodjprocessor.h +++ b/src/library/autodj/autodjprocessor.h @@ -227,6 +227,7 @@ class AutoDJProcessor : public QObject { void controlFadeNow(double value); void controlShuffle(double value); void controlSkipNext(double value); + void controlAddRandomTrack(double value); protected: // The following virtual signal wrappers are used for testing @@ -293,6 +294,7 @@ class AutoDJProcessor : public QObject { ControlProxy* m_pCOCrossfaderReverse; ControlPushButton* m_pSkipNext; + ControlPushButton* m_pAddRandomTrack; ControlPushButton* m_pFadeNow; ControlPushButton* m_pShufflePlaylist; ControlPushButton* m_pEnabledAutoDJ; diff --git a/src/library/autodj/dlgautodj.cpp b/src/library/autodj/dlgautodj.cpp index b80465998b5..5df6d01338e 100644 --- a/src/library/autodj/dlgautodj.cpp +++ b/src/library/autodj/dlgautodj.cpp @@ -90,7 +90,7 @@ DlgAutoDJ::DlgAutoDJ( setupActionButton(pushButtonFadeNow, &DlgAutoDJ::fadeNowButton, tr("Fade")); setupActionButton(pushButtonSkipNext, &DlgAutoDJ::skipNextButton, tr("Skip")); setupActionButton(pushButtonShuffle, &DlgAutoDJ::shufflePlaylistButton, tr("Shuffle")); - setupActionButton(pushButtonAddRandom, &DlgAutoDJ::addRandomButton, tr("Random")); + setupActionButton(pushButtonAddRandomTrack, &DlgAutoDJ::addRandomTrackButton, tr("Random")); m_enableBtnTooltip = tr( "Enable Auto DJ\n" @@ -112,7 +112,7 @@ DlgAutoDJ::DlgAutoDJ( "Shuffle the content of the Auto DJ queue\n" "\n" "Shortcut: Shift+F9"); - QString addRandomBtnTooltip = tr( + QString addRandomTrackBtnTooltip = tr( "Adds a random track from track sources (crates) to the Auto DJ queue.\n" "If no track sources are configured, the track is added from the library instead."); QString repeatBtnTooltip = tr( @@ -149,7 +149,7 @@ DlgAutoDJ::DlgAutoDJ( pushButtonFadeNow->setToolTip(fadeBtnTooltip); pushButtonSkipNext->setToolTip(skipBtnTooltip); pushButtonShuffle->setToolTip(shuffleBtnTooltip); - pushButtonAddRandom->setToolTip(addRandomBtnTooltip); + pushButtonAddRandomTrack->setToolTip(addRandomTrackBtnTooltip); pushButtonRepeatPlaylist->setToolTip(repeatBtnTooltip); spinBoxTransition->setToolTip(spinBoxTransitionTooltip); labelTransitionAppendix->setToolTip(labelTransitionTooltip); @@ -320,7 +320,7 @@ void DlgAutoDJ::autoDJStateChanged(AutoDJProcessor::AutoDJState state) { } // You can always skip the next track if we are enabled. - pushButtonSkipNext->setEnabled(true); + pushButtonSkipNext->setEnabled(true); } } diff --git a/src/library/autodj/dlgautodj.h b/src/library/autodj/dlgautodj.h index a9b96daef6e..43a44ed9162 100644 --- a/src/library/autodj/dlgautodj.h +++ b/src/library/autodj/dlgautodj.h @@ -47,7 +47,7 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView { void slotRepeatPlaylistChanged(int checkedState); signals: - void addRandomButton(bool buttonChecked); + void addRandomTrackButton(bool buttonChecked); void loadTrack(TrackPointer tio); void loadTrackToPlayer(TrackPointer tio, QString group, bool); void trackSelected(TrackPointer pTrack); diff --git a/src/library/autodj/dlgautodj.ui b/src/library/autodj/dlgautodj.ui index ab549bd9e43..91ad621547a 100644 --- a/src/library/autodj/dlgautodj.ui +++ b/src/library/autodj/dlgautodj.ui @@ -176,7 +176,7 @@ - + Qt::NoFocus From 6a75a0c4958a3186bb1df8926f1a6a7f3a1841c5 Mon Sep 17 00:00:00 2001 From: Sanskar Bajpai Date: Mon, 7 Sep 2020 12:00:15 +0530 Subject: [PATCH 2/4] ControlPickerMenu: Removed grammatical error. --- src/controllers/controlpickermenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp index dcdff8f4f26..fbf5a76add7 100644 --- a/src/controllers/controlpickermenu.cpp +++ b/src/controllers/controlpickermenu.cpp @@ -739,7 +739,7 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent) tr("Skip the next track in the Auto DJ queue"), autodjMenu); addControl("[AutoDJ]", "add_random_track", tr("Auto DJ Add Random Track"), - tr("Add random track to the Auto DJ queue"), autodjMenu); + tr("Add a random track to the Auto DJ queue"), autodjMenu); addControl("[AutoDJ]", "fade_now", tr("Auto DJ Fade To Next"), tr("Trigger the transition to the next track"), autodjMenu); From 89ada92702564705178e31f83e6bacf678c5a458 Mon Sep 17 00:00:00 2001 From: Sanskar Bajpai Date: Wed, 9 Sep 2020 19:45:46 +0530 Subject: [PATCH 3/4] Changelog: Added the change in the controllers column. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d49690600bc..9f13660ad7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Cover art: Prevent wrong cover art display due to hash conflicts * Cover art: Add background color for quick cover art preview +* Add Random Track Control to AutoDJ [#3076](https://github.com/mixxxdj/mixxx/pull/3076) ## [2.3.0](https://launchpad.net/mixxx/+milestone/2.3.0) (Unreleased) ### Hotcues ### From f7aa473fa92d35e00926c5f11dcdf87372f43cd6 Mon Sep 17 00:00:00 2001 From: Sanskar Bajpai Date: Fri, 30 Oct 2020 19:43:41 +0530 Subject: [PATCH 4/4] Travis CI: Fixed the Pre-commit-pr hooks error --- src/controllers/controlpickermenu.cpp | 8 +++++--- src/library/autodj/autodjprocessor.cpp | 6 ++++-- src/library/autodj/dlgautodj.cpp | 3 +-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp index fbf5a76add7..1caf254a475 100644 --- a/src/controllers/controlpickermenu.cpp +++ b/src/controllers/controlpickermenu.cpp @@ -737,9 +737,11 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent) addControl("[AutoDJ]", "skip_next", tr("Auto DJ Skip Next"), tr("Skip the next track in the Auto DJ queue"), autodjMenu); - addControl("[AutoDJ]", "add_random_track", - tr("Auto DJ Add Random Track"), - tr("Add a random track to the Auto DJ queue"), autodjMenu); + addControl("[AutoDJ]", + "add_random_track", + tr("Auto DJ Add Random Track"), + tr("Add a random track to the Auto DJ queue"), + autodjMenu); addControl("[AutoDJ]", "fade_now", tr("Auto DJ Fade To Next"), tr("Trigger the transition to the next track"), autodjMenu); diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index d29c86725d9..13ae71fd11e 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -135,8 +135,10 @@ AutoDJProcessor::AutoDJProcessor( m_pAddRandomTrack = new ControlPushButton( ConfigKey("[AutoDJ]", "add_random_track")); - connect(m_pAddRandomTrack, &ControlObject::valueChanged, - this, &AutoDJProcessor::controlAddRandomTrack); + connect(m_pAddRandomTrack, + &ControlObject::valueChanged, + this, + &AutoDJProcessor::controlAddRandomTrack); m_pFadeNow = new ControlPushButton( ConfigKey("[AutoDJ]", "fade_now")); diff --git a/src/library/autodj/dlgautodj.cpp b/src/library/autodj/dlgautodj.cpp index 5df6d01338e..48e99ded5fa 100644 --- a/src/library/autodj/dlgautodj.cpp +++ b/src/library/autodj/dlgautodj.cpp @@ -319,8 +319,7 @@ void DlgAutoDJ::autoDJStateChanged(AutoDJProcessor::AutoDJState state) { pushButtonFadeNow->setEnabled(true); } - // You can always skip the next track if we are enabled. - pushButtonSkipNext->setEnabled(true); + pushButtonSkipNext->setEnabled(true); } }