summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-07-23 04:47:52 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-03 11:39:03 -0500
commite29f41565fce21cd72968ac188cd319e746b10e6 (patch)
tree443513323d03016cf6eec65006e5a707ad1d79a4
parent555b2508a5a34798059af7e128f6f32fc34a4947 (diff)
fixed splash not trying the default one
-rw-r--r--src/main.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5479d5a3..08d70dd9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -165,20 +165,34 @@ QString getSplashPath(
return {};
}
+ // try splash from instance directory
const QString splashPath = dataPath + "/splash.png";
if (QFile::exists(dataPath + "/splash.png")) {
- return splashPath;
+ QImage image(splashPath);
+ if (!image.isNull()) {
+ return splashPath;
+ }
}
- // currently using MO splash, see if the plugin contains one
+ // try splash from plugin
QString pluginSplash = QString(":/%1/splash").arg(game->gameShortName());
- QImage image(pluginSplash);
+ if (QFile::exists(pluginSplash)) {
+ QImage image(pluginSplash);
+ if (!image.isNull()) {
+ image.save(splashPath);
+ return pluginSplash;
+ }
+ }
- if (image.isNull()) {
- return {};
+ // try default splash from resource
+ QString defaultSplash = ":/MO/gui/splash";
+ if (QFile::exists(defaultSplash)) {
+ QImage image(defaultSplash);
+ if (!image.isNull()) {
+ return defaultSplash;
+ }
}
- image.save(splashPath);
return splashPath;
}