From 12f4caa66165b9f455ab51680a87ccd29589434d Mon Sep 17 00:00:00 2001 From: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> Date: Mon, 12 Feb 2024 18:21:54 +0100 Subject: [PATCH 1/5] refactor(preferences): move enum constants into namespace mixxx::preferences::constants --- src/mixxxmainwindow.cpp | 18 +++++++------ src/mixxxmainwindow.h | 10 ++++---- src/preferences/constants.h | 24 +++++++++++------- src/preferences/dialog/dlgpreferences.h | 2 +- src/preferences/dialog/dlgprefinterface.cpp | 28 ++++++++++----------- src/preferences/dialog/dlgprefinterface.h | 6 ++--- src/util/screensavermanager.cpp | 16 ++++++------ src/util/screensavermanager.h | 6 ++--- 8 files changed, 59 insertions(+), 51 deletions(-) diff --git a/src/mixxxmainwindow.cpp b/src/mixxxmainwindow.cpp index a46ed35ed71..358179867f2 100644 --- a/src/mixxxmainwindow.cpp +++ b/src/mixxxmainwindow.cpp @@ -100,7 +100,7 @@ MixxxMainWindow::MixxxMainWindow(std::shared_ptr pCoreServi #endif m_pDeveloperToolsDlg(nullptr), m_pPrefDlg(nullptr), - m_toolTipsCfg(mixxx::TooltipsPreference::TOOLTIPS_ON) { + m_toolTipsCfg(mixxx::preferences::constants::Tooltips::On) { DEBUG_ASSERT(pCoreServices); // These depend on the settings #ifdef __LINUX__ @@ -176,9 +176,10 @@ void MixxxMainWindow::initialize() { // Set the visibility of tooltips, default "1" = ON m_toolTipsCfg = pConfig->getValue( ConfigKey("[Controls]", "Tooltips"), - mixxx::TooltipsPreference::TOOLTIPS_ON); + mixxx::preferences::constants::Tooltips::On); #ifdef MIXXX_USE_QOPENGL - ToolTipQOpenGL::singleton().setActive(m_toolTipsCfg == mixxx::TooltipsPreference::TOOLTIPS_ON); + ToolTipQOpenGL::singleton().setActive( + m_toolTipsCfg == mixxx::preferences::constants::Tooltips::On); #endif #ifdef __ENGINEPRIME__ @@ -1153,10 +1154,11 @@ void MixxxMainWindow::slotShowKeywheel(bool toggle) { } } -void MixxxMainWindow::slotTooltipModeChanged(mixxx::TooltipsPreference tt) { +void MixxxMainWindow::slotTooltipModeChanged(mixxx::preferences::constants::Tooltips tt) { m_toolTipsCfg = tt; #ifdef MIXXX_USE_QOPENGL - ToolTipQOpenGL::singleton().setActive(m_toolTipsCfg == mixxx::TooltipsPreference::TOOLTIPS_ON); + ToolTipQOpenGL::singleton().setActive( + m_toolTipsCfg == mixxx::preferences::constants::Tooltips::On); #endif } @@ -1259,14 +1261,14 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) { "DlgPreferences") { // return true for no tool tips switch (m_toolTipsCfg) { - case mixxx::TooltipsPreference::TOOLTIPS_ONLY_IN_LIBRARY: + case mixxx::preferences::constants::Tooltips::OnlyInLibrary: if (dynamic_cast(obj) != nullptr) { return true; } break; - case mixxx::TooltipsPreference::TOOLTIPS_ON: + case mixxx::preferences::constants::Tooltips::On: break; - case mixxx::TooltipsPreference::TOOLTIPS_OFF: + case mixxx::preferences::constants::Tooltips::Off: return true; default: DEBUG_ASSERT(!"m_toolTipsCfg value unknown"); diff --git a/src/mixxxmainwindow.h b/src/mixxxmainwindow.h index 7dea6a8f7dd..d4011cb0efa 100644 --- a/src/mixxxmainwindow.h +++ b/src/mixxxmainwindow.h @@ -50,8 +50,8 @@ class MixxxMainWindow : public QMainWindow { /// creates the menu_bar and inserts the file Menu void createMenuBar(); void connectMenuBar(); - void setInhibitScreensaver(mixxx::ScreenSaverPreference inhibit); - mixxx::ScreenSaverPreference getInhibitScreensaver(); + void setInhibitScreensaver(mixxx::preferences::constants::ScreenSaver inhibit); + mixxx::preferences::constants::ScreenSaver getInhibitScreensaver(); inline GuiTick* getGuiTick() { return m_pGuiTick; }; @@ -87,7 +87,7 @@ class MixxxMainWindow : public QMainWindow { void initializationProgressUpdate(int progress, const QString& serviceName); private slots: - void slotTooltipModeChanged(mixxx::TooltipsPreference tt); + void slotTooltipModeChanged(mixxx::preferences::constants::Tooltips tt); signals: void skinLoaded(); @@ -148,9 +148,9 @@ class MixxxMainWindow : public QMainWindow { std::unique_ptr m_pLibraryExporter; #endif - mixxx::TooltipsPreference m_toolTipsCfg; + mixxx::preferences::constants::Tooltips m_toolTipsCfg; - mixxx::ScreenSaverPreference m_inhibitScreensaver; + mixxx::preferences::constants::ScreenSaver m_inhibitScreensaver; QSet m_skinCreatedControls; }; diff --git a/src/preferences/constants.h b/src/preferences/constants.h index 57f96a3b247..516161654dc 100644 --- a/src/preferences/constants.h +++ b/src/preferences/constants.h @@ -2,19 +2,25 @@ namespace mixxx { +namespace preferences { + +namespace constants { + // Don't change these constants since they are stored in user configuration // files. -enum class TooltipsPreference { - TOOLTIPS_OFF = 0, - TOOLTIPS_ON = 1, - TOOLTIPS_ONLY_IN_LIBRARY = 2, +enum class Tooltips { + Off = 0, + On = 1, + OnlyInLibrary = 2, }; // Settings to enable or disable the prevention to run the screensaver. -enum class ScreenSaverPreference { - PREVENT_OFF = 0, - PREVENT_ON = 1, - PREVENT_ON_PLAY = 2 +enum class ScreenSaver { + Off = 0, + On = 1, + OnPlay = 2 }; -} // namespace mixxx +} // namespace constants +} // namespace preferences +} // namespace mixxx diff --git a/src/preferences/dialog/dlgpreferences.h b/src/preferences/dialog/dlgpreferences.h index e2934170c0d..b9a3227bf4d 100644 --- a/src/preferences/dialog/dlgpreferences.h +++ b/src/preferences/dialog/dlgpreferences.h @@ -76,7 +76,7 @@ class DlgPreferences : public QDialog, public Ui::DlgPreferencesDlg { void resetToDefaults(); void reloadUserInterface(); - void tooltipModeChanged(mixxx::TooltipsPreference tooltipMode); + void tooltipModeChanged(mixxx::preferences::constants::Tooltips tooltipMode); void menuBarAutoHideChanged(); protected: diff --git a/src/preferences/dialog/dlgprefinterface.cpp b/src/preferences/dialog/dlgprefinterface.cpp index 1792a953d91..8711b9f4b07 100644 --- a/src/preferences/dialog/dlgprefinterface.cpp +++ b/src/preferences/dialog/dlgprefinterface.cpp @@ -177,11 +177,11 @@ DlgPrefInterface::DlgPrefInterface( // Screensaver mode comboBoxScreensaver->clear(); comboBoxScreensaver->addItem(tr("Allow screensaver to run"), - static_cast(mixxx::ScreenSaverPreference::PREVENT_OFF)); + static_cast(mixxx::preferences::constants::ScreenSaver::Off)); comboBoxScreensaver->addItem(tr("Prevent screensaver from running"), - static_cast(mixxx::ScreenSaverPreference::PREVENT_ON)); + static_cast(mixxx::preferences::constants::ScreenSaver::On)); comboBoxScreensaver->addItem(tr("Prevent screensaver while playing"), - static_cast(mixxx::ScreenSaverPreference::PREVENT_ON_PLAY)); + static_cast(mixxx::preferences::constants::ScreenSaver::OnPlay)); int inhibitsettings = static_cast(m_pScreensaverManager->status()); comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData(inhibitsettings)); @@ -341,7 +341,7 @@ void DlgPrefInterface::slotResetToDefaults() { // Inhibit the screensaver comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( - static_cast(mixxx::ScreenSaverPreference::PREVENT_ON))); + static_cast(mixxx::preferences::constants::ScreenSaver::On))); #ifdef MIXXX_USE_QML multiSamplingComboBox->setCurrentIndex(4); // 4x MSAA @@ -357,11 +357,11 @@ void DlgPrefInterface::slotResetToDefaults() { } void DlgPrefInterface::slotSetTooltips() { - m_tooltipMode = mixxx::TooltipsPreference::TOOLTIPS_ON; + m_tooltipMode = mixxx::preferences::constants::Tooltips::On; if (radioButtonTooltipsOff->isChecked()) { - m_tooltipMode = mixxx::TooltipsPreference::TOOLTIPS_OFF; + m_tooltipMode = mixxx::preferences::constants::Tooltips::Off; } else if (radioButtonTooltipsLibrary->isChecked()) { - m_tooltipMode = mixxx::TooltipsPreference::TOOLTIPS_ONLY_IN_LIBRARY; + m_tooltipMode = mixxx::preferences::constants::Tooltips::OnlyInLibrary; } } @@ -469,7 +469,7 @@ void DlgPrefInterface::slotApply() { int screensaverConfiguredState = static_cast(m_pScreensaverManager->status()); if (screensaverComboBoxState != screensaverConfiguredState) { m_pScreensaverManager->setStatus( - static_cast(screensaverComboBoxState)); + static_cast(screensaverComboBoxState)); } #ifdef MIXXX_USE_QML @@ -505,21 +505,21 @@ void DlgPrefInterface::slotApply() { } void DlgPrefInterface::loadTooltipPreferenceFromConfig() { - const auto tooltipMode = static_cast( + const auto tooltipMode = static_cast( m_pConfig->getValue(ConfigKey(kControlsGroup, kTooltipsKey), #ifdef Q_OS_IOS - static_cast(mixxx::TooltipsPreference::TOOLTIPS_OFF))); + static_cast(mixxx::preferences::constants::Tooltips::Off))); #else - static_cast(mixxx::TooltipsPreference::TOOLTIPS_ON))); + static_cast(mixxx::preferences::constants::Tooltips::On))); #endif switch (tooltipMode) { - case mixxx::TooltipsPreference::TOOLTIPS_OFF: + case mixxx::preferences::constants::Tooltips::Off: radioButtonTooltipsOff->setChecked(true); break; - case mixxx::TooltipsPreference::TOOLTIPS_ONLY_IN_LIBRARY: + case mixxx::preferences::constants::Tooltips::OnlyInLibrary: radioButtonTooltipsLibrary->setChecked(true); break; - case mixxx::TooltipsPreference::TOOLTIPS_ON: + case mixxx::preferences::constants::Tooltips::On: default: radioButtonTooltipsLibraryAndSkin->setChecked(true); break; diff --git a/src/preferences/dialog/dlgprefinterface.h b/src/preferences/dialog/dlgprefinterface.h index 6256fb0f18d..e172e136e65 100644 --- a/src/preferences/dialog/dlgprefinterface.h +++ b/src/preferences/dialog/dlgprefinterface.h @@ -45,7 +45,7 @@ class DlgPrefInterface : public DlgPreferencePage, public Ui::DlgPrefControlsDlg signals: void reloadUserInterface(); void menuBarAutoHideChanged(); - void tooltipModeChanged(mixxx::TooltipsPreference tooltipMode); + void tooltipModeChanged(mixxx::preferences::constants::Tooltips tooltipMode); private: void notifyRebootNecessary(); @@ -70,9 +70,9 @@ class DlgPrefInterface : public DlgPreferencePage, public Ui::DlgPrefControlsDlg QString m_colorSchemeOnUpdate; QString m_localeOnUpdate; int m_multiSampling; - mixxx::TooltipsPreference m_tooltipMode; + mixxx::preferences::constants::Tooltips m_tooltipMode; double m_dScaleFactor; double m_minScaleFactor; double m_dDevicePixelRatio; - mixxx::ScreenSaverPreference m_screensaverMode; + mixxx::preferences::constants::ScreenSaver m_screensaverMode; }; diff --git a/src/util/screensavermanager.cpp b/src/util/screensavermanager.cpp index b4644935137..62699876976 100644 --- a/src/util/screensavermanager.cpp +++ b/src/util/screensavermanager.cpp @@ -9,26 +9,26 @@ ScreensaverManager::ScreensaverManager(UserSettingsPointer pConfig, QObject* pPa : QObject(pParent), m_pConfig(pConfig) { m_inhibitScreensaver = pConfig->getValue(ConfigKey("[Config]", "InhibitScreensaver"), - mixxx::ScreenSaverPreference::PREVENT_ON); + mixxx::preferences::constants::ScreenSaver::On); pConfig->setValue(ConfigKey("[Config]", "InhibitScreensaver"), m_inhibitScreensaver); - if (m_inhibitScreensaver == mixxx::ScreenSaverPreference::PREVENT_ON) { + if (m_inhibitScreensaver == mixxx::preferences::constants::ScreenSaver::On) { mixxx::ScreenSaverHelper::inhibit(); } } ScreensaverManager::~ScreensaverManager() { - if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) { + if (m_inhibitScreensaver != mixxx::preferences::constants::ScreenSaver::Off) { mixxx::ScreenSaverHelper::uninhibit(); } } -void ScreensaverManager::setStatus(mixxx::ScreenSaverPreference newInhibit) { - if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) { +void ScreensaverManager::setStatus(mixxx::preferences::constants::ScreenSaver newInhibit) { + if (m_inhibitScreensaver != mixxx::preferences::constants::ScreenSaver::Off) { mixxx::ScreenSaverHelper::uninhibit(); } - if (newInhibit == mixxx::ScreenSaverPreference::PREVENT_ON || - (newInhibit == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY && + if (newInhibit == mixxx::preferences::constants::ScreenSaver::On || + (newInhibit == mixxx::preferences::constants::ScreenSaver::OnPlay && PlayerInfo::instance().getCurrentPlayingDeck() != -1)) { mixxx::ScreenSaverHelper::inhibit(); } @@ -37,7 +37,7 @@ void ScreensaverManager::setStatus(mixxx::ScreenSaverPreference newInhibit) { } void ScreensaverManager::slotCurrentPlayingDeckChanged(int deck) { - if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) { + if (m_inhibitScreensaver != mixxx::preferences::constants::ScreenSaver::OnPlay) { return; } if (deck == -1) { diff --git a/src/util/screensavermanager.h b/src/util/screensavermanager.h index 5af9223a006..0ddc8427bbb 100644 --- a/src/util/screensavermanager.h +++ b/src/util/screensavermanager.h @@ -13,9 +13,9 @@ class ScreensaverManager : public QObject { ScreensaverManager(UserSettingsPointer pConfig, QObject* pParent = nullptr); ~ScreensaverManager(); - void setStatus(mixxx::ScreenSaverPreference status); + void setStatus(mixxx::preferences::constants::ScreenSaver status); - mixxx::ScreenSaverPreference status() { + mixxx::preferences::constants::ScreenSaver status() { return m_inhibitScreensaver; } public slots: @@ -23,7 +23,7 @@ class ScreensaverManager : public QObject { private: const UserSettingsPointer m_pConfig; - mixxx::ScreenSaverPreference m_inhibitScreensaver; + mixxx::preferences::constants::ScreenSaver m_inhibitScreensaver; }; } // namespace mixxx From f219a2d12684dd82dde02dd4f7687f583f4ac454 Mon Sep 17 00:00:00 2001 From: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> Date: Mon, 12 Feb 2024 15:47:16 +0100 Subject: [PATCH 2/5] refactor(preferences): dlgprefinterface use namespace prefs::constants --- src/preferences/dialog/dlgprefinterface.cpp | 32 +++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/preferences/dialog/dlgprefinterface.cpp b/src/preferences/dialog/dlgprefinterface.cpp index 8711b9f4b07..afadf516983 100644 --- a/src/preferences/dialog/dlgprefinterface.cpp +++ b/src/preferences/dialog/dlgprefinterface.cpp @@ -42,6 +42,8 @@ const bool kHideMenuBarDefault = true; } // namespace +using namespace mixxx::preferences; + DlgPrefInterface::DlgPrefInterface( QWidget* parent, std::shared_ptr pScreensaverManager, @@ -177,11 +179,11 @@ DlgPrefInterface::DlgPrefInterface( // Screensaver mode comboBoxScreensaver->clear(); comboBoxScreensaver->addItem(tr("Allow screensaver to run"), - static_cast(mixxx::preferences::constants::ScreenSaver::Off)); + static_cast(constants::ScreenSaver::Off)); comboBoxScreensaver->addItem(tr("Prevent screensaver from running"), - static_cast(mixxx::preferences::constants::ScreenSaver::On)); + static_cast(constants::ScreenSaver::On)); comboBoxScreensaver->addItem(tr("Prevent screensaver while playing"), - static_cast(mixxx::preferences::constants::ScreenSaver::OnPlay)); + static_cast(constants::ScreenSaver::OnPlay)); int inhibitsettings = static_cast(m_pScreensaverManager->status()); comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData(inhibitsettings)); @@ -341,7 +343,7 @@ void DlgPrefInterface::slotResetToDefaults() { // Inhibit the screensaver comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( - static_cast(mixxx::preferences::constants::ScreenSaver::On))); + static_cast(constants::ScreenSaver::On))); #ifdef MIXXX_USE_QML multiSamplingComboBox->setCurrentIndex(4); // 4x MSAA @@ -357,11 +359,11 @@ void DlgPrefInterface::slotResetToDefaults() { } void DlgPrefInterface::slotSetTooltips() { - m_tooltipMode = mixxx::preferences::constants::Tooltips::On; + m_tooltipMode = constants::Tooltips::On; if (radioButtonTooltipsOff->isChecked()) { - m_tooltipMode = mixxx::preferences::constants::Tooltips::Off; + m_tooltipMode = constants::Tooltips::Off; } else if (radioButtonTooltipsLibrary->isChecked()) { - m_tooltipMode = mixxx::preferences::constants::Tooltips::OnlyInLibrary; + m_tooltipMode = constants::Tooltips::OnlyInLibrary; } } @@ -469,7 +471,7 @@ void DlgPrefInterface::slotApply() { int screensaverConfiguredState = static_cast(m_pScreensaverManager->status()); if (screensaverComboBoxState != screensaverConfiguredState) { m_pScreensaverManager->setStatus( - static_cast(screensaverComboBoxState)); + static_cast(screensaverComboBoxState)); } #ifdef MIXXX_USE_QML @@ -505,21 +507,21 @@ void DlgPrefInterface::slotApply() { } void DlgPrefInterface::loadTooltipPreferenceFromConfig() { - const auto tooltipMode = static_cast( - m_pConfig->getValue(ConfigKey(kControlsGroup, kTooltipsKey), + const auto tooltipMode = + m_pConfig->getValue(ConfigKey(kControlsGroup, kTooltipsKey), #ifdef Q_OS_IOS - static_cast(mixxx::preferences::constants::Tooltips::Off))); + constants::Tooltips::Off); #else - static_cast(mixxx::preferences::constants::Tooltips::On))); + constants::Tooltips::On); #endif switch (tooltipMode) { - case mixxx::preferences::constants::Tooltips::Off: + case constants::Tooltips::Off: radioButtonTooltipsOff->setChecked(true); break; - case mixxx::preferences::constants::Tooltips::OnlyInLibrary: + case constants::Tooltips::OnlyInLibrary: radioButtonTooltipsLibrary->setChecked(true); break; - case mixxx::preferences::constants::Tooltips::On: + case constants::Tooltips::On: default: radioButtonTooltipsLibraryAndSkin->setChecked(true); break; From c598f2644c490e9acadcd11d381d62c93d9e74fb Mon Sep 17 00:00:00 2001 From: ronso0 Date: Mon, 12 Feb 2024 14:36:35 +0100 Subject: [PATCH 3/5] refactor(preferences): use enum for QML multi-sampling mode --- src/mixxxmainwindow.cpp | 1 - src/preferences/constants.h | 8 ++++ src/preferences/dialog/dlgprefinterface.cpp | 50 ++++++++++++--------- src/preferences/dialog/dlgprefinterface.h | 2 +- src/qml/qmlconfigproxy.cpp | 5 ++- 5 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/mixxxmainwindow.cpp b/src/mixxxmainwindow.cpp index 358179867f2..03789c83bfb 100644 --- a/src/mixxxmainwindow.cpp +++ b/src/mixxxmainwindow.cpp @@ -27,7 +27,6 @@ #include "dialog/dlgdevelopertools.h" #include "dialog/dlgkeywheel.h" #include "moc_mixxxmainwindow.cpp" -#include "preferences/constants.h" #include "preferences/dialog/dlgpreferences.h" #ifdef __BROADCAST__ #include "broadcast/broadcastmanager.h" diff --git a/src/preferences/constants.h b/src/preferences/constants.h index 516161654dc..099d2177369 100644 --- a/src/preferences/constants.h +++ b/src/preferences/constants.h @@ -21,6 +21,14 @@ enum class ScreenSaver { OnPlay = 2 }; +enum class MultiSamplingMode { + Disabled = 0, + Two = 2, + Four = 4, + Eight = 8, + Sixteen = 16 +}; + } // namespace constants } // namespace preferences } // namespace mixxx diff --git a/src/preferences/dialog/dlgprefinterface.cpp b/src/preferences/dialog/dlgprefinterface.cpp index afadf516983..dfe8bf21733 100644 --- a/src/preferences/dialog/dlgprefinterface.cpp +++ b/src/preferences/dialog/dlgprefinterface.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "control/controlobject.h" @@ -192,25 +193,34 @@ DlgPrefInterface::DlgPrefInterface( #ifdef MIXXX_USE_QML if (CmdlineArgs::Instance().isQml()) { multiSamplingComboBox->clear(); - multiSamplingComboBox->addItem(tr("Disabled"), 0); - multiSamplingComboBox->addItem(tr("2x MSAA"), 2); - multiSamplingComboBox->addItem(tr("4x MSAA"), 4); - multiSamplingComboBox->addItem(tr("8x MSAA"), 8); - multiSamplingComboBox->addItem(tr("16x MSAA"), 16); - - m_multiSampling = m_pConfig->getValue(ConfigKey(kPreferencesGroup, kMultiSamplingKey), 4); - int multiSamplingIndex = multiSamplingComboBox->findData(m_multiSampling); + multiSamplingComboBox->addItem(tr("Disabled"), + QVariant::fromValue(constants::MultiSamplingMode::Disabled)); + multiSamplingComboBox->addItem(tr("2x MSAA"), + QVariant::fromValue(constants::MultiSamplingMode::Two)); + multiSamplingComboBox->addItem(tr("4x MSAA"), + QVariant::fromValue(constants::MultiSamplingMode::Four)); + multiSamplingComboBox->addItem(tr("8x MSAA"), + QVariant::fromValue(constants::MultiSamplingMode::Eight)); + multiSamplingComboBox->addItem(tr("16x MSAA"), + QVariant::fromValue(constants::MultiSamplingMode::Sixteen)); + + m_multiSampling = m_pConfig->getValue( + ConfigKey(kPreferencesGroup, kMultiSamplingKey), + constants::MultiSamplingMode::Four); + int multiSamplingIndex = multiSamplingComboBox->findData( + static_cast(m_multiSampling)); if (multiSamplingIndex != -1) { multiSamplingComboBox->setCurrentIndex(multiSamplingIndex); } else { - multiSamplingComboBox->setCurrentIndex(0); - m_pConfig->set(ConfigKey(kPreferencesGroup, kMultiSamplingKey), ConfigValue(0)); + multiSamplingComboBox->setCurrentIndex(0); // Disabled + m_pConfig->setValue(ConfigKey(kPreferencesGroup, kMultiSamplingKey), + constants::MultiSamplingMode::Disabled); } } else #endif { #ifdef MIXXX_USE_QML - m_multiSampling = 0; + m_multiSampling = mixxx::MultiSamplingMode::Disabled; #endif multiSamplingLabel->hide(); multiSamplingComboBox->hide(); @@ -346,7 +356,8 @@ void DlgPrefInterface::slotResetToDefaults() { static_cast(constants::ScreenSaver::On))); #ifdef MIXXX_USE_QML - multiSamplingComboBox->setCurrentIndex(4); // 4x MSAA + multiSamplingComboBox->setCurrentIndex(multiSamplingComboBox->findData( + static_cast(constants::MultiSamplingMode::Four))); // 4x MSAA #endif #ifdef Q_OS_IOS @@ -447,8 +458,7 @@ void DlgPrefInterface::slotApply() { m_pConfig->set(ConfigKey(kConfigGroup, kSchemeKey), m_colorScheme); } - QString locale = ComboBoxLocale->itemData( - ComboBoxLocale->currentIndex()).toString(); + QString locale = ComboBoxLocale->currentData().toString(); m_pConfig->set(ConfigKey(kConfigGroup, kLocaleKey), locale); double scaleFactor = spinBoxScaleFactor->value() / 100; @@ -466,8 +476,7 @@ void DlgPrefInterface::slotApply() { emit tooltipModeChanged(m_tooltipMode); // screensaver mode update - int screensaverComboBoxState = comboBoxScreensaver->itemData( - comboBoxScreensaver->currentIndex()).toInt(); + int screensaverComboBoxState = comboBoxScreensaver->currentData().toInt(); int screensaverConfiguredState = static_cast(m_pScreensaverManager->status()); if (screensaverComboBoxState != screensaverConfiguredState) { m_pScreensaverManager->setStatus( @@ -475,10 +484,11 @@ void DlgPrefInterface::slotApply() { } #ifdef MIXXX_USE_QML - int multiSampling = multiSamplingComboBox->itemData( - multiSamplingComboBox->currentIndex()) - .toInt(); - m_pConfig->set(ConfigKey(kPreferencesGroup, kMultiSamplingKey), ConfigValue(multiSampling)); + constants::MultiSamplingMode multiSampling = + multiSamplingComboBox->currentData() + .value(); + m_pConfig->setValue( + ConfigKey(kPreferencesGroup, kMultiSamplingKey), multiSampling); #endif if (locale != m_localeOnUpdate || scaleFactor != m_dScaleFactor diff --git a/src/preferences/dialog/dlgprefinterface.h b/src/preferences/dialog/dlgprefinterface.h index e172e136e65..3744b81a770 100644 --- a/src/preferences/dialog/dlgprefinterface.h +++ b/src/preferences/dialog/dlgprefinterface.h @@ -69,7 +69,7 @@ class DlgPrefInterface : public DlgPreferencePage, public Ui::DlgPrefControlsDlg QString m_colorScheme; QString m_colorSchemeOnUpdate; QString m_localeOnUpdate; - int m_multiSampling; + mixxx::preferences::constants::MultiSamplingMode m_multiSampling; mixxx::preferences::constants::Tooltips m_tooltipMode; double m_dScaleFactor; double m_minScaleFactor; diff --git a/src/qml/qmlconfigproxy.cpp b/src/qml/qmlconfigproxy.cpp index 216e36d0db5..703cdb43cce 100644 --- a/src/qml/qmlconfigproxy.cpp +++ b/src/qml/qmlconfigproxy.cpp @@ -2,6 +2,7 @@ #include "moc_qmlconfigproxy.cpp" #include "preferences/colorpalettesettings.h" +#include "preferences/constants.h" namespace { QVariantList paletteToQColorList(const ColorPalette& palette) { @@ -36,7 +37,9 @@ QVariantList QmlConfigProxy::getTrackColorPalette() { } int QmlConfigProxy::getMultiSamplingLevel() { - return m_pConfig->getValue(ConfigKey(kPreferencesGroup, kMultiSamplingKey), 0); + return static_cast(m_pConfig->getValue( + ConfigKey(kPreferencesGroup, kMultiSamplingKey), + mixxx::preferences::constants::MultiSamplingMode::Disabled)); } // static From c9c8e20387d0afec242235e693dbc6b2756de4c1 Mon Sep 17 00:00:00 2001 From: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> Date: Mon, 12 Feb 2024 18:09:53 +0100 Subject: [PATCH 4/5] refactor(preferences): avoid static_casts for preferences::constants --- CMakeLists.txt | 1 + src/preferences/constants.cpp | 4 +++ src/preferences/constants.h | 10 ++++++ src/preferences/dialog/dlgprefinterface.cpp | 36 +++++++++++---------- 4 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 src/preferences/constants.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f5db15cdb67..396a547d489 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1042,6 +1042,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/preferences/colorpalettesettings.cpp src/preferences/colorpalettesettings.cpp src/preferences/configobject.cpp + src/preferences/constants.cpp src/preferences/dialog/dlgprefautodj.cpp src/preferences/dialog/dlgprefautodjdlg.ui src/preferences/dialog/dlgprefbeats.cpp diff --git a/src/preferences/constants.cpp b/src/preferences/constants.cpp new file mode 100644 index 00000000000..b1a902a8160 --- /dev/null +++ b/src/preferences/constants.cpp @@ -0,0 +1,4 @@ +// just a stub so the MOC file can be included somewhere +#include "constants.h" + +#include "moc_constants.cpp" diff --git a/src/preferences/constants.h b/src/preferences/constants.h index 099d2177369..7daab422f9c 100644 --- a/src/preferences/constants.h +++ b/src/preferences/constants.h @@ -1,10 +1,17 @@ #pragma once +// required for Qt-Macros +#include + namespace mixxx { namespace preferences { namespace constants { +Q_NAMESPACE + +// In order for this Q_NAMESPACE to work, all members of the namespace must +// be declared here. see QTBUG-68611 // Don't change these constants since they are stored in user configuration // files. @@ -13,6 +20,7 @@ enum class Tooltips { On = 1, OnlyInLibrary = 2, }; +Q_ENUM_NS(Tooltips); // Settings to enable or disable the prevention to run the screensaver. enum class ScreenSaver { @@ -20,6 +28,7 @@ enum class ScreenSaver { On = 1, OnPlay = 2 }; +Q_ENUM_NS(ScreenSaver); enum class MultiSamplingMode { Disabled = 0, @@ -28,6 +37,7 @@ enum class MultiSamplingMode { Eight = 8, Sixteen = 16 }; +Q_ENUM_NS(MultiSamplingMode); } // namespace constants } // namespace preferences diff --git a/src/preferences/dialog/dlgprefinterface.cpp b/src/preferences/dialog/dlgprefinterface.cpp index dfe8bf21733..107b7b197c4 100644 --- a/src/preferences/dialog/dlgprefinterface.cpp +++ b/src/preferences/dialog/dlgprefinterface.cpp @@ -11,6 +11,7 @@ #include "control/controlproxy.h" #include "defs_urls.h" #include "moc_dlgprefinterface.cpp" +#include "preferences/constants.h" #include "preferences/usersettings.h" #include "skin/legacy/legacyskinparser.h" #include "skin/skin.h" @@ -180,14 +181,14 @@ DlgPrefInterface::DlgPrefInterface( // Screensaver mode comboBoxScreensaver->clear(); comboBoxScreensaver->addItem(tr("Allow screensaver to run"), - static_cast(constants::ScreenSaver::Off)); + QVariant::fromValue(constants::ScreenSaver::Off)); comboBoxScreensaver->addItem(tr("Prevent screensaver from running"), - static_cast(constants::ScreenSaver::On)); + QVariant::fromValue((constants::ScreenSaver::On))); comboBoxScreensaver->addItem(tr("Prevent screensaver while playing"), - static_cast(constants::ScreenSaver::OnPlay)); + QVariant::fromValue(constants::ScreenSaver::OnPlay)); - int inhibitsettings = static_cast(m_pScreensaverManager->status()); - comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData(inhibitsettings)); + comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( + QVariant::fromValue(m_pScreensaverManager->status()))); // Multi-Sampling #ifdef MIXXX_USE_QML @@ -208,7 +209,7 @@ DlgPrefInterface::DlgPrefInterface( ConfigKey(kPreferencesGroup, kMultiSamplingKey), constants::MultiSamplingMode::Four); int multiSamplingIndex = multiSamplingComboBox->findData( - static_cast(m_multiSampling)); + QVariant::fromValue((m_multiSampling))); if (multiSamplingIndex != -1) { multiSamplingComboBox->setCurrentIndex(multiSamplingIndex); } else { @@ -325,8 +326,8 @@ void DlgPrefInterface::slotUpdate() { loadTooltipPreferenceFromConfig(); - int inhibitsettings = static_cast(m_pScreensaverManager->status()); - comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData(inhibitsettings)); + comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( + QVariant::fromValue(m_pScreensaverManager->status()))); } void DlgPrefInterface::slotResetToDefaults() { @@ -353,11 +354,12 @@ void DlgPrefInterface::slotResetToDefaults() { // Inhibit the screensaver comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( - static_cast(constants::ScreenSaver::On))); + QVariant::fromValue(constants::ScreenSaver::On))); #ifdef MIXXX_USE_QML - multiSamplingComboBox->setCurrentIndex(multiSamplingComboBox->findData( - static_cast(constants::MultiSamplingMode::Four))); // 4x MSAA + multiSamplingComboBox->setCurrentIndex( + multiSamplingComboBox->findData(QVariant::fromValue( + constants::MultiSamplingMode::Four))); // 4x MSAA #endif #ifdef Q_OS_IOS @@ -471,16 +473,16 @@ void DlgPrefInterface::slotApply() { ConfigValue(checkBoxHideMenuBar->isChecked())); emit menuBarAutoHideChanged(); - m_pConfig->set(ConfigKey(kControlsGroup, kTooltipsKey), - ConfigValue(static_cast(m_tooltipMode))); + m_pConfig->setValue(ConfigKey(kControlsGroup, kTooltipsKey), + m_tooltipMode); emit tooltipModeChanged(m_tooltipMode); // screensaver mode update - int screensaverComboBoxState = comboBoxScreensaver->currentData().toInt(); - int screensaverConfiguredState = static_cast(m_pScreensaverManager->status()); + const auto screensaverComboBoxState = + comboBoxScreensaver->currentData().value(); + const auto screensaverConfiguredState = m_pScreensaverManager->status(); if (screensaverComboBoxState != screensaverConfiguredState) { - m_pScreensaverManager->setStatus( - static_cast(screensaverComboBoxState)); + m_pScreensaverManager->setStatus(screensaverComboBoxState); } #ifdef MIXXX_USE_QML From da7e474c7ed98a01b6a3a350366970da670dd9a6 Mon Sep 17 00:00:00 2001 From: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> Date: Fri, 17 May 2024 10:31:39 +0200 Subject: [PATCH 5/5] refactor: hide preferences::constants namespace by use of inline namespace --- src/mixxxmainwindow.cpp | 16 +++--- src/mixxxmainwindow.h | 10 ++-- src/preferences/constants.h | 2 +- src/preferences/dialog/dlgpreferences.h | 2 +- src/preferences/dialog/dlgprefinterface.cpp | 58 ++++++++++----------- src/preferences/dialog/dlgprefinterface.h | 8 +-- src/qml/qmlconfigproxy.cpp | 2 +- src/util/screensavermanager.cpp | 16 +++--- src/util/screensavermanager.h | 6 +-- 9 files changed, 59 insertions(+), 61 deletions(-) diff --git a/src/mixxxmainwindow.cpp b/src/mixxxmainwindow.cpp index 03789c83bfb..af88465c7f6 100644 --- a/src/mixxxmainwindow.cpp +++ b/src/mixxxmainwindow.cpp @@ -99,7 +99,7 @@ MixxxMainWindow::MixxxMainWindow(std::shared_ptr pCoreServi #endif m_pDeveloperToolsDlg(nullptr), m_pPrefDlg(nullptr), - m_toolTipsCfg(mixxx::preferences::constants::Tooltips::On) { + m_toolTipsCfg(mixxx::preferences::Tooltips::On) { DEBUG_ASSERT(pCoreServices); // These depend on the settings #ifdef __LINUX__ @@ -175,10 +175,10 @@ void MixxxMainWindow::initialize() { // Set the visibility of tooltips, default "1" = ON m_toolTipsCfg = pConfig->getValue( ConfigKey("[Controls]", "Tooltips"), - mixxx::preferences::constants::Tooltips::On); + mixxx::preferences::Tooltips::On); #ifdef MIXXX_USE_QOPENGL ToolTipQOpenGL::singleton().setActive( - m_toolTipsCfg == mixxx::preferences::constants::Tooltips::On); + m_toolTipsCfg == mixxx::preferences::Tooltips::On); #endif #ifdef __ENGINEPRIME__ @@ -1153,11 +1153,11 @@ void MixxxMainWindow::slotShowKeywheel(bool toggle) { } } -void MixxxMainWindow::slotTooltipModeChanged(mixxx::preferences::constants::Tooltips tt) { +void MixxxMainWindow::slotTooltipModeChanged(mixxx::preferences::Tooltips tt) { m_toolTipsCfg = tt; #ifdef MIXXX_USE_QOPENGL ToolTipQOpenGL::singleton().setActive( - m_toolTipsCfg == mixxx::preferences::constants::Tooltips::On); + m_toolTipsCfg == mixxx::preferences::Tooltips::On); #endif } @@ -1260,14 +1260,14 @@ bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) { "DlgPreferences") { // return true for no tool tips switch (m_toolTipsCfg) { - case mixxx::preferences::constants::Tooltips::OnlyInLibrary: + case mixxx::preferences::Tooltips::OnlyInLibrary: if (dynamic_cast(obj) != nullptr) { return true; } break; - case mixxx::preferences::constants::Tooltips::On: + case mixxx::preferences::Tooltips::On: break; - case mixxx::preferences::constants::Tooltips::Off: + case mixxx::preferences::Tooltips::Off: return true; default: DEBUG_ASSERT(!"m_toolTipsCfg value unknown"); diff --git a/src/mixxxmainwindow.h b/src/mixxxmainwindow.h index d4011cb0efa..1c673578ce3 100644 --- a/src/mixxxmainwindow.h +++ b/src/mixxxmainwindow.h @@ -50,8 +50,8 @@ class MixxxMainWindow : public QMainWindow { /// creates the menu_bar and inserts the file Menu void createMenuBar(); void connectMenuBar(); - void setInhibitScreensaver(mixxx::preferences::constants::ScreenSaver inhibit); - mixxx::preferences::constants::ScreenSaver getInhibitScreensaver(); + void setInhibitScreensaver(mixxx::preferences::ScreenSaver inhibit); + mixxx::preferences::ScreenSaver getInhibitScreensaver(); inline GuiTick* getGuiTick() { return m_pGuiTick; }; @@ -87,7 +87,7 @@ class MixxxMainWindow : public QMainWindow { void initializationProgressUpdate(int progress, const QString& serviceName); private slots: - void slotTooltipModeChanged(mixxx::preferences::constants::Tooltips tt); + void slotTooltipModeChanged(mixxx::preferences::Tooltips tt); signals: void skinLoaded(); @@ -148,9 +148,9 @@ class MixxxMainWindow : public QMainWindow { std::unique_ptr m_pLibraryExporter; #endif - mixxx::preferences::constants::Tooltips m_toolTipsCfg; + mixxx::preferences::Tooltips m_toolTipsCfg; - mixxx::preferences::constants::ScreenSaver m_inhibitScreensaver; + mixxx::preferences::ScreenSaver m_inhibitScreensaver; QSet m_skinCreatedControls; }; diff --git a/src/preferences/constants.h b/src/preferences/constants.h index 7daab422f9c..389e9f1df46 100644 --- a/src/preferences/constants.h +++ b/src/preferences/constants.h @@ -7,7 +7,7 @@ namespace mixxx { namespace preferences { -namespace constants { +inline namespace constants { Q_NAMESPACE // In order for this Q_NAMESPACE to work, all members of the namespace must diff --git a/src/preferences/dialog/dlgpreferences.h b/src/preferences/dialog/dlgpreferences.h index b9a3227bf4d..ad5f2185662 100644 --- a/src/preferences/dialog/dlgpreferences.h +++ b/src/preferences/dialog/dlgpreferences.h @@ -76,7 +76,7 @@ class DlgPreferences : public QDialog, public Ui::DlgPreferencesDlg { void resetToDefaults(); void reloadUserInterface(); - void tooltipModeChanged(mixxx::preferences::constants::Tooltips tooltipMode); + void tooltipModeChanged(mixxx::preferences::Tooltips tooltipMode); void menuBarAutoHideChanged(); protected: diff --git a/src/preferences/dialog/dlgprefinterface.cpp b/src/preferences/dialog/dlgprefinterface.cpp index 107b7b197c4..c560f1a4f8e 100644 --- a/src/preferences/dialog/dlgprefinterface.cpp +++ b/src/preferences/dialog/dlgprefinterface.cpp @@ -44,8 +44,6 @@ const bool kHideMenuBarDefault = true; } // namespace -using namespace mixxx::preferences; - DlgPrefInterface::DlgPrefInterface( QWidget* parent, std::shared_ptr pScreensaverManager, @@ -181,11 +179,11 @@ DlgPrefInterface::DlgPrefInterface( // Screensaver mode comboBoxScreensaver->clear(); comboBoxScreensaver->addItem(tr("Allow screensaver to run"), - QVariant::fromValue(constants::ScreenSaver::Off)); + QVariant::fromValue(mixxx::preferences::ScreenSaver::Off)); comboBoxScreensaver->addItem(tr("Prevent screensaver from running"), - QVariant::fromValue((constants::ScreenSaver::On))); + QVariant::fromValue((mixxx::preferences::ScreenSaver::On))); comboBoxScreensaver->addItem(tr("Prevent screensaver while playing"), - QVariant::fromValue(constants::ScreenSaver::OnPlay)); + QVariant::fromValue(mixxx::preferences::ScreenSaver::OnPlay)); comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( QVariant::fromValue(m_pScreensaverManager->status()))); @@ -195,19 +193,19 @@ DlgPrefInterface::DlgPrefInterface( if (CmdlineArgs::Instance().isQml()) { multiSamplingComboBox->clear(); multiSamplingComboBox->addItem(tr("Disabled"), - QVariant::fromValue(constants::MultiSamplingMode::Disabled)); + QVariant::fromValue(mixxx::preferences::MultiSamplingMode::Disabled)); multiSamplingComboBox->addItem(tr("2x MSAA"), - QVariant::fromValue(constants::MultiSamplingMode::Two)); + QVariant::fromValue(mixxx::preferences::MultiSamplingMode::Two)); multiSamplingComboBox->addItem(tr("4x MSAA"), - QVariant::fromValue(constants::MultiSamplingMode::Four)); + QVariant::fromValue(mixxx::preferences::MultiSamplingMode::Four)); multiSamplingComboBox->addItem(tr("8x MSAA"), - QVariant::fromValue(constants::MultiSamplingMode::Eight)); + QVariant::fromValue(mixxx::preferences::MultiSamplingMode::Eight)); multiSamplingComboBox->addItem(tr("16x MSAA"), - QVariant::fromValue(constants::MultiSamplingMode::Sixteen)); + QVariant::fromValue(mixxx::preferences::MultiSamplingMode::Sixteen)); - m_multiSampling = m_pConfig->getValue( + m_multiSampling = m_pConfig->getValue( ConfigKey(kPreferencesGroup, kMultiSamplingKey), - constants::MultiSamplingMode::Four); + mixxx::preferences::MultiSamplingMode::Four); int multiSamplingIndex = multiSamplingComboBox->findData( QVariant::fromValue((m_multiSampling))); if (multiSamplingIndex != -1) { @@ -215,13 +213,13 @@ DlgPrefInterface::DlgPrefInterface( } else { multiSamplingComboBox->setCurrentIndex(0); // Disabled m_pConfig->setValue(ConfigKey(kPreferencesGroup, kMultiSamplingKey), - constants::MultiSamplingMode::Disabled); + mixxx::preferences::MultiSamplingMode::Disabled); } } else #endif { #ifdef MIXXX_USE_QML - m_multiSampling = mixxx::MultiSamplingMode::Disabled; + m_multiSampling = mixxx::preferences::MultiSamplingMode::Disabled; #endif multiSamplingLabel->hide(); multiSamplingComboBox->hide(); @@ -354,12 +352,12 @@ void DlgPrefInterface::slotResetToDefaults() { // Inhibit the screensaver comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( - QVariant::fromValue(constants::ScreenSaver::On))); + QVariant::fromValue(mixxx::preferences::ScreenSaver::On))); #ifdef MIXXX_USE_QML multiSamplingComboBox->setCurrentIndex( multiSamplingComboBox->findData(QVariant::fromValue( - constants::MultiSamplingMode::Four))); // 4x MSAA + mixxx::preferences::MultiSamplingMode::Four))); // 4x MSAA #endif #ifdef Q_OS_IOS @@ -372,11 +370,11 @@ void DlgPrefInterface::slotResetToDefaults() { } void DlgPrefInterface::slotSetTooltips() { - m_tooltipMode = constants::Tooltips::On; + m_tooltipMode = mixxx::preferences::Tooltips::On; if (radioButtonTooltipsOff->isChecked()) { - m_tooltipMode = constants::Tooltips::Off; + m_tooltipMode = mixxx::preferences::Tooltips::Off; } else if (radioButtonTooltipsLibrary->isChecked()) { - m_tooltipMode = constants::Tooltips::OnlyInLibrary; + m_tooltipMode = mixxx::preferences::Tooltips::OnlyInLibrary; } } @@ -479,17 +477,17 @@ void DlgPrefInterface::slotApply() { // screensaver mode update const auto screensaverComboBoxState = - comboBoxScreensaver->currentData().value(); + comboBoxScreensaver->currentData().value(); const auto screensaverConfiguredState = m_pScreensaverManager->status(); if (screensaverComboBoxState != screensaverConfiguredState) { m_pScreensaverManager->setStatus(screensaverComboBoxState); } #ifdef MIXXX_USE_QML - constants::MultiSamplingMode multiSampling = + mixxx::preferences::MultiSamplingMode multiSampling = multiSamplingComboBox->currentData() - .value(); - m_pConfig->setValue( + .value(); + m_pConfig->setValue( ConfigKey(kPreferencesGroup, kMultiSamplingKey), multiSampling); #endif @@ -519,21 +517,21 @@ void DlgPrefInterface::slotApply() { } void DlgPrefInterface::loadTooltipPreferenceFromConfig() { - const auto tooltipMode = - m_pConfig->getValue(ConfigKey(kControlsGroup, kTooltipsKey), + const auto tooltipMode = m_pConfig->getValue( + ConfigKey(kControlsGroup, kTooltipsKey), #ifdef Q_OS_IOS - constants::Tooltips::Off); + mixxx::preferences::Tooltips::Off); #else - constants::Tooltips::On); + mixxx::preferences::Tooltips::On); #endif switch (tooltipMode) { - case constants::Tooltips::Off: + case mixxx::preferences::Tooltips::Off: radioButtonTooltipsOff->setChecked(true); break; - case constants::Tooltips::OnlyInLibrary: + case mixxx::preferences::Tooltips::OnlyInLibrary: radioButtonTooltipsLibrary->setChecked(true); break; - case constants::Tooltips::On: + case mixxx::preferences::Tooltips::On: default: radioButtonTooltipsLibraryAndSkin->setChecked(true); break; diff --git a/src/preferences/dialog/dlgprefinterface.h b/src/preferences/dialog/dlgprefinterface.h index 3744b81a770..b2c7fcb0d6c 100644 --- a/src/preferences/dialog/dlgprefinterface.h +++ b/src/preferences/dialog/dlgprefinterface.h @@ -45,7 +45,7 @@ class DlgPrefInterface : public DlgPreferencePage, public Ui::DlgPrefControlsDlg signals: void reloadUserInterface(); void menuBarAutoHideChanged(); - void tooltipModeChanged(mixxx::preferences::constants::Tooltips tooltipMode); + void tooltipModeChanged(mixxx::preferences::Tooltips tooltipMode); private: void notifyRebootNecessary(); @@ -69,10 +69,10 @@ class DlgPrefInterface : public DlgPreferencePage, public Ui::DlgPrefControlsDlg QString m_colorScheme; QString m_colorSchemeOnUpdate; QString m_localeOnUpdate; - mixxx::preferences::constants::MultiSamplingMode m_multiSampling; - mixxx::preferences::constants::Tooltips m_tooltipMode; + mixxx::preferences::MultiSamplingMode m_multiSampling; + mixxx::preferences::Tooltips m_tooltipMode; double m_dScaleFactor; double m_minScaleFactor; double m_dDevicePixelRatio; - mixxx::preferences::constants::ScreenSaver m_screensaverMode; + mixxx::preferences::ScreenSaver m_screensaverMode; }; diff --git a/src/qml/qmlconfigproxy.cpp b/src/qml/qmlconfigproxy.cpp index 703cdb43cce..091d4e34829 100644 --- a/src/qml/qmlconfigproxy.cpp +++ b/src/qml/qmlconfigproxy.cpp @@ -39,7 +39,7 @@ QVariantList QmlConfigProxy::getTrackColorPalette() { int QmlConfigProxy::getMultiSamplingLevel() { return static_cast(m_pConfig->getValue( ConfigKey(kPreferencesGroup, kMultiSamplingKey), - mixxx::preferences::constants::MultiSamplingMode::Disabled)); + mixxx::preferences::MultiSamplingMode::Disabled)); } // static diff --git a/src/util/screensavermanager.cpp b/src/util/screensavermanager.cpp index 62699876976..582c0ec1eb9 100644 --- a/src/util/screensavermanager.cpp +++ b/src/util/screensavermanager.cpp @@ -9,26 +9,26 @@ ScreensaverManager::ScreensaverManager(UserSettingsPointer pConfig, QObject* pPa : QObject(pParent), m_pConfig(pConfig) { m_inhibitScreensaver = pConfig->getValue(ConfigKey("[Config]", "InhibitScreensaver"), - mixxx::preferences::constants::ScreenSaver::On); + mixxx::preferences::ScreenSaver::On); pConfig->setValue(ConfigKey("[Config]", "InhibitScreensaver"), m_inhibitScreensaver); - if (m_inhibitScreensaver == mixxx::preferences::constants::ScreenSaver::On) { + if (m_inhibitScreensaver == mixxx::preferences::ScreenSaver::On) { mixxx::ScreenSaverHelper::inhibit(); } } ScreensaverManager::~ScreensaverManager() { - if (m_inhibitScreensaver != mixxx::preferences::constants::ScreenSaver::Off) { + if (m_inhibitScreensaver != mixxx::preferences::ScreenSaver::Off) { mixxx::ScreenSaverHelper::uninhibit(); } } -void ScreensaverManager::setStatus(mixxx::preferences::constants::ScreenSaver newInhibit) { - if (m_inhibitScreensaver != mixxx::preferences::constants::ScreenSaver::Off) { +void ScreensaverManager::setStatus(mixxx::preferences::ScreenSaver newInhibit) { + if (m_inhibitScreensaver != mixxx::preferences::ScreenSaver::Off) { mixxx::ScreenSaverHelper::uninhibit(); } - if (newInhibit == mixxx::preferences::constants::ScreenSaver::On || - (newInhibit == mixxx::preferences::constants::ScreenSaver::OnPlay && + if (newInhibit == mixxx::preferences::ScreenSaver::On || + (newInhibit == mixxx::preferences::ScreenSaver::OnPlay && PlayerInfo::instance().getCurrentPlayingDeck() != -1)) { mixxx::ScreenSaverHelper::inhibit(); } @@ -37,7 +37,7 @@ void ScreensaverManager::setStatus(mixxx::preferences::constants::ScreenSaver ne } void ScreensaverManager::slotCurrentPlayingDeckChanged(int deck) { - if (m_inhibitScreensaver != mixxx::preferences::constants::ScreenSaver::OnPlay) { + if (m_inhibitScreensaver != mixxx::preferences::ScreenSaver::OnPlay) { return; } if (deck == -1) { diff --git a/src/util/screensavermanager.h b/src/util/screensavermanager.h index 0ddc8427bbb..b52a0dc43d5 100644 --- a/src/util/screensavermanager.h +++ b/src/util/screensavermanager.h @@ -13,9 +13,9 @@ class ScreensaverManager : public QObject { ScreensaverManager(UserSettingsPointer pConfig, QObject* pParent = nullptr); ~ScreensaverManager(); - void setStatus(mixxx::preferences::constants::ScreenSaver status); + void setStatus(mixxx::preferences::ScreenSaver status); - mixxx::preferences::constants::ScreenSaver status() { + mixxx::preferences::ScreenSaver status() { return m_inhibitScreensaver; } public slots: @@ -23,7 +23,7 @@ class ScreensaverManager : public QObject { private: const UserSettingsPointer m_pConfig; - mixxx::preferences::constants::ScreenSaver m_inhibitScreensaver; + mixxx::preferences::ScreenSaver m_inhibitScreensaver; }; } // namespace mixxx