swift
Loading...
Searching...
No Matches
swiftdataapplication.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#include <QtGlobal>
7
8#include "core/application.h"
10#include "core/coremodeenums.h"
11#include "misc/dbusserver.h"
12#include "misc/icons.h"
13
14using namespace swift::misc;
15using namespace swift::core;
16
18 : CGuiApplication(CApplicationInfo::swiftMappingTool(), CApplicationInfo::MappingTool, CIcons::swiftDatabase48())
19{
20 // this->addParserOption(m_cmdFacadeMode);
21 // this->addDBusAddressOption();
22 // this->addAudioOptions();
23}
24
26{
27 Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Not yet parsed cmd line arguments");
28
29 QString dBusAddress(this->getCmdDBusAddressValue());
30 const QString coreModeStr =
31 this->isParserOptionSet(m_cmdFacadeMode) ? this->getParserValue(m_cmdFacadeMode) : QString();
33
35
36 CCoreFacadeConfig runtimeConfig = coreModeToCoreFacadeConfig(coreMode, dBusAddress);
37 const CStatusMessageList contextMsgs = this->initContextsAndStartCoreFacade(runtimeConfig);
38 msgs.push_back(contextMsgs);
39 return contextMsgs;
40}
41
42bool CSwiftDataApplication::parsingHookIn() { return CGuiApplication::parsingHookIn(); }
43
48
49CCoreFacadeConfig CSwiftDataApplication::coreModeToCoreFacadeConfig(CoreModes::CoreMode coreMode,
50 const QString &dBusAddress)
51{
52 switch (coreMode)
53 {
54 case CoreModes::Distributed: return CCoreFacadeConfig(CCoreFacadeConfig::Remote, dBusAddress);
55 case CoreModes::Standalone: return CCoreFacadeConfig(CCoreFacadeConfig::Local, dBusAddress); break;
56 default:
57 Q_ASSERT_X(false, Q_FUNC_INFO, "Not handled core mode");
59 }
60}
CSwiftDataApplication * instance()
Single instance.
virtual bool parsingHookIn()
Parsing of special CMD args.
virtual swift::misc::CStatusMessageList startHookIn()
Start facade by cmd arguments.
QString getParserValue(const QString &option) const
Delegates to QCommandLineParser::value.
bool m_parsed
Parsing accomplished?
bool isParserOptionSet(const QString &option) const
Delegates to QCommandLineParser::isSet.
QString getCmdDBusAddressValue() const
DBus address from CMD line, otherwise "".
swift::misc::CStatusMessageList initContextsAndStartCoreFacade(const CCoreFacadeConfig &coreConfig)
Init the contexts part and start core facade.
static CApplication * instance()
Similar to.
Configuration object for the contexts.
@ NotUsed
during shutdown or not used at all
@ Local
context runs in same process
@ Remote
context runs in a different process.
CGuiApplication(const QString &applicationName=executable(), swift::misc::CApplicationInfo::Application application=swift::misc::CApplicationInfo::Unknown, const QPixmap &icon=swift::misc::CIcons::swift64())
Constructor.
Description of a swift application.
Standard icons.
Definition icons.h:25
void push_back(const T &value)
Appends an element at the end of the sequence.
Definition sequence.h:308
Status messages, e.g. from Core -> GUI.
Backend services of the swift project, like dealing with the network or the simulators.
Definition actionbind.cpp:7
Free functions in swift::misc.
T qobject_cast(QObject *object)
static CoreMode stringToCoreMode(const QString &m)
String to core mode.
CoreMode
Core runs how and where?