refactor: Clarify CApplication method names

This commit is contained in:
Lars Toenning
2024-02-16 12:37:58 +01:00
parent d977a6214c
commit 2ba2d5bc8e
6 changed files with 16 additions and 16 deletions

View File

@@ -785,7 +785,7 @@ namespace BlackCore
eventLoop.exec(); eventLoop.exec();
} }
CStatusMessageList CApplication::useContexts(const CCoreFacadeConfig &coreConfig) CStatusMessageList CApplication::initContextsAndStartCoreFacade(const CCoreFacadeConfig &coreConfig)
{ {
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Call this function after parsing"); Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Call this function after parsing");
@@ -798,17 +798,17 @@ namespace BlackCore
// if not yet initialized, init web data services // if not yet initialized, init web data services
if (!m_webDataServices) if (!m_webDataServices)
{ {
const CStatusMessageList msgs = this->useWebDataServices(CWebReaderFlags::AllReaders, CDatabaseReaderConfigList::forPilotClient()); const CStatusMessageList msgs = this->initAndStartWebDataServices(CWebReaderFlags::AllReaders, CDatabaseReaderConfigList::forPilotClient());
if (msgs.hasErrorMessages()) { return msgs; } if (msgs.hasErrorMessages()) { return msgs; }
} }
return this->startCoreFacade(); // will do nothing if setup is not yet loaded return this->startCoreFacade(); // will do nothing if setup is not yet loaded
} }
CStatusMessageList CApplication::useFacadeNoContexts() CStatusMessageList CApplication::startCoreFacadeWithoutContexts()
{ {
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Call this function after parsing"); Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Call this function after parsing");
m_useContexts = true; // otherwise startCoreFacadeAndWebDataServices will early-return m_useContexts = true; // otherwise startCoreFacade will early-return
m_coreFacadeConfig = CCoreFacadeConfig::allEmpty(); m_coreFacadeConfig = CCoreFacadeConfig::allEmpty();
const CStatusMessage msg = this->initLocalSettings(); const CStatusMessage msg = this->initLocalSettings();
if (msg.isFailure()) { return msg; } if (msg.isFailure()) { return msg; }
@@ -816,7 +816,7 @@ namespace BlackCore
return this->startCoreFacade(); // will do nothing if setup is not yet loaded return this->startCoreFacade(); // will do nothing if setup is not yet loaded
} }
CStatusMessageList CApplication::useWebDataServices(CWebReaderFlags::WebReader webReaders, const CDatabaseReaderConfigList &dbReaderConfig) CStatusMessageList CApplication::initAndStartWebDataServices(CWebReaderFlags::WebReader webReader, const Db::CDatabaseReaderConfigList &dbReaderConfig)
{ {
Q_ASSERT_X(m_webDataServices.isNull(), Q_FUNC_INFO, "Services already started"); Q_ASSERT_X(m_webDataServices.isNull(), Q_FUNC_INFO, "Services already started");
BLACK_VERIFY_X(QSslSocket::supportsSsl(), Q_FUNC_INFO, "No SSL"); BLACK_VERIFY_X(QSslSocket::supportsSsl(), Q_FUNC_INFO, "No SSL");
@@ -825,7 +825,7 @@ namespace BlackCore
return CStatusMessage(this).error(u"No SSL supported, can`t be used"); return CStatusMessage(this).error(u"No SSL supported, can`t be used");
} }
m_webReadersUsed = webReaders; m_webReadersUsed = webReader;
m_dbReaderConfig = dbReaderConfig; m_dbReaderConfig = dbReaderConfig;
return this->startWebDataServices(); return this->startWebDataServices();
} }

View File

@@ -341,17 +341,17 @@ namespace BlackCore
//! Init the contexts part and start core facade //! Init the contexts part and start core facade
//! \sa coreFacadeStarted //! \sa coreFacadeStarted
//! \remark requires setup loaded //! \remark requires setup loaded
BlackMisc::CStatusMessageList useContexts(const CCoreFacadeConfig &coreConfig); BlackMisc::CStatusMessageList initContextsAndStartCoreFacade(const CCoreFacadeConfig &coreConfig);
//! Init the core facade without any contexts //! Starts the core facade without any contexts
//! \sa coreFacadeStarted //! \sa coreFacadeStarted
//! \remark requires setup loaded //! \remark requires setup loaded
BlackMisc::CStatusMessageList useFacadeNoContexts(); BlackMisc::CStatusMessageList startCoreFacadeWithoutContexts();
//! Init web data services and start them //! Init web data services and start them
//! \sa webDataServicesStarted //! \sa webDataServicesStarted
//! \remark requires setup loaded //! \remark requires setup loaded
BlackMisc::CStatusMessageList useWebDataServices(CWebReaderFlags::WebReader webReader, const Db::CDatabaseReaderConfigList &dbReaderConfig); BlackMisc::CStatusMessageList initAndStartWebDataServices(CWebReaderFlags::WebReader webReader, const Db::CDatabaseReaderConfigList &dbReaderConfig);
//! Get the facade //! Get the facade
CCoreFacade *getCoreFacade() { return m_coreFacade.data(); } CCoreFacade *getCoreFacade() { return m_coreFacade.data(); }

View File

@@ -33,7 +33,7 @@ int main(int argc, char *argv[])
if (!a.parseCommandLineArgsAndLoadSetup()) { return EXIT_FAILURE; } if (!a.parseCommandLineArgsAndLoadSetup()) { return EXIT_FAILURE; }
const QString dBusAddress(a.getCmdDBusAddressValue()); const QString dBusAddress(a.getCmdDBusAddressValue());
a.useContexts(CCoreFacadeConfig::forCoreAllLocalInDBus(dBusAddress)); a.initContextsAndStartCoreFacade(CCoreFacadeConfig::forCoreAllLocalInDBus(dBusAddress));
if (!a.start()) if (!a.start())
{ {
a.gracefulShutdown(); a.gracefulShutdown();

View File

@@ -26,8 +26,8 @@ int main(int argc, char *argv[])
CGuiApplication a(CApplicationInfo::swiftMappingTool(), CApplicationInfo::MappingTool, CIcons::swiftDatabase48()); CGuiApplication a(CApplicationInfo::swiftMappingTool(), CApplicationInfo::MappingTool, CIcons::swiftDatabase48());
if (!a.parseCommandLineArgsAndLoadSetup()) { return EXIT_FAILURE; } if (!a.parseCommandLineArgsAndLoadSetup()) { return EXIT_FAILURE; }
a.splashScreen(CIcons::swiftDatabase256()); a.splashScreen(CIcons::swiftDatabase256());
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forMappingTool()); a.initAndStartWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forMappingTool());
a.useFacadeNoContexts(); a.startCoreFacadeWithoutContexts();
if (!a.start()) if (!a.start())
{ {
a.gracefulShutdown(); a.gracefulShutdown();

View File

@@ -69,7 +69,7 @@ CStatusMessageList CSwiftGuiStdApplication::startHookIn()
break; break;
} }
const CStatusMessageList contextMsgs = this->useContexts(runtimeConfig); const CStatusMessageList contextMsgs = this->initContextsAndStartCoreFacade(runtimeConfig);
msgs.push_back(contextMsgs); msgs.push_back(contextMsgs);
return contextMsgs; return contextMsgs;
} }

View File

@@ -43,12 +43,12 @@ int main(int argc, char *argv[])
const QCommandLineOption installerOption { { "i", "installer" }, QCoreApplication::translate("main", "Installer setup.") }; const QCommandLineOption installerOption { { "i", "installer" }, QCoreApplication::translate("main", "Installer setup.") };
a.addParserOption(installerOption); a.addParserOption(installerOption);
if (!a.parseCommandLineArgsAndLoadSetup()) { return EXIT_FAILURE; } if (!a.parseCommandLineArgsAndLoadSetup()) { return EXIT_FAILURE; }
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher()); a.initAndStartWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher());
const bool installMode = a.isParserOptionSet(installerOption); const bool installMode = a.isParserOptionSet(installerOption);
if (installMode) initDbCacheFromResourceFileIfRequired(a); if (installMode) initDbCacheFromResourceFileIfRequired(a);
a.useFacadeNoContexts(); a.startCoreFacadeWithoutContexts();
if (!a.start()) if (!a.start())
{ {
a.gracefulShutdown(); a.gracefulShutdown();