From 60c86e7cee8b3accd8c9654b9a5e60d76a406923 Mon Sep 17 00:00:00 2001 From: AL <26797547+Al12rs@users.noreply.github.com> Date: Sun, 16 Feb 2020 15:40:28 +0100 Subject: Move modInfo loadFromDisc to it's own function --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 2f4c80a1..b1b5c850 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -643,6 +643,7 @@ int runApplication(MOApplication &application, SingleInstance &instance, game->gameDirectory().absolutePath()); organizer.updateExecutablesList(); + organizer.updateModInfoFromDisc(); QString selectedProfileName = determineProfile(arguments, settings); organizer.setCurrentProfile(selectedProfileName); -- cgit v1.3.1 From 112f91357e20b4a1638b6deeff1c71dfea66eb72 Mon Sep 17 00:00:00 2001 From: AL <26797547+Al12rs@users.noreply.github.com> Date: Mon, 17 Feb 2020 02:34:56 +0100 Subject: Reduce overhead introduced by splashscreen by not letting it wait on the mainwindow and instead immediately close --- src/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index b1b5c850..e9c1acd8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -734,14 +734,13 @@ 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); + // don't pass mainwindow as it just waits half a second for it + // instead of proceding + splash.finish(nullptr); res = application.exec(); mainWindow.close(); -- cgit v1.3.1 From 5043a930cedd67d8d9fde67462373ea181c30a08 Mon Sep 17 00:00:00 2001 From: AL <26797547+Al12rs@users.noreply.github.com> Date: Mon, 17 Feb 2020 03:26:47 +0100 Subject: 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. --- src/main.cpp | 42 +++++++++++++++++++++++++++--------------- src/settings.cpp | 10 ++++++++++ src/settings.h | 4 ++++ 3 files changed, 41 insertions(+), 15 deletions(-) (limited to 'src/main.cpp') 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(m_Settings, "Settings", "use_splash", true); +} + +void Settings::setUseSplash(bool b) +{ + set(m_Settings, "Settings", "use_splash", b); +} + std::optional Settings::version() const { if (auto v=getOptional(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; -- cgit v1.3.1