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("");
|
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()));
|
Firmware::setCurrentVariant(Firmware::getFirmwareForId(g.profile[g.id()].fwType()));
|
||||||
|
|
||||||
MainWindow *mainWin = new MainWindow();
|
MainWindow *mainWin = new MainWindow();
|
||||||
|
mainWin->show();
|
||||||
|
|
||||||
if (g.showSplash()) {
|
if (g.showSplash()) {
|
||||||
splash->show();
|
QSplashScreen *splash = new QSplashScreen(QPixmap(":/images/splash.png"));
|
||||||
QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
|
QTimer::singleShot(1, [=] {
|
||||||
QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show()));
|
splash->show();
|
||||||
}
|
});
|
||||||
else {
|
QTimer::singleShot(1000*SPLASH_TIME, [=] {
|
||||||
mainWin->show();
|
splash->close();
|
||||||
|
delete splash;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = app.exec();
|
int result = app.exec();
|
||||||
|
|
||||||
delete splash;
|
|
||||||
delete mainWin;
|
delete mainWin;
|
||||||
|
|
||||||
SimulatorLoader::unregisterSimulators();
|
SimulatorLoader::unregisterSimulators();
|
||||||
|
|||||||
Reference in New Issue
Block a user