From 53d978974040c34f6818e03e6dbf0d8d6f8acb3f Mon Sep 17 00:00:00 2001 From: Tannin Date: Wed, 2 Mar 2016 21:20:38 +0100 Subject: updated icon and splash screen. MO can now use custom instance specific splash screens and splashes stored in game plugins --- src/main.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index a262d031..eb3a7248 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -434,11 +434,11 @@ void setupPath() ::SetEnvironmentVariableW(L"PATH", newPath.c_str()); } - -int runApplication(MOApplication &application, SingleInstance &instance) +int runApplication(MOApplication &application, SingleInstance &instance, + const QString &splashPath) { qDebug("start main application"); - QPixmap pixmap(":/MO/gui/splash"); + QPixmap pixmap(splashPath); QSplashScreen splash(pixmap); QString dataPath = application.property("dataPath").toString(); @@ -474,6 +474,17 @@ int runApplication(MOApplication &application, SingleInstance &instance) if (game == nullptr) { return 1; } + 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"); + } else { + qDebug("no plugin splash"); + } + } organizer.setManagedGame(game); organizer.createDefaultProfile(); @@ -630,7 +641,12 @@ int main(int argc, char *argv[]) LogBuffer::init(100, QtDebugMsg, qApp->property("dataPath").toString() + "/logs/mo_interface.log"); - int result = runApplication(application, instance); + QString splash = dataPath + "/splash.png"; + if (!QFile::exists(dataPath + "/splash.png")) { + splash = ":/MO/gui/splash"; + } + + int result = runApplication(application, instance, splash); if (result != INT_MAX) { return result; -- cgit v1.3.1