Added new option "--no-splash" to suppress the "splash" screen. This won't speed up the application startup, because the same initialization work still needs to be performed.

This commit is contained in:
LoRd_MuldeR 2020-03-28 14:38:52 +01:00
parent 717ad7140b
commit 1563ed5c69
3 changed files with 15 additions and 4 deletions

View File

@ -113,14 +113,19 @@ static int lamexp_initialize_ipc(MUtils::IPCChannel *const ipcChannel)
return 1; return 1;
} }
static void lamexp_show_splash(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, SettingsModel *const settingsModel) static void initialize_lamexp(const MUtils::OS::ArgumentMap &arguments, const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, SettingsModel *const settingsModel)
{ {
QScopedPointer<InitializationThread> poInitializationThread(new InitializationThread(cpuFeatures)); QScopedPointer<InitializationThread> poInitializationThread(new InitializationThread(cpuFeatures));
if (arguments.contains("no-splash"))
{
poInitializationThread->runSyncronized();
return;
}
SplashScreen::showSplash(poInitializationThread.data()); SplashScreen::showSplash(poInitializationThread.data());
settingsModel->slowStartup(poInitializationThread->getSlowIndicator()); settingsModel->slowStartup(poInitializationThread->getSlowIndicator());
} }
static int lamexp_main_loop(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtils::IPCChannel *const ipcChannel, int &iShutdown) static int lamexp_main_loop(const MUtils::OS::ArgumentMap &arguments, const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtils::IPCChannel *const ipcChannel, int &iShutdown)
{ {
int iResult = -1; int iResult = -1;
bool bAccepted = true; bool bAccepted = true;
@ -131,7 +136,7 @@ static int lamexp_main_loop(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures,
QScopedPointer<SettingsModel> settingsModel(new SettingsModel() ); QScopedPointer<SettingsModel> settingsModel(new SettingsModel() );
//Show splash screen //Show splash screen
lamexp_show_splash(cpuFeatures, settingsModel.data()); initialize_lamexp(arguments, cpuFeatures, settingsModel.data());
//Validate settings //Validate settings
settingsModel->validate(); settingsModel->validate();
@ -260,7 +265,7 @@ static int lamexp_main(int &argc, char **argv)
} }
//Main application loop //Main application loop
iResult = lamexp_main_loop(cpuFeatures, ipcChannel.data(), iShutdown); iResult = lamexp_main_loop(arguments, cpuFeatures, ipcChannel.data(), iShutdown);
//Final clean-up //Final clean-up
qDebug("Shutting down, please wait...\n"); qDebug("Shutting down, please wait...\n");

View File

@ -825,6 +825,11 @@ void InitializationThread::selfTest(void)
} }
} }
void InitializationThread::runSyncronized(void)
{
run();
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// EVENTS // EVENTS
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -45,6 +45,7 @@ public:
bool getSuccess(void) { return !isRunning() && m_bSuccess; } bool getSuccess(void) { return !isRunning() && m_bSuccess; }
bool getSlowIndicator(void) { return m_slowIndicator; } bool getSlowIndicator(void) { return m_slowIndicator; }
void runSyncronized(void);
static void selfTest(void); static void selfTest(void);
protected: protected: