diff --git a/src/mixxxmainwindow.cpp b/src/mixxxmainwindow.cpp index 03789c83bfb0..e03dcbb772d7 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::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::Tooltips::On); #ifdef MIXXX_USE_QOPENGL ToolTipQOpenGL::singleton().setActive( - m_toolTipsCfg == mixxx::preferences::constants::Tooltips::On); + m_toolTipsCfg == mixxx::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::Tooltips tt) { m_toolTipsCfg = tt; #ifdef MIXXX_USE_QOPENGL ToolTipQOpenGL::singleton().setActive( - m_toolTipsCfg == mixxx::preferences::constants::Tooltips::On); + m_toolTipsCfg == mixxx::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::Tooltips::OnlyInLibrary: if (dynamic_cast(obj) != nullptr) { return true; } break; - case mixxx::preferences::constants::Tooltips::On: + case mixxx::Tooltips::On: break; - case mixxx::preferences::constants::Tooltips::Off: + case mixxx::Tooltips::Off: return true; default: DEBUG_ASSERT(!"m_toolTipsCfg value unknown"); diff --git a/src/mixxxmainwindow.h b/src/mixxxmainwindow.h index d4011cb0efa1..d0b0f8952bef 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::ScreenSaver inhibit); + mixxx::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::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::Tooltips m_toolTipsCfg; - mixxx::preferences::constants::ScreenSaver m_inhibitScreensaver; + mixxx::ScreenSaver m_inhibitScreensaver; QSet m_skinCreatedControls; }; diff --git a/src/preferences/constants.h b/src/preferences/constants.h index 7daab422f9ce..6666785b59d1 100644 --- a/src/preferences/constants.h +++ b/src/preferences/constants.h @@ -5,9 +5,9 @@ namespace mixxx { -namespace preferences { +inline 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 b9a3227bf4d4..828af871c27a 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::Tooltips tooltipMode); void menuBarAutoHideChanged(); protected: diff --git a/src/preferences/dialog/dlgprefinterface.cpp b/src/preferences/dialog/dlgprefinterface.cpp index 3c171e702aec..3f9ab8385070 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::ScreenSaver::Off)); comboBoxScreensaver->addItem(tr("Prevent screensaver from running"), - QVariant::fromValue((constants::ScreenSaver::On))); + QVariant::fromValue((mixxx::ScreenSaver::On))); comboBoxScreensaver->addItem(tr("Prevent screensaver while playing"), - QVariant::fromValue(constants::ScreenSaver::OnPlay)); + QVariant::fromValue(mixxx::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::MultiSamplingMode::Disabled)); multiSamplingComboBox->addItem(tr("2x MSAA"), - QVariant::fromValue(constants::MultiSamplingMode::Two)); + QVariant::fromValue(mixxx::MultiSamplingMode::Two)); multiSamplingComboBox->addItem(tr("4x MSAA"), - QVariant::fromValue(constants::MultiSamplingMode::Four)); + QVariant::fromValue(mixxx::MultiSamplingMode::Four)); multiSamplingComboBox->addItem(tr("8x MSAA"), - QVariant::fromValue(constants::MultiSamplingMode::Eight)); + QVariant::fromValue(mixxx::MultiSamplingMode::Eight)); multiSamplingComboBox->addItem(tr("16x MSAA"), - QVariant::fromValue(constants::MultiSamplingMode::Sixteen)); + QVariant::fromValue(mixxx::MultiSamplingMode::Sixteen)); - m_multiSampling = m_pConfig->getValue( + m_multiSampling = m_pConfig->getValue( ConfigKey(kPreferencesGroup, kMultiSamplingKey), - constants::MultiSamplingMode::Four); + mixxx::MultiSamplingMode::Four); int multiSamplingIndex = multiSamplingComboBox->findData( QVariant::fromValue((m_multiSampling))); if (multiSamplingIndex != -1) { @@ -215,7 +213,7 @@ DlgPrefInterface::DlgPrefInterface( } else { multiSamplingComboBox->setCurrentIndex(0); // Disabled m_pConfig->setValue(ConfigKey(kPreferencesGroup, kMultiSamplingKey), - constants::MultiSamplingMode::Disabled); + mixxx::MultiSamplingMode::Disabled); } } else #endif @@ -354,12 +352,12 @@ void DlgPrefInterface::slotResetToDefaults() { // Inhibit the screensaver comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( - QVariant::fromValue(constants::ScreenSaver::On))); + QVariant::fromValue(mixxx::ScreenSaver::On))); #ifdef MIXXX_USE_QML multiSamplingComboBox->setCurrentIndex( multiSamplingComboBox->findData(QVariant::fromValue( - constants::MultiSamplingMode::Four))); // 4x MSAA + mixxx::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::Tooltips::On; if (radioButtonTooltipsOff->isChecked()) { - m_tooltipMode = constants::Tooltips::Off; + m_tooltipMode = mixxx::Tooltips::Off; } else if (radioButtonTooltipsLibrary->isChecked()) { - m_tooltipMode = constants::Tooltips::OnlyInLibrary; + m_tooltipMode = mixxx::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::MultiSamplingMode multiSampling = multiSamplingComboBox->currentData() - .value(); - m_pConfig->setValue( + .value(); + m_pConfig->setValue( ConfigKey(kPreferencesGroup, kMultiSamplingKey), multiSampling); #endif @@ -520,20 +518,20 @@ void DlgPrefInterface::slotApply() { void DlgPrefInterface::loadTooltipPreferenceFromConfig() { const auto tooltipMode = - m_pConfig->getValue(ConfigKey(kControlsGroup, kTooltipsKey), + m_pConfig->getValue(ConfigKey(kControlsGroup, kTooltipsKey), #ifdef Q_OS_IOS - constants::Tooltips::Off); + mixxx::Tooltips::Off); #else - constants::Tooltips::On); + mixxx::Tooltips::On); #endif switch (tooltipMode) { - case constants::Tooltips::Off: + case mixxx::Tooltips::Off: radioButtonTooltipsOff->setChecked(true); break; - case constants::Tooltips::OnlyInLibrary: + case mixxx::Tooltips::OnlyInLibrary: radioButtonTooltipsLibrary->setChecked(true); break; - case constants::Tooltips::On: + case mixxx::Tooltips::On: default: radioButtonTooltipsLibraryAndSkin->setChecked(true); break; diff --git a/src/preferences/dialog/dlgprefinterface.h b/src/preferences/dialog/dlgprefinterface.h index 3744b81a770f..87016a62382a 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::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::MultiSamplingMode m_multiSampling; + mixxx::Tooltips m_tooltipMode; double m_dScaleFactor; double m_minScaleFactor; double m_dDevicePixelRatio; - mixxx::preferences::constants::ScreenSaver m_screensaverMode; + mixxx::ScreenSaver m_screensaverMode; }; diff --git a/src/qml/qmlconfigproxy.cpp b/src/qml/qmlconfigproxy.cpp index 703cdb43cce3..811696faa3ef 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::MultiSamplingMode::Disabled)); } // static diff --git a/src/util/screensavermanager.cpp b/src/util/screensavermanager.cpp index 626998769760..3ed68ad5d8be 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::ScreenSaver::On); pConfig->setValue(ConfigKey("[Config]", "InhibitScreensaver"), m_inhibitScreensaver); - if (m_inhibitScreensaver == mixxx::preferences::constants::ScreenSaver::On) { + if (m_inhibitScreensaver == mixxx::ScreenSaver::On) { mixxx::ScreenSaverHelper::inhibit(); } } ScreensaverManager::~ScreensaverManager() { - if (m_inhibitScreensaver != mixxx::preferences::constants::ScreenSaver::Off) { + if (m_inhibitScreensaver != mixxx::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::ScreenSaver newInhibit) { + if (m_inhibitScreensaver != mixxx::ScreenSaver::Off) { mixxx::ScreenSaverHelper::uninhibit(); } - if (newInhibit == mixxx::preferences::constants::ScreenSaver::On || - (newInhibit == mixxx::preferences::constants::ScreenSaver::OnPlay && + if (newInhibit == mixxx::ScreenSaver::On || + (newInhibit == mixxx::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::ScreenSaver::OnPlay) { return; } if (deck == -1) { diff --git a/src/util/screensavermanager.h b/src/util/screensavermanager.h index 0ddc8427bbb6..cf613bbe8ffc 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::ScreenSaver status); - mixxx::preferences::constants::ScreenSaver status() { + mixxx::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::ScreenSaver m_inhibitScreensaver; }; } // namespace mixxx