mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-04 16:22:52 +08:00
refactor: Emit CApplication::startUpComplete on starting event loop
This commit is contained in:
@@ -200,6 +200,7 @@ namespace BlackCore
|
||||
int CApplication::exec()
|
||||
{
|
||||
Q_ASSERT_X(instance(), Q_FUNC_INFO, "missing application");
|
||||
emit this->startUpCompleted(true);
|
||||
CApplication::registerAsRunning();
|
||||
return QCoreApplication::exec();
|
||||
}
|
||||
@@ -1074,8 +1075,6 @@ namespace BlackCore
|
||||
const CStatusMessageList msgs = this->asyncWebAndContextStart();
|
||||
m_started = msgs.isSuccess();
|
||||
}
|
||||
|
||||
if (m_signalStartup) { emit this->startUpCompleted(m_started); }
|
||||
}
|
||||
|
||||
void CApplication::onStartUpCompleted()
|
||||
|
||||
@@ -190,15 +190,15 @@ namespace BlackCore
|
||||
//! Running with dev.flag?
|
||||
bool isDeveloperFlagSet() const { return m_devFlag; }
|
||||
|
||||
//! Signal startup automatically or individually
|
||||
void setSignalStartupAutomatically(bool enabled) { m_signalStartup = enabled; }
|
||||
|
||||
//! Comprehensive info
|
||||
QString getInfoString(const QString &separator) const;
|
||||
|
||||
//! Stop and restart application
|
||||
void restartApplication(const QStringList &newArguments = {}, const QStringList &removeArguments = {});
|
||||
|
||||
//! Finishes initialization and executes the event loop
|
||||
int exec();
|
||||
|
||||
//! Directory for temporary files
|
||||
static QString getTemporaryDirectory();
|
||||
|
||||
@@ -210,9 +210,6 @@ namespace BlackCore
|
||||
//! \note Normally done automatically, needed for restart
|
||||
static bool unregisterAsRunning();
|
||||
|
||||
//! Run event loop
|
||||
static int exec();
|
||||
|
||||
//! Exit application, perform graceful shutdown and exit
|
||||
static void exit(int retcode = EXIT_SUCCESS);
|
||||
|
||||
@@ -563,8 +560,7 @@ namespace BlackCore
|
||||
void updateInfoAvailable(bool success);
|
||||
|
||||
//! Startup has been completed
|
||||
//! \remark needs to be triggered by application when it think it is done
|
||||
//! \fixme http://doc.qt.io/qt-5/signalsandslots.html#signals recommends signals be only emitted by their own class
|
||||
//! Will be triggered shortly before starting the event loop
|
||||
void startUpCompleted(bool success);
|
||||
|
||||
//! Facade started
|
||||
@@ -735,7 +731,6 @@ namespace BlackCore
|
||||
bool m_noNwAccessPoint = false; //!< no network access point?
|
||||
bool m_useContexts = false; //!< use contexts
|
||||
bool m_useWebData = false; //!< use web data
|
||||
bool m_signalStartup = true; //!< signal startup automatically
|
||||
bool m_devFlag = false; //!< dev. environment
|
||||
bool m_saveSettingsOnShutdown = true; //!< saving all settings on shutdown
|
||||
bool m_localSettingsLoaded = false; //!< local settings loaded?
|
||||
|
||||
@@ -25,7 +25,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
CCrashHandler::instance()->init();
|
||||
CGuiApplication a(CApplicationInfo::swiftMappingTool(), CApplicationInfo::MappingTool, CIcons::swiftDatabase48());
|
||||
a.setSignalStartupAutomatically(false); // application will signal startup on its own
|
||||
a.splashScreen(CIcons::swiftDatabase256());
|
||||
if (!a.parseAndLoadSetup()) { return EXIT_FAILURE; }
|
||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forMappingTool());
|
||||
|
||||
@@ -106,8 +106,6 @@ void CSwiftData::init()
|
||||
this->checkMinimumVersion();
|
||||
this->checkAutoPublishing();
|
||||
});
|
||||
|
||||
emit sGui->startUpCompleted(true);
|
||||
}
|
||||
|
||||
void CSwiftData::initLogDisplay()
|
||||
|
||||
@@ -37,7 +37,6 @@ int main(int argc, char *argv[])
|
||||
int r = 0;
|
||||
{
|
||||
CSwiftGuiStdApplication a; // application with contexts
|
||||
a.setSignalStartupAutomatically(false); // application will signal startup on its own
|
||||
a.splashScreen(CIcons::swift256());
|
||||
a.setMinimumSizeInCharacters(60, 42); // experimental
|
||||
if (!a.parseAndLoadSetup()) { return EXIT_FAILURE; }
|
||||
|
||||
@@ -196,7 +196,6 @@ void SwiftGuiStd::init()
|
||||
sGui->triggerNewVersionCheck(10 * 1000);
|
||||
|
||||
// done
|
||||
emit sGui->startUpCompleted(true);
|
||||
m_init = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
||||
//! [SwiftApplicationDemo]
|
||||
|
||||
CSwiftLauncher launcher;
|
||||
const int res = CGuiApplication::exec();
|
||||
const int res = a.exec();
|
||||
if (res != EXIT_SUCCESS || !launcher.shouldStartAppDetached())
|
||||
{
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user