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

MixxxMainWindow: Factor out loadConfiguredSkin #2978

Merged
merged 1 commit into from
Aug 1, 2020
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
41 changes: 16 additions & 25 deletions src/mixxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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."));
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/mixxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down