-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
add AutoDJ xfader recenter option (default off) #13303
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,181 +8,104 @@ DlgPrefAutoDJ::DlgPrefAutoDJ(QWidget* pParent, | |
m_pConfig(pConfig) { | ||
setupUi(this); | ||
|
||
// The auto-DJ replay-age for randomly-selected tracks | ||
connect(RequeueIgnoreCheckBox, | ||
&QCheckBox::stateChanged, | ||
this, | ||
&DlgPrefAutoDJ::slotToggleRequeueIgnore); | ||
|
||
// Auto DJ random enqueue | ||
connect(RandomQueueCheckBox, | ||
&QCheckBox::stateChanged, | ||
this, | ||
&DlgPrefAutoDJ::slotToggleRandomQueue); | ||
|
||
setScrollSafeGuardForAllInputWidgets(this); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotUpdate() { | ||
// The minimum available for randomly-selected tracks | ||
MinimumAvailableSpinBox->setValue( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "MinimumAvailable"), 20)); | ||
connect(MinimumAvailableSpinBox, | ||
QOverload<int>::of(&QSpinBox::valueChanged), | ||
this, | ||
&DlgPrefAutoDJ::slotSetMinimumAvailable); | ||
|
||
// The auto-DJ replay-age for randomly-selected tracks | ||
RequeueIgnoreCheckBox->setChecked(m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "UseIgnoreTime"), false)); | ||
connect(RequeueIgnoreCheckBox, | ||
&QCheckBox::stateChanged, | ||
this, | ||
&DlgPrefAutoDJ::slotToggleRequeueIgnore); | ||
RequeueIgnoreTimeEdit->setTime( | ||
QTime::fromString( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "IgnoreTime"), "23:59"), | ||
RequeueIgnoreTimeEdit->displayFormat())); | ||
RequeueIgnoreTimeEdit->setEnabled( | ||
RequeueIgnoreCheckBox->checkState() == Qt::Checked); | ||
connect(RequeueIgnoreTimeEdit, | ||
&QTimeEdit::timeChanged, | ||
this, | ||
&DlgPrefAutoDJ::slotSetRequeueIgnoreTime); | ||
|
||
// Auto DJ random enqueue | ||
RandomQueueCheckBox->setChecked(m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "EnableRandomQueue"), false)); | ||
// 5-arbitrary | ||
|
||
RandomQueueMinimumSpinBox->setValue( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowed"), 5)); | ||
// "[Auto DJ], Requeue" is set by 'Repeat Playlist' toggle in DlgAutoDj GUI. | ||
// If it's checked un-check 'Random Queue' | ||
slotConsiderRepeatPlaylistState( | ||
// TODO Add 'Repeat' checkbox here, or add a hint why the checkbox may be disabled | ||
considerRepeatPlaylistState( | ||
m_pConfig->getValue<bool>(ConfigKey("[Auto DJ]", "Requeue"))); | ||
slotToggleRandomQueue( | ||
m_pConfig->getValue<bool>( | ||
ConfigKey("[Auto DJ]", "EnableRandomQueue")) | ||
? Qt::Checked | ||
: Qt::Unchecked); | ||
// Be ready to enable and modify the minimum number and un/check the checkbox | ||
connect(RandomQueueCheckBox, | ||
&QCheckBox::stateChanged, | ||
this, | ||
&DlgPrefAutoDJ::slotToggleRandomQueue); | ||
connect(RandomQueueMinimumSpinBox, | ||
QOverload<int>::of(&QSpinBox::valueChanged), | ||
this, | ||
&DlgPrefAutoDJ::slotSetRandomQueueMin); | ||
|
||
setScrollSafeGuardForAllInputWidgets(this); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotUpdate() { | ||
// Re-center the crossfader instantly when AutoDJ is disabled | ||
CenterXfaderCheckBox->setChecked(m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "center_xfader_when_disabling"), false)); | ||
Comment on lines
+62
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be nice if these defaults were There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Jep, moving all repeatedly used pref ConfigKeys (preferences, and respective engine units) to other files. |
||
} | ||
|
||
void DlgPrefAutoDJ::slotApply() { | ||
//Copy from Buffer to actual values | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]","MinimumAvailable"), | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "MinimumAvailableBuff"), 20)); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "MinimumAvailable"), | ||
MinimumAvailableSpinBox->value()); | ||
|
||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "IgnoreTime"), | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "IgnoreTimeBuff"), "23:59")); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "UseIgnoreTime"), | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "UseIgnoreTimeBuff"), false)); | ||
RequeueIgnoreCheckBox->isChecked()); | ||
const QString ignTimeStr = | ||
RequeueIgnoreTimeEdit->time().toString(); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "IgnoreTime"), ignTimeStr); | ||
|
||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowed"), | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowedBuff"), 5)); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "EnableRandomQueue"), | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "EnableRandomQueueBuff"), false)); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotCancel() { | ||
// Load actual values and reset Buffer Values where ever needed | ||
MinimumAvailableSpinBox->setValue( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "MinimumAvailable"), 20)); | ||
RandomQueueCheckBox->isChecked()); | ||
m_pConfig->setValue( | ||
ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowed"), | ||
RandomQueueMinimumSpinBox->value()); | ||
|
||
RequeueIgnoreTimeEdit->setTime( | ||
QTime::fromString( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "IgnoreTime"), "23:59"), | ||
RequeueIgnoreTimeEdit->displayFormat())); | ||
RequeueIgnoreCheckBox->setChecked( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "UseIgnoreTime"), false)); | ||
RequeueIgnoreTimeEdit->setEnabled( | ||
RequeueIgnoreCheckBox->checkState() == Qt::Checked); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "UseIgnoreTimeBuff"), | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "UseIgnoreTime"), false)); | ||
|
||
RandomQueueMinimumSpinBox->setValue( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowed"), 5)); | ||
RandomQueueCheckBox->setChecked( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "EnableRandomQueue"), false)); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "EnableRandomQueueBuff"), | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "EnableRandomQueue"), false)); | ||
slotToggleRandomQueue( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "EnableRandomQueue"), false) | ||
? Qt::Checked | ||
: Qt::Unchecked); | ||
slotToggleRandomQueue( | ||
m_pConfig->getValue<bool>(ConfigKey("[Auto DJ]", "Requeue"))); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "center_xfader_when_disabling"), | ||
CenterXfaderCheckBox->isChecked()); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotResetToDefaults() { | ||
// Re-queue tracks in AutoDJ | ||
MinimumAvailableSpinBox->setValue(20); | ||
|
||
RequeueIgnoreTimeEdit->setTime(QTime::fromString( | ||
"23:59", RequeueIgnoreTimeEdit->displayFormat())); | ||
RequeueIgnoreCheckBox->setChecked(false); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "UseIgnoreTimeBuff"), false); | ||
RequeueIgnoreTimeEdit->setEnabled(false); | ||
RequeueIgnoreTimeEdit->setTime(QTime::fromString("23:59")); | ||
|
||
RandomQueueMinimumSpinBox->setValue(5); | ||
RandomQueueCheckBox->setChecked(false); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "EnableRandomQueueBuff"), false); | ||
RandomQueueMinimumSpinBox->setEnabled(false); | ||
RandomQueueCheckBox->setEnabled(true); | ||
} | ||
RandomQueueMinimumSpinBox->setEnabled(false); | ||
RandomQueueMinimumSpinBox->setValue(5); | ||
|
||
void DlgPrefAutoDJ::slotSetMinimumAvailable(int a_iValue) { | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "MinimumAvailableBuff"), a_iValue); | ||
CenterXfaderCheckBox->setChecked(false); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotToggleRequeueIgnore(int buttonState) { | ||
bool checked = buttonState == Qt::Checked; | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "UseIgnoreTimeBuff"), checked); | ||
RequeueIgnoreTimeEdit->setEnabled(checked); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotSetRequeueIgnoreTime(const QTime& a_rTime) { | ||
QString str = a_rTime.toString(RequeueIgnoreTimeEdit->displayFormat()); | ||
m_pConfig->set(ConfigKey("[Auto DJ]", "IgnoreTimeBuff"), str); | ||
RequeueIgnoreTimeEdit->setEnabled(buttonState == Qt::Checked); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotSetRandomQueueMin(int a_iValue) { | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowedBuff"), a_iValue); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotConsiderRepeatPlaylistState(bool enable) { | ||
if (enable) { | ||
// Requeue is enabled | ||
RandomQueueCheckBox->setChecked(false); | ||
// ToDo(ronso0): Redundant? If programmatic checkbox change is signaled | ||
// to slotToggleRandomQueue | ||
RandomQueueMinimumSpinBox->setEnabled(false); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "EnableRandomQueueBuff"), | ||
false); | ||
} else { | ||
RandomQueueMinimumSpinBox->setEnabled( | ||
m_pConfig->getValue( | ||
ConfigKey("[Auto DJ]", "EnableRandomQueueBuff"), false)); | ||
} | ||
void DlgPrefAutoDJ::considerRepeatPlaylistState(bool enable) { | ||
RandomQueueMinimumSpinBox->setEnabled(enable); | ||
} | ||
|
||
void DlgPrefAutoDJ::slotToggleRandomQueue(int buttonState) { | ||
bool enable = buttonState == Qt::Checked; | ||
// Toggle the option to select minimum tracks | ||
RandomQueueMinimumSpinBox->setEnabled(enable); | ||
m_pConfig->setValue(ConfigKey("[Auto DJ]", "EnableRandomQueueBuff"), | ||
enable); | ||
RandomQueueMinimumSpinBox->setEnabled(buttonState == Qt::Checked); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make more sense to set use
crossfader_set_default
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, butfor that we'd need another control, either via ControlObject::get() or another member.
I'd prefer to stick to the crossfader CO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair. I just thought the
_set_default
was more expressive.