From 1563ed5c698981c6c7323f6ea89b46d4745503e4 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 28 Mar 2020 14:38:52 +0100 Subject: [PATCH] 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. --- src/Main.cpp | 13 +++++++++---- src/Thread_Initialization.cpp | 5 +++++ src/Thread_Initialization.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Main.cpp b/src/Main.cpp index 10349a67..ae3f0567 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -113,14 +113,19 @@ static int lamexp_initialize_ipc(MUtils::IPCChannel *const ipcChannel) 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 poInitializationThread(new InitializationThread(cpuFeatures)); + if (arguments.contains("no-splash")) + { + poInitializationThread->runSyncronized(); + return; + } SplashScreen::showSplash(poInitializationThread.data()); 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; bool bAccepted = true; @@ -131,7 +136,7 @@ static int lamexp_main_loop(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, QScopedPointer settingsModel(new SettingsModel() ); //Show splash screen - lamexp_show_splash(cpuFeatures, settingsModel.data()); + initialize_lamexp(arguments, cpuFeatures, settingsModel.data()); //Validate settings settingsModel->validate(); @@ -260,7 +265,7 @@ static int lamexp_main(int &argc, char **argv) } //Main application loop - iResult = lamexp_main_loop(cpuFeatures, ipcChannel.data(), iShutdown); + iResult = lamexp_main_loop(arguments, cpuFeatures, ipcChannel.data(), iShutdown); //Final clean-up qDebug("Shutting down, please wait...\n"); diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index 9ef15260..0ecc0af4 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -825,6 +825,11 @@ void InitializationThread::selfTest(void) } } +void InitializationThread::runSyncronized(void) +{ + run(); +} + //////////////////////////////////////////////////////////// // EVENTS //////////////////////////////////////////////////////////// diff --git a/src/Thread_Initialization.h b/src/Thread_Initialization.h index d225029a..73ca2c6a 100644 --- a/src/Thread_Initialization.h +++ b/src/Thread_Initialization.h @@ -45,6 +45,7 @@ public: bool getSuccess(void) { return !isRunning() && m_bSuccess; } bool getSlowIndicator(void) { return m_slowIndicator; } + void runSyncronized(void); static void selfTest(void); protected: