DlgPrefAutoDJ::DlgPrefAutoDJ(QWidget* pParent, UserSettingsPointer pConfig) : DlgPreferencePage(pParent), m_pConfig(pConfig) { setupUi(this); // Re-queue tracks in Auto DJ ComboBoxAutoDjRequeue->addItem(tr("Off")); ComboBoxAutoDjRequeue->addItem(tr("On")); ComboBoxAutoDjRequeue->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt()); connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); // The minimum available for randomly-selected tracks autoDjMinimumAvailableSpinBox->setValue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "MinimumAvailable"), "20").toInt()); connect(autoDjMinimumAvailableSpinBox, SIGNAL(valueChanged(int)), this, SLOT(slotSetAutoDjMinimumAvailable(int))); // The auto-DJ replay-age for randomly-selected tracks autoDjIgnoreTimeCheckBox->setChecked( (bool) m_pConfig->getValueString( ConfigKey("[Auto DJ]", "UseIgnoreTime"), "0").toInt()); connect(autoDjIgnoreTimeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(slotSetAutoDjUseIgnoreTime(int))); autoDjIgnoreTimeEdit->setTime( QTime::fromString( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "IgnoreTime"), "23:59"), autoDjIgnoreTimeEdit->displayFormat())); autoDjIgnoreTimeEdit->setEnabled( autoDjIgnoreTimeCheckBox->checkState() == Qt::Checked); connect(autoDjIgnoreTimeEdit, SIGNAL(timeChanged(const QTime &)), this, SLOT(slotSetAutoDjIgnoreTime(const QTime &))); // Auto DJ random enqueue ComboBoxAutoDjRandomQueue->addItem(tr("Off")); ComboBoxAutoDjRandomQueue->addItem(tr("On")); ComboBoxAutoDjRandomQueue->setCurrentIndex( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "EnableRandomQueue"),"0").toInt()); // 5-arbitrary autoDJRandomQueueMinimumSpinBox->setValue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowed"),"5").toInt()); slotEnableAutoDJRandomQueueComboBox( m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt()); slotEnableAutoDJRandomQueue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "EnableRandomQueue")).toInt()); // Be ready to enable disable the random enque as reque is modified connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotEnableAutoDJRandomQueueComboBox(int))); // Be ready to enable and modify the minimum number and enable disable the spinbox connect(ComboBoxAutoDjRandomQueue, SIGNAL(activated(int)), this, SLOT(slotEnableAutoDJRandomQueue(int))); connect(autoDJRandomQueueMinimumSpinBox, SIGNAL(valueChanged(int)), this, SLOT(slotSetAutoDJRandomQueueMin(int))); }
void DlgPrefAutoDJ::slotCancel() { // Load actual values and reset Buffer Values where ever needed ComboBoxAutoDjRequeue->setCurrentIndex( m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue"),"0").toInt()); m_pConfig->set(ConfigKey("[Auto DJ]", "RequeueBuff"), m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue"),"0")); #ifdef __AUTODJCRATES__ autoDjMinimumAvailableSpinBox->setValue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "MinimumAvailable"), "20").toInt()); autoDjIgnoreTimeEdit->setTime( QTime::fromString( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "IgnoreTime"), "23:59"), autoDjIgnoreTimeEdit->displayFormat())); autoDjIgnoreTimeCheckBox->setChecked( (bool) m_pConfig->getValueString( ConfigKey("[Auto DJ]", "UseIgnoreTime"), "0").toInt()); autoDjIgnoreTimeEdit->setEnabled( autoDjIgnoreTimeCheckBox->checkState() == Qt::Checked); m_pConfig->set(ConfigKey("[Auto DJ]", "UseIgnoreTimeBuff"), m_pConfig->getValueString( ConfigKey("[Auto DJ]", "UseIgnoreTime"), "0")); autoDJRandomQueueMinimumSpinBox->setValue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowed"),"5").toInt()); ComboBoxAutoDjRandomQueue->setCurrentIndex( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "EnableRandomQueue"),"0").toInt()); m_pConfig->set(ConfigKey("[Auto DJ]", "EnableRandomQueueBuff"), m_pConfig->getValueString( ConfigKey("[Auto DJ]", "EnableRandomQueue"), "0")); slotEnableAutoDJRandomQueue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "EnableRandomQueue")).toInt()); slotEnableAutoDJRandomQueueComboBox( m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt()); #endif //__AUTODJCRATES__ }
DlgPrefAutoDJ::DlgPrefAutoDJ(QWidget* pParent, ConfigObject<ConfigValue>* pConfig) : DlgPreferencePage(pParent), m_pConfig(pConfig) { setupUi(this); // Re-queue tracks in Auto DJ ComboBoxAutoDjRequeue->addItem(tr("Off")); ComboBoxAutoDjRequeue->addItem(tr("On")); ComboBoxAutoDjRequeue->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt()); connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); #ifdef __AUTODJCRATES__ // The minimum available for randomly-selected tracks autoDjMinimumAvailableSpinBox->setValue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "MinimumAvailable"), "20").toInt()); connect(autoDjMinimumAvailableSpinBox, SIGNAL(valueChanged(int)), this, SLOT(slotSetAutoDjMinimumAvailable(int))); // The auto-DJ replay-age for randomly-selected tracks autoDjIgnoreTimeCheckBox->setChecked( (bool) m_pConfig->getValueString( ConfigKey("[Auto DJ]", "UseIgnoreTime"), "0").toInt()); connect(autoDjIgnoreTimeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(slotSetAutoDjUseIgnoreTime(int))); autoDjIgnoreTimeEdit->setTime( QTime::fromString( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "IgnoreTime"), "23:59"), autoDjIgnoreTimeEdit->displayFormat())); autoDjIgnoreTimeEdit->setEnabled( autoDjIgnoreTimeCheckBox->checkState() == Qt::Checked); connect(autoDjIgnoreTimeEdit, SIGNAL(timeChanged(const QTime &)), this, SLOT(slotSetAutoDjIgnoreTime(const QTime &))); // Auto DJ random enqueue ComboBoxAutoDjRandomQueue->addItem(tr("Off")); ComboBoxAutoDjRandomQueue->addItem(tr("On")); ComboBoxAutoDjRandomQueue->setCurrentIndex( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "EnableRandomQueue"),"0").toInt()); // 5-arbitrary autoDJRandomQueueMinimumSpinBox->setValue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowed"),"5").toInt()); slotEnableAutoDJRandomQueueComboBox( m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt()); slotEnableAutoDJRandomQueue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "EnableRandomQueue")).toInt()); // Be ready to enable disable the random enque as reque is modified connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotEnableAutoDJRandomQueueComboBox(int))); // Be ready to enable and modify the minimum number and enable disable the spinbox connect(ComboBoxAutoDjRandomQueue, SIGNAL(activated(int)), this, SLOT(slotEnableAutoDJRandomQueue(int))); connect(autoDJRandomQueueMinimumSpinBox, SIGNAL(valueChanged(int)), this, SLOT(slotSetAutoDJRandomQueueMin(int))); #else // __AUTODJCRATES__ // Remove the preferences. autoDjMinimumAvailableLabel->setVisible(false); GridLayout1->removeWidget(autoDjMinimumAvailableLabel); autoDjMinimumAvailableSpinBox->setVisible(false); GridLayout1->removeWidget(autoDjMinimumAvailableSpinBox); autoDjIgnoreTimeCheckBox->setVisible(false); GridLayout1->removeWidget(autoDjIgnoreTimeCheckBox); autoDjIgnoreTimeEdit->setVisible(false); GridLayout1->removeWidget(autoDjIgnoreTimeEdit); #endif // __AUTODJCRATES__ // Connect the global cancell signal connect(this,SIGNAL(cancelPreferences()),this, SLOT(slotCancel())); }