Skip to content
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

Fix separation of MixxxMainWindow and CoreServices #3854

Merged
merged 1 commit into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/coreservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ void CoreServices::initialize(QApplication* pApp) {

FontUtils::initializeFonts(resourcePath); // takes a long time

// Set the visibility of tooltips, default "1" = ON
m_toolTipsCfg = static_cast<mixxx::TooltipsPreference>(
pConfig->getValue(ConfigKey("[Controls]", "Tooltips"),
static_cast<int>(mixxx::TooltipsPreference::TOOLTIPS_ON)));

emit initializationProgressUpdate(10, tr("database"));
m_pDbConnectionPool = MixxxDb(pConfig).connectionPool();
if (!m_pDbConnectionPool) {
Expand Down Expand Up @@ -311,17 +306,6 @@ void CoreServices::initialize(QApplication* pApp) {
qDebug() << "Creating ControllerManager";
m_pControllerManager = std::make_shared<ControllerManager>(pConfig);

// Inhibit the screensaver if the option is set. (Do it before creating the preferences dialog)
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();
}

// Wait until all other ControlObjects are set up before initializing
// controllers
m_pControllerManager->setUpDevices();
Expand Down Expand Up @@ -470,10 +454,6 @@ void CoreServices::shutdown() {
Timer t("CoreServices::shutdown");
t.start();

if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) {
mixxx::ScreenSaverHelper::uninhibit();
}

// Stop all pending library operations
qDebug() << t.elapsed(false).debugMillisWithUnit() << "stopping pending Library tasks";
m_pTrackCollectionManager->stopLibraryScan();
Expand Down
6 changes: 0 additions & 6 deletions src/coreservices.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,8 @@ class CoreServices : public QObject {

std::unique_ptr<ControlPushButton> m_pTouchShift;

TooltipsPreference m_toolTipsCfg;

Timer m_runtime_timer;
const CmdlineArgs& m_cmdlineArgs;

ScreenSaverPreference m_inhibitScreensaver;

QSet<ControlObject*> m_skinCreatedControls;
};

} // namespace mixxx
26 changes: 22 additions & 4 deletions src/mixxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ MixxxMainWindow::MixxxMainWindow(
#ifdef __ENGINEPRIME__
m_pLibraryExporter(nullptr),
#endif
m_toolTipsCfg(mixxx::TooltipsPreference::TOOLTIPS_ON),
m_pTouchShift(nullptr) {
m_toolTipsCfg(mixxx::TooltipsPreference::TOOLTIPS_ON) {
DEBUG_ASSERT(pApp);
DEBUG_ASSERT(pCoreServices);
m_pCoreServices->initializeSettings();
Expand Down Expand Up @@ -131,8 +130,25 @@ 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);

// Set the visibility of tooltips, default "1" = ON
m_toolTipsCfg = static_cast<mixxx::TooltipsPreference>(
pConfig->getValue(ConfigKey("[Controls]", "Tooltips"),
static_cast<int>(mixxx::TooltipsPreference::TOOLTIPS_ON)));

#ifdef __ENGINEPRIME__
// Initialise library exporter
// This has to be done before switching to fullscreen
Expand Down Expand Up @@ -414,13 +430,15 @@ MixxxMainWindow::~MixxxMainWindow() {
qDebug() << t.elapsed(false).debugMillisWithUnit() << "deleting DlgPreferences";
delete m_pPrefDlg;

delete m_pTouchShift;

WaveformWidgetFactory::destroy();

delete m_pGuiTick;
delete m_pVisualsManager;

if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) {
mixxx::ScreenSaverHelper::uninhibit();
}

m_pCoreServices->shutdown();
}

Expand Down
11 changes: 0 additions & 11 deletions src/mixxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,16 @@
#include "util/parented_ptr.h"
#include "util/timer.h"

class BroadcastManager;
class ChannelHandleFactory;
class ControllerManager;
class ControlPushButton;
class DlgDeveloperTools;
class DlgPreferences;
class DlgKeywheel;
class EffectsManager;
class EngineMaster;
class GuiTick;
class KeyboardEventFilter;
class LaunchImage;
class Library;
class PlayerManager;
class RecordingManager;
class SettingsManager;
class SkinLoader;
class SoundManager;
class TrackCollectionManager;
class VinylControlManager;
class VisualsManager;
class WMainMenuBar;

Expand Down Expand Up @@ -144,7 +134,6 @@ class MixxxMainWindow : public QMainWindow {

mixxx::TooltipsPreference m_toolTipsCfg;

ControlPushButton* m_pTouchShift;
mixxx::ScreenSaverPreference m_inhibitScreensaver;

QSet<ControlObject*> m_skinCreatedControls;
Expand Down