feat(cpn): Show splash screen after main window - resolves delay and position save issues on MacOS (#3210)
- Don't create splash objects unless needed - Show main window before showing splash (fixes MacOS issues) - Delay showing splash until app.exec() started (fixes MacOS issues)
This commit is contained in:
+10
-13
@@ -240,27 +240,24 @@ int main(int argc, char *argv[])
|
||||
profile.fwName("");
|
||||
}
|
||||
|
||||
QString splashScreen;
|
||||
splashScreen = ":/images/splash.png";
|
||||
|
||||
QPixmap pixmap = QPixmap(splashScreen);
|
||||
QSplashScreen *splash = new QSplashScreen(pixmap);
|
||||
|
||||
Firmware::setCurrentVariant(Firmware::getFirmwareForId(g.profile[g.id()].fwType()));
|
||||
|
||||
MainWindow *mainWin = new MainWindow();
|
||||
mainWin->show();
|
||||
|
||||
if (g.showSplash()) {
|
||||
splash->show();
|
||||
QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
|
||||
QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show()));
|
||||
}
|
||||
else {
|
||||
mainWin->show();
|
||||
QSplashScreen *splash = new QSplashScreen(QPixmap(":/images/splash.png"));
|
||||
QTimer::singleShot(1, [=] {
|
||||
splash->show();
|
||||
});
|
||||
QTimer::singleShot(1000*SPLASH_TIME, [=] {
|
||||
splash->close();
|
||||
delete splash;
|
||||
});
|
||||
}
|
||||
|
||||
int result = app.exec();
|
||||
|
||||
delete splash;
|
||||
delete mainWin;
|
||||
|
||||
SimulatorLoader::unregisterSimulators();
|
||||
|
||||
Reference in New Issue
Block a user