summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAL <26797547+Al12rs@users.noreply.github.com>2020-02-17 03:26:47 +0100
committerAL <26797547+Al12rs@users.noreply.github.com>2020-02-17 03:26:47 +0100
commit5043a930cedd67d8d9fde67462373ea181c30a08 (patch)
tree02222e20c5db1940c205eb4f6b7bd860d83cf140 /src/main.cpp
parent112f91357e20b4a1638b6deeff1c71dfea66eb72 (diff)
Add setting to disable splash since it can cause load time increase
use_spash=true by default. It's not exposed to the ui for now.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp42
1 files changed, 27 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();