diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index 58348e7db..d7231bff3 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -87,6 +87,9 @@ namespace BlackCore this->m_parser.addOptions(this->m_setupReader->getCmdLineOptions()); + // startup done + connect(this, &CApplication::startUpCompleted, this, &CApplication::ps_startupCompleted); + // notify when app goes down connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &CApplication::gracefulShutdown); } @@ -253,6 +256,11 @@ namespace BlackCore return false; } + void CApplication::signalStartupAutomatically(bool signal) + { + this->m_signalStartup = signal; + } + QString CApplication::getEnvironmentInfoString(const QString &separator) const { QString env("Beta: "); @@ -536,7 +544,15 @@ namespace BlackCore this->m_started = this->asyncWebAndContextStart(); } this->m_startUpCompleted = true; - emit this->startUpCompleted(this->m_started); + if (this->m_signalStartup) + { + emit this->startUpCompleted(this->m_started); + } + } + + void CApplication::ps_startupCompleted() + { + // void } bool CApplication::asyncWebAndContextStart() @@ -575,9 +591,9 @@ namespace BlackCore return l; } - // --------------------------------------------------------------------------------- - // Parsing - // --------------------------------------------------------------------------------- +// --------------------------------------------------------------------------------- +// Parsing +// --------------------------------------------------------------------------------- bool CApplication::addParserOption(const QCommandLineOption &option) { @@ -698,9 +714,9 @@ namespace BlackCore printf("%s %s\n", qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationVersion())); } - // --------------------------------------------------------------------------------- - // Contexts - // --------------------------------------------------------------------------------- +// --------------------------------------------------------------------------------- +// Contexts +// --------------------------------------------------------------------------------- bool CApplication::supportsContexts() const { @@ -770,9 +786,9 @@ namespace BlackCore return this->m_coreFacade->getIContextSimulator(); } - // --------------------------------------------------------------------------------- - // Setup - // --------------------------------------------------------------------------------- +// --------------------------------------------------------------------------------- +// Setup +// --------------------------------------------------------------------------------- CUrlList CApplication::getVatsimMetarUrls() const { diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 249b9bf8f..75b0eb34b 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -116,6 +116,9 @@ namespace BlackCore //! Running in dev.environment? bool isRunningInDeveloperEnvironment() const; + //! Signal startup automatically or individually + void signalStartupAutomatically(bool signal = false); + //! Info string QString getEnvironmentInfoString(const QString &separator) const; @@ -275,6 +278,9 @@ namespace BlackCore //! Setup read/syncronized void ps_setupSyncronized(bool success); + //! Startup completed + virtual void ps_startupCompleted(); + protected: //! Display help message virtual void cmdLineHelpMessage(); @@ -344,6 +350,7 @@ namespace BlackCore std::atomic m_shutdown { false }; //!< is being shutdown? bool m_useContexts = false; //!< use contexts bool m_useWebData = false; //!< use web data + bool m_signalStartup = true; //!< signal startup automatically }; } // namespace diff --git a/src/blackgui/components/maininfoareacomponent.cpp b/src/blackgui/components/maininfoareacomponent.cpp index f8aa173c7..b8bc12254 100644 --- a/src/blackgui/components/maininfoareacomponent.cpp +++ b/src/blackgui/components/maininfoareacomponent.cpp @@ -27,7 +27,7 @@ namespace BlackGui { ui->setupUi(this); CInfoArea::initInfoArea(); // init base class - this->setWindowIcon(CIcons::swift48()); + this->setWindowIcon(CIcons::swift64()); connect(this->getLogComponent(), &CLogComponent::requestAttention, this, &CMainInfoAreaComponent::selectLog); } diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index ef6da0bbb..7aa377eed 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -84,6 +84,32 @@ namespace BlackGui } } + void CGuiApplication::splashScreen(const QString &resource) + { + if (this->m_splashScreen) + { + // delete old one + this->m_splashScreen.reset(); + } + if (!resource.isEmpty()) + { + const QPixmap pm(resource); + this->splashScreen(pm); + } + } + + void CGuiApplication::splashScreen(const QPixmap &pixmap) + { + if (this->m_splashScreen) + { + // delete old one + this->m_splashScreen.reset(); + } + this->m_splashScreen.reset(new QSplashScreen(pixmap.scaled(256, 256))); + this->m_splashScreen->show(); + this->processEventsToRefreshGui(); + } + void CGuiApplication::processEventsToRefreshGui() const { QCoreApplication::processEvents(QEventLoop::AllEvents, 100); @@ -181,7 +207,7 @@ namespace BlackGui { if (CProject::isRunningOnWindowsNtPlatform()) { - const QString helpText(beautifyHelpMessageImpl(this->m_parser.helpText())); + const QString helpText(beautifyHelpMessage(this->m_parser.helpText())); QMessageBox::warning(nullptr, QGuiApplication::applicationDisplayName(), "

" + errorMessage + "

" + helpText + ""); diff --git a/src/blackgui/guiapplication.h b/src/blackgui/guiapplication.h index d457de2cf..ea5fe650e 100644 --- a/src/blackgui/guiapplication.h +++ b/src/blackgui/guiapplication.h @@ -17,6 +17,8 @@ #include "blackgui/enableforframelesswindow.h" #include "blackgui/blackguiexport.h" #include +#include +#include namespace BlackGui { @@ -54,7 +56,7 @@ namespace BlackGui static const BlackMisc::CLogCategoryList &getLogCategories(); //! Constructor - CGuiApplication(const QString &applicationName = executable(), const QPixmap &icon = BlackMisc::CIcons::swift48()); + CGuiApplication(const QString &applicationName = executable(), const QPixmap &icon = BlackMisc::CIcons::swift64()); //! Destructor virtual ~CGuiApplication(); @@ -71,7 +73,13 @@ namespace BlackGui //! Window mode (window flags) CEnableForFramelessWindow::WindowMode getWindowMode() const; - //! Allow the GUI to refresh by processing events + //! Add a splash screen based on resource, empty means remove splash screen + void splashScreen(const QString &resource); + + //! Add a splash screen based on resource, empty means remove splash screen + void splashScreen(const QPixmap &pixmap); + + //! Allow the GUI to refresh by processing events, call the event loop void processEventsToRefreshGui() const; //! Reload style sheets @@ -124,6 +132,10 @@ namespace BlackGui //! Style sheet changed void styleSheetsChanged(); + protected slots: + //! Startup competed + virtual void ps_startupCompleted() override; + protected: //! \name print messages generated during parsing / cmd handling //! @{ @@ -137,7 +149,8 @@ namespace BlackGui private: QPixmap m_windowIcon; QCommandLineOption m_cmdWindowStateMinimized { "empty" }; //!< window state (minimized) - QCommandLineOption m_cmdWindowMode { "empty" }; //!< window mode (flags: frameless ...) + QCommandLineOption m_cmdWindowMode { "empty" }; //!< window mode (flags: frameless ...) + QScopedPointer m_splashScreen; //!< splash screen //! Qt help message to formatted HTML static QString beautifyHelpMessage(const QString &helpText); diff --git a/src/swiftguistandard/main.cpp b/src/swiftguistandard/main.cpp index 6dd74001a..9dbb6453e 100644 --- a/src/swiftguistandard/main.cpp +++ b/src/swiftguistandard/main.cpp @@ -25,6 +25,8 @@ int main(int argc, char *argv[]) //! [CSwiftGuiStdApplication] QApplication qa(argc, argv); CSwiftGuiStdApplication a; + a.signalStartupAutomatically(); // application will signal startup on its own + a.splashScreen(":/own/icons/own/swift/swiftCirclePilotClient1024.png"); if (!a.start()) { return EXIT_FAILURE; } //! [CSwiftGuiStdApplication] diff --git a/src/swiftguistandard/swiftguistdapplication.cpp b/src/swiftguistandard/swiftguistdapplication.cpp index c5bd807b8..b98e6d2ed 100644 --- a/src/swiftguistandard/swiftguistdapplication.cpp +++ b/src/swiftguistandard/swiftguistdapplication.cpp @@ -14,7 +14,8 @@ using namespace BlackMisc; using namespace BlackCore; -CSwiftGuiStdApplication::CSwiftGuiStdApplication() : CGuiApplication("swift pilot client GUI", CIcons::swift24()) +CSwiftGuiStdApplication::CSwiftGuiStdApplication() : + CGuiApplication("swift pilot client GUI", CIcons::swift1024()) { this->addParserOption(this->m_cmdFacadeMode); this->addWindowModeOption(); diff --git a/src/swiftguistandard/swiftguistdinit.cpp b/src/swiftguistandard/swiftguistdinit.cpp index 21bf93227..161b2f65a 100644 --- a/src/swiftguistandard/swiftguistdinit.cpp +++ b/src/swiftguistandard/swiftguistdinit.cpp @@ -121,6 +121,7 @@ void SwiftGuiStd::init() // whether init has been completed this->setVisible(true); + sGui->startUpCompleted(true); this->m_init = true; } diff --git a/src/swiftlauncher/main.cpp b/src/swiftlauncher/main.cpp index 8f2814d25..166eb50a5 100644 --- a/src/swiftlauncher/main.cpp +++ b/src/swiftlauncher/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) { //! [CSwiftGuiStdApplication] QApplication qa(argc, argv); - CGuiApplication a("swift launcher", CIcons::swift24()); + CGuiApplication a("swift launcher", CIcons::swift1024()); a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup."), "installer"}); a.parse(); //! [CSwiftGuiStdApplication] diff --git a/src/swiftlauncher/swiftlauncher.ui b/src/swiftlauncher/swiftlauncher.ui index e9393328f..b73e17c0e 100644 --- a/src/swiftlauncher/swiftlauncher.ui +++ b/src/swiftlauncher/swiftlauncher.ui @@ -116,8 +116,8 @@ 0 0 - 355 - 301 + 199 + 63 @@ -181,8 +181,8 @@ 0 0 - 341 - 309 + 277 + 222 @@ -406,8 +406,8 @@ 0 0 - 355 - 301 + 283 + 198 @@ -502,8 +502,8 @@ 0 0 - 355 - 301 + 98 + 88 @@ -602,7 +602,7 @@ p, li { white-space: pre-wrap; } - :/own/icons/own/swift/swift64.png:/own/icons/own/swift/swift64.png + :/own/icons/own/swift/swiftCircle64.png:/own/icons/own/swift/swiftCircle64.png