mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
refactor: Use same mode for all contexts
This commit is contained in:
@@ -62,14 +62,7 @@ CStatusMessageList CSwiftGuiStdApplication::startHookIn()
|
||||
msgs.push_back(m);
|
||||
}
|
||||
|
||||
CCoreFacadeConfig runtimeConfig;
|
||||
switch (coreMode)
|
||||
{
|
||||
case CoreModes::Distributed: runtimeConfig = CCoreFacadeConfig::remote(dBusAddress); break;
|
||||
default:
|
||||
case CoreModes::Standalone: runtimeConfig = CCoreFacadeConfig::local(dBusAddress); break;
|
||||
}
|
||||
|
||||
CCoreFacadeConfig runtimeConfig = coreModeToCoreFacadeConfig(coreMode, dBusAddress);
|
||||
const CStatusMessageList contextMsgs = this->initContextsAndStartCoreFacade(runtimeConfig);
|
||||
msgs.push_back(contextMsgs);
|
||||
return contextMsgs;
|
||||
@@ -95,3 +88,14 @@ CSwiftGuiStdApplication *CSwiftGuiStdApplication::instance()
|
||||
{
|
||||
return qobject_cast<CSwiftGuiStdApplication *>(CApplication::instance());
|
||||
}
|
||||
|
||||
CCoreFacadeConfig CSwiftGuiStdApplication::coreModeToCoreFacadeConfig(CoreModes::CoreMode coreMode,
|
||||
const QString &dBusAddress)
|
||||
{
|
||||
switch (coreMode)
|
||||
{
|
||||
case CoreModes::Distributed: return CCoreFacadeConfig(CCoreFacadeConfig::Remote, dBusAddress);
|
||||
case CoreModes::Standalone: return CCoreFacadeConfig(CCoreFacadeConfig::Local, dBusAddress); break;
|
||||
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Not handled core mode");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include "core/coremodeenums.h"
|
||||
#include "gui/guiapplication.h"
|
||||
|
||||
/*!
|
||||
@@ -36,6 +37,9 @@ protected:
|
||||
virtual swift::misc::CStatusMessageList startHookIn() override;
|
||||
|
||||
private:
|
||||
static swift::core::CCoreFacadeConfig coreModeToCoreFacadeConfig(swift::core::CoreModes::CoreMode,
|
||||
const QString &dBusAddress);
|
||||
|
||||
QCommandLineOption m_cmdFacadeMode { { "c", "core" },
|
||||
QCoreApplication::translate("main", "Core mode: (d)istributed, (s)tandalone."),
|
||||
"coremode" }; //!< Facade startup mode
|
||||
|
||||
Reference in New Issue
Block a user