diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 42 | ||||
| -rw-r--r-- | src/settings.cpp | 10 | ||||
| -rw-r--r-- | src/settings.h | 4 |
3 files changed, 41 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp index e9c1acd8..4b291e75 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -596,13 +596,17 @@ int runApplication(MOApplication &application, SingleInstance &instance, checkPathsForSanity(*game, settings); - if (splashPath.startsWith(':')) { - // currently using MO splash, see if the plugin contains one - QString pluginSplash + bool useSplash = settings.useSplash(); + + if (useSplash) { + if (splashPath.startsWith(':')) { + // currently using MO splash, see if the plugin contains one + QString pluginSplash = QString(":/%1/splash").arg(game->gameShortName()); - QImage image(pluginSplash); - if (!image.isNull()) { - image.save(dataPath + "/splash.png"); + QImage image(pluginSplash); + if (!image.isNull()) { + image.save(dataPath + "/splash.png"); + } } } @@ -697,12 +701,18 @@ int runApplication(MOApplication &application, SingleInstance &instance, } } - QPixmap pixmap(splashPath); - QSplashScreen splash(pixmap); + QPixmap pixmap; + + QSplashScreen splash(nullptr); + + if (useSplash) { + pixmap = QPixmap(splashPath); + splash.setPixmap(pixmap); - settings.geometry().centerOnMainWindowMonitor(&splash); - splash.show(); - splash.activateWindow(); + settings.geometry().centerOnMainWindowMonitor(&splash); + splash.show(); + splash.activateWindow(); + } QString apiKey; if (settings.nexus().apiKey(apiKey)) { @@ -737,10 +747,12 @@ int runApplication(MOApplication &application, SingleInstance &instance, log::debug("displaying main window"); mainWindow.show(); mainWindow.activateWindow(); - - // don't pass mainwindow as it just waits half a second for it - // instead of proceding - splash.finish(nullptr); + + if (useSplash) { + // don't pass mainwindow as it just waits half a second for it + // instead of proceding + splash.finish(nullptr); + } res = application.exec(); mainWindow.close(); diff --git a/src/settings.cpp b/src/settings.cpp index eff68aca..4431e7d9 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -199,6 +199,16 @@ void Settings::setUsePrereleases(bool b) set(m_Settings, "Settings", "use_prereleases", b); } +bool Settings::useSplash() const +{ + return get<bool>(m_Settings, "Settings", "use_splash", true); +} + +void Settings::setUseSplash(bool b) +{ + set(m_Settings, "Settings", "use_splash", b); +} + std::optional<QVersionNumber> Settings::version() const { if (auto v=getOptional<QString>(m_Settings, "General", "version")) { diff --git a/src/settings.h b/src/settings.h index 0e5238b1..678226c1 100644 --- a/src/settings.h +++ b/src/settings.h @@ -720,6 +720,10 @@ public: bool usePrereleases() const; void setUsePrereleases(bool b); + // whether to use spascreen or not + // + bool useSplash() const; + void setUseSplash(bool b); GameSettings& game(); const GameSettings& game() const; |
