Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoDJ: Add Random Track Control to AutoDJ. #3076

Merged
merged 4 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###
Expand Down
2 changes: 1 addition & 1 deletion res/skins/Deere/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion res/skins/LateNight/style_classic.qss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion res/skins/LateNight/style_palemoon.qss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion res/skins/Shade/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions res/skins/Tango/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2689,7 +2689,7 @@ Library features and their buttons:
QPushButton#
DlgAutoDJ
QPushButton#pushButtonShuffle
QPushButton#pushButtonAddRandom
QPushButton#pushButtonAddRandomTrack
QPushButton#pushButtonSkipNext
QPushButton#pushButtonFadeNow
QSpinBox#spinBoxTransition
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions src/controllers/controlpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +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]", "fade_now",
tr("Auto DJ Fade To Next"),
tr("Trigger the transition to the next track"), autodjMenu);
Expand Down
2 changes: 1 addition & 1 deletion src/library/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void AutoDJFeature::bindLibraryWidget(
this,
&AutoDJFeature::slotRandomQueue);
connect(m_pAutoDJView,
&DlgAutoDJ::addRandomButton,
&DlgAutoDJ::addRandomTrackButton,
this,
&AutoDJFeature::slotAddRandomTrack);
}
Expand Down
14 changes: 14 additions & 0 deletions src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ 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,
Expand Down Expand Up @@ -183,6 +190,7 @@ AutoDJProcessor::~AutoDJProcessor() {
delete m_pCOCrossfaderReverse;

delete m_pSkipNext;
delete m_pAddRandomTrack;
delete m_pShufflePlaylist;
delete m_pEnabledAutoDJ;
delete m_pFadeNow;
Expand Down Expand Up @@ -578,6 +586,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
Expand Down
2 changes: 2 additions & 0 deletions src/library/autodj/autodjprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions src/library/autodj/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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(
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -319,7 +319,6 @@ void DlgAutoDJ::autoDJStateChanged(AutoDJProcessor::AutoDJState state) {
pushButtonFadeNow->setEnabled(true);
}

// You can always skip the next track if we are enabled.
pushButtonSkipNext->setEnabled(true);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/library/autodj/dlgautodj.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/library/autodj/dlgautodj.ui
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonAddRandom">
<widget class="QPushButton" name="pushButtonAddRandomTrack">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
Expand Down