summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-02-18 17:22:29 -0500
committerGitHub <noreply@github.com>2020-02-18 17:22:29 -0500
commit8c2814c9dc0d92e1ab015cde33eee8dcf880e265 (patch)
tree19b00758324fac115b466c51c3fe6f17ccd42375 /src/main.cpp
parentcfb05d72be19ce0413f1de776eb3b2c150807e83 (diff)
parent8e3ab9fb6614e93239662cab8b0bb726285a255e (diff)
Merge pull request #1000 from Al12rs/startup_performance
Startup performance
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 2f4c80a1..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");
+ }
}
}
@@ -643,6 +647,7 @@ int runApplication(MOApplication &application, SingleInstance &instance,
game->gameDirectory().absolutePath());
organizer.updateExecutablesList();
+ organizer.updateModInfoFromDisc();
QString selectedProfileName = determineProfile(arguments, settings);
organizer.setCurrentProfile(selectedProfileName);
@@ -696,12 +701,18 @@ int runApplication(MOApplication &application, SingleInstance &instance,
}
}
- QPixmap pixmap(splashPath);
- QSplashScreen splash(pixmap);
+ QPixmap pixmap;
+
+ QSplashScreen splash(nullptr);
- settings.geometry().centerOnMainWindowMonitor(&splash);
- splash.show();
- splash.activateWindow();
+ if (useSplash) {
+ pixmap = QPixmap(splashPath);
+ splash.setPixmap(pixmap);
+
+ settings.geometry().centerOnMainWindowMonitor(&splash);
+ splash.show();
+ splash.activateWindow();
+ }
QString apiKey;
if (settings.nexus().apiKey(apiKey)) {
@@ -733,14 +744,15 @@ int runApplication(MOApplication &application, SingleInstance &instance,
QObject::connect(&instance, SIGNAL(messageSent(QString)), &organizer,
SLOT(externalMessage(QString)));
- // this must be before readSettings(), see DockFixer in mainwindow.cpp
- splash.finish(&mainWindow);
-
log::debug("displaying main window");
mainWindow.show();
mainWindow.activateWindow();
-
- splash.finish(&mainWindow);
+
+ 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();