Skip to content

Commit

Permalink
Merge pull request #3076 from PawBud/AutoDJ
Browse files Browse the repository at this point in the history
AutoDJ: Add Random Track Control to AutoDJ.
  • Loading branch information
daschuer authored Nov 3, 2020
2 parents 7e0cdbb + f7aa473 commit 21be90f
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 13 deletions.
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 @@ -639,7 +639,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 @@ -1897,7 +1897,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 @@ -2355,7 +2355,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 @@ -875,7 +875,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 @@ -2688,7 +2688,7 @@ Library features and their buttons:
QPushButton#
DlgAutoDJ
QPushButton#pushButtonShuffle
QPushButton#pushButtonAddRandom
QPushButton#pushButtonAddRandomTrack
QPushButton#pushButtonSkipNext
QPushButton#pushButtonFadeNow
QSpinBox#spinBoxTransition
Expand Down Expand Up @@ -2825,7 +2825,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 @@ -989,6 +989,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 @@ -145,7 +145,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 @@ -135,6 +135,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 @@ -185,6 +192,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 @@ -580,6 +588,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 @@ -91,7 +91,7 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent,
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 @@ -113,7 +113,7 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent,
"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 @@ -150,7 +150,7 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent,
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 @@ -320,7 +320,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

0 comments on commit 21be90f

Please sign in to comment.