summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-08-01 11:13:50 +0200
committerGitHub <noreply@github.com>2020-08-01 11:13:50 +0200
commita578929a917f21a96d3e2f18111b9cf6c2d414c8 (patch)
treebe8b95b97cd4a12ee714bcf2bc214b8cea0cef8e
parent1ea7cea544fa8299582a8ea5fef548c271756609 (diff)
parent6dad4bd88529e8e9a91fa0c9ab4b4bd3dfae1b7b (diff)
Merge pull request #2978 from xerus2000/refactor-main
MixxxMainWindow: Factor out loadConfiguredSkin
-rw-r--r--src/mixxx.cpp41
-rw-r--r--src/mixxx.h3
2 files changed, 19 insertions, 25 deletions
diff --git a/src/mixxx.cpp b/src/mixxx.cpp
index cd691a9097..21d10cc41e 100644
--- a/src/mixxx.cpp
+++ b/src/mixxx.cpp
@@ -488,18 +488,7 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
qWarning() << "Failed to load default skin styles!";
}
- // Load skin to a QWidget that we set as the central widget. Assignment
- // intentional in next line.
- m_pCentralWidget = m_pSkinLoader->loadConfiguredSkin(this,
- &m_skinCreatedControls,
- m_pKeyboard,
- m_pPlayerManager,
- m_pControllerManager,
- m_pLibrary,
- m_pVCManager,
- m_pEffectsManager,
- m_pRecordingManager);
- if (!m_pCentralWidget) {
+ if (!loadConfiguredSkin()) {
reportCriticalErrorAndQuit(
"default skin cannot be loaded - see <b>mixxx</b> trace for more information");
m_pCentralWidget = oldWidget;
@@ -1438,7 +1427,7 @@ void MixxxMainWindow::rebootMixxxView() {
m_pCentralWidget->hide();
WaveformWidgetFactory::instance()->destroyWidgets();
delete m_pCentralWidget;
- m_pCentralWidget = NULL;
+ m_pCentralWidget = nullptr;
}
// Workaround for changing skins while fullscreen, just go out of fullscreen
@@ -1448,18 +1437,7 @@ void MixxxMainWindow::rebootMixxxView() {
bool wasFullScreen = isFullScreen();
slotViewFullScreen(false);
- // Load skin to a QWidget that we set as the central widget. Assignment
- // intentional in next line.
- m_pCentralWidget = m_pSkinLoader->loadConfiguredSkin(this,
- &m_skinCreatedControls,
- m_pKeyboard,
- m_pPlayerManager,
- m_pControllerManager,
- m_pLibrary,
- m_pVCManager,
- m_pEffectsManager,
- m_pRecordingManager);
- if (!m_pCentralWidget) {
+ if (!loadConfiguredSkin()) {
QMessageBox::critical(this,
tr("Error in skin file"),
tr("The selected skin cannot be loaded."));
@@ -1502,6 +1480,19 @@ void MixxxMainWindow::rebootMixxxView() {
emit skinLoaded();
}
+bool MixxxMainWindow::loadConfiguredSkin() {
+ m_pCentralWidget = m_pSkinLoader->loadConfiguredSkin(this,
+ &m_skinCreatedControls,
+ m_pKeyboard,
+ m_pPlayerManager,
+ m_pControllerManager,
+ m_pLibrary,
+ m_pVCManager,
+ m_pEffectsManager,
+ m_pRecordingManager);
+ return m_pCentralWidget != nullptr;
+}
+
bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) {
if (event->type() == QEvent::ToolTip) {
// return true for no tool tips
diff --git a/src/mixxx.h b/src/mixxx.h
index d4e1b0d665..4fa085d64e 100644
--- a/src/mixxx.h
+++ b/src/mixxx.h
@@ -111,6 +111,9 @@ class MixxxMainWindow : public QMainWindow {
bool initializeDatabase();
+ /// Load skin to a QWidget that we set as the central widget.
+ bool loadConfiguredSkin();
+
bool confirmExit();
QDialog::DialogCode soundDeviceErrorDlg(
const QString &title, const QString &text, bool* retryClicked);