Added optional compile time option to build in a splash screen during Qt application startup.

This commit is contained in:
mjbudd77 2022-01-15 18:17:34 -05:00
parent 7cc15b41c3
commit 77c946734a
1 changed files with 20 additions and 1 deletions

View File

@ -20,6 +20,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <QApplication> #include <QApplication>
#include <QSplashScreen>
//#include <QProxyStyle> //#include <QProxyStyle>
#include "Qt/ConsoleWindow.h" #include "Qt/ConsoleWindow.h"
@ -80,13 +81,24 @@ static void MessageOutput(QtMsgType type, const QMessageLogContext &context, con
#undef main // undef main in case SDL_Main #undef main // undef main in case SDL_Main
//#define SPLASH_SCREEN_ENABLE
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int retval; int retval;
qInstallMessageHandler(MessageOutput); qInstallMessageHandler(MessageOutput);
QApplication app(argc, argv); QApplication app(argc, argv);
//const char *styleSheetEnv = NULL; #ifdef SPLASH_SCREEN_ENABLE
QSplashScreen *splash;
QPixmap pixmap(":/fceux1.png");
splash = new QSplashScreen( pixmap );
splash->show();
splash->showMessage("Initializing GUI...");
app.processEvents();
#endif
QCoreApplication::setOrganizationName("TasVideos"); QCoreApplication::setOrganizationName("TasVideos");
QCoreApplication::setOrganizationDomain("TasVideos.org"); QCoreApplication::setOrganizationDomain("TasVideos.org");
QCoreApplication::setApplicationName("fceux"); QCoreApplication::setApplicationName("fceux");
@ -135,6 +147,13 @@ int main( int argc, char *argv[] )
// https://doc.qt.io/qt-5/windows-issues.html#fullscreen-opengl-based-windows // https://doc.qt.io/qt-5/windows-issues.html#fullscreen-opengl-based-windows
QWindowsWindowFunctions::setHasBorderInFullScreen( consoleWindow->windowHandle(), true); QWindowsWindowFunctions::setHasBorderInFullScreen( consoleWindow->windowHandle(), true);
#endif #endif
#ifdef SPLASH_SCREEN_ENABLE
splash->finish( consoleWindow );
delete splash;
#endif
retval = app.exec(); retval = app.exec();
//printf("App Return: %i \n", retval ); //printf("App Return: %i \n", retval );