summaryrefslogtreecommitdiffstats
path: root/src/mixxxmainwindow.cpp
diff options
context:
space:
mode:
authorJan Holthuis <jholthuis@mixxx.org>2021-07-16 10:48:19 +0200
committerJan Holthuis <jholthuis@mixxx.org>2021-07-16 12:40:24 +0200
commit6cf01185aaa77a52f19ad1bc299bfd6824e640bd (patch)
tree8eec9f779bd269f0ea93f2a3c983e853db789a7d /src/mixxxmainwindow.cpp
parent82f8c78464ff42796c9e6f50a376c1235871540c (diff)
MixxxMainWindow: Move screensaver inhibitor code into CoreServices
Diffstat (limited to 'src/mixxxmainwindow.cpp')
-rw-r--r--src/mixxxmainwindow.cpp62
1 files changed, 3 insertions, 59 deletions
diff --git a/src/mixxxmainwindow.cpp b/src/mixxxmainwindow.cpp
index dd9647ecf1..fe8baeccee 100644
--- a/src/mixxxmainwindow.cpp
+++ b/src/mixxxmainwindow.cpp
@@ -130,20 +130,10 @@ MixxxMainWindow::MixxxMainWindow(
this,
&MixxxMainWindow::initializationProgressUpdate);
- // Inhibit the screensaver if the option is set. (Do it before creating the preferences dialog)
- UserSettingsPointer pConfig = m_pCoreServices->getSettings();
- int inhibit = pConfig->getValue<int>(ConfigKey("[Config]", "InhibitScreensaver"), -1);
- if (inhibit == -1) {
- inhibit = static_cast<int>(mixxx::ScreenSaverPreference::PREVENT_ON);
- pConfig->setValue<int>(ConfigKey("[Config]", "InhibitScreensaver"), inhibit);
- }
- m_inhibitScreensaver = static_cast<mixxx::ScreenSaverPreference>(inhibit);
- if (m_inhibitScreensaver == mixxx::ScreenSaverPreference::PREVENT_ON) {
- mixxx::ScreenSaverHelper::inhibit();
- }
-
m_pCoreServices->initialize(pApp);
+ UserSettingsPointer pConfig = m_pCoreServices->getSettings();
+
// Set the visibility of tooltips, default "1" = ON
m_toolTipsCfg = static_cast<mixxx::TooltipsPreference>(
pConfig->getValue(ConfigKey("[Controls]", "Tooltips"),
@@ -230,6 +220,7 @@ MixxxMainWindow::MixxxMainWindow(
// Initialize preference dialog
m_pPrefDlg = new DlgPreferences(
this,
+ m_pCoreServices->getScreensaverManager(),
m_pSkinLoader,
m_pCoreServices->getSoundManager(),
m_pCoreServices->getPlayerManager(),
@@ -346,20 +337,12 @@ MixxxMainWindow::MixxxMainWindow(
&PlayerInfo::currentPlayingTrackChanged,
this,
&MixxxMainWindow::slotUpdateWindowTitle);
- connect(&PlayerInfo::instance(),
- &PlayerInfo::currentPlayingDeckChanged,
- this,
- &MixxxMainWindow::slotChangedPlayingDeck);
}
MixxxMainWindow::~MixxxMainWindow() {
Timer t("~MixxxMainWindow");
t.start();
- if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) {
- mixxx::ScreenSaverHelper::uninhibit();
- }
-
// Save the current window state (position, maximized, etc)
// Note(ronso0): Unfortunately saveGeometry() also stores the fullscreen state.
// On next start restoreGeometry would enable fullscreen mode even though that
@@ -440,10 +423,6 @@ MixxxMainWindow::~MixxxMainWindow() {
delete m_pGuiTick;
delete m_pVisualsManager;
- if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) {
- mixxx::ScreenSaverHelper::uninhibit();
- }
-
m_pCoreServices->shutdown();
}
@@ -985,17 +964,6 @@ void MixxxMainWindow::slotNoAuxiliaryInputConfigured() {
}
}
-void MixxxMainWindow::slotChangedPlayingDeck(int deck) {
- if (m_inhibitScreensaver == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) {
- if (deck==-1) {
- // If no deck is playing, allow the screensaver to run.
- mixxx::ScreenSaverHelper::uninhibit();
- } else {
- mixxx::ScreenSaverHelper::inhibit();
- }
- }
-}
-
void MixxxMainWindow::slotHelpAbout() {
DlgAbout* about = new DlgAbout(this);
about->show();
@@ -1219,30 +1187,6 @@ bool MixxxMainWindow::confirmExit() {
return true;
}
-void MixxxMainWindow::setInhibitScreensaver(mixxx::ScreenSaverPreference newInhibit)
-{
- UserSettingsPointer pConfig = m_pCoreServices->getSettings();
-
- if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) {
- mixxx::ScreenSaverHelper::uninhibit();
- }
-
- if (newInhibit == mixxx::ScreenSaverPreference::PREVENT_ON) {
- mixxx::ScreenSaverHelper::inhibit();
- } else if (newInhibit == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY
- && PlayerInfo::instance().getCurrentPlayingDeck()!=-1) {
- mixxx::ScreenSaverHelper::inhibit();
- }
- int inhibit_int = static_cast<int>(newInhibit);
- pConfig->setValue<int>(ConfigKey("[Config]","InhibitScreensaver"), inhibit_int);
- m_inhibitScreensaver = newInhibit;
-}
-
-mixxx::ScreenSaverPreference MixxxMainWindow::getInhibitScreensaver()
-{
- return m_inhibitScreensaver;
-}
-
void MixxxMainWindow::initializationProgressUpdate(int progress, const QString& serviceName) {
if (m_pLaunchImage) {
m_pLaunchImage->progress(progress, serviceName);