diff --git a/src/blackcore/coreruntime.cpp b/src/blackcore/coreruntime.cpp deleted file mode 100644 index 1c0965c08..000000000 --- a/src/blackcore/coreruntime.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "blackcore/coreruntime.h" -#include "blackmisc/blackmiscfreefunctions.h" -#include "blackmisc/nwserver.h" -#include "blackcore/context_application_impl.h" -#include "blackcore/context_network_impl.h" -#include "blackcore/context_settings_impl.h" -#include "blackcore/context_audio_impl.h" -#include "blackcore/context_simulator_impl.h" - -namespace BlackCore -{ -/* - * Constructor - */ -CCoreRuntime::CCoreRuntime(bool withDbus, QObject *parent) : - QObject(parent), m_init(false), m_dbusServer(nullptr), - m_contextNetwork(nullptr), m_contextAudio(nullptr), - m_contextSettings(nullptr), m_contextApplication(nullptr), - m_contextSimulator(nullptr) -{ - this->init(withDbus); -} - -/* - * Init runtime - */ -void CCoreRuntime::init(bool withDbus) -{ - if (m_init) return; - BlackMisc::registerMetadata(); - BlackMisc::initResources(); - - // TODO: read settings - if (withDbus) { - QString dBusAddress = "session"; - this->m_dbusServer = new CDBusServer(dBusAddress, this); - } - - // contexts - this->m_contextSettings = new CContextSettings(this); - if (withDbus) this->m_contextSettings->registerWithDBus(this->m_dbusServer); - - this->m_contextNetwork = new CContextNetwork(this); - if (withDbus) this->m_contextNetwork->registerWithDBus(this->m_dbusServer); - - this->m_contextApplication = new CContextApplication(this); - if (withDbus) this->m_contextApplication->registerWithDBus(this->m_dbusServer); - - this->m_contextAudio = new CContextAudio(this); - if (withDbus) this->m_contextAudio->registerWithDBus(this->m_dbusServer); - - this->m_contextSimulator = new CContextSimulator(this); - this->m_contextSimulator->init(); - if (withDbus) this->m_contextSimulator->registerWithDBus(this->m_dbusServer); - - m_contextAudio->init(); - - // flag - m_init = true; -} - -IContextNetwork *CCoreRuntime::getIContextNetwork() -{ - return this->m_contextNetwork; -} - -const IContextNetwork *CCoreRuntime::getIContextNetwork() const -{ - return this->m_contextNetwork; -} - -IContextAudio *CCoreRuntime::getIContextAudio() -{ - return this->m_contextAudio; -} - -const IContextAudio *CCoreRuntime::getIContextAudio() const -{ - return this->m_contextAudio; -} - -IContextSettings *CCoreRuntime::getIContextSettings() -{ - return this->m_contextSettings; -} - -const IContextSettings *CCoreRuntime::getIContextSettings() const -{ - return this->m_contextSettings; -} - -const IContextApplication *CCoreRuntime::getIContextApplication() const -{ - return this->m_contextApplication; -} - -IContextApplication *CCoreRuntime::getIContextApplication() -{ - return this->m_contextApplication; -} - -const IContextSimulator *CCoreRuntime::getIContextSimulator() const -{ - return this->m_contextSimulator; -} - -IContextSimulator *CCoreRuntime::getIContextSimulator() -{ - return this->m_contextSimulator; -} -} diff --git a/src/blackcore/coreruntime.h b/src/blackcore/coreruntime.h deleted file mode 100644 index 8961f9979..000000000 --- a/src/blackcore/coreruntime.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef BLACKCORE_CORERUNTIME_H -#define BLACKCORE_CORERUNTIME_H - -#include - -namespace BlackCore -{ - // forward declaration, see review - // https://dev.vatsim-germany.org/boards/22/topics/1350?r=1359#message-1359 - class CDBusServer; - class CContextNetwork; - class CContextAudio; - class CContextSettings; - class CContextApplication; - class CContextSimulator; - class IContextNetwork; - class IContextAudio; - class IContextSettings; - class IContextApplication; - class IContextSimulator; - - //! \brief The CCoreRuntime class - class CCoreRuntime : public QObject - { - Q_OBJECT - - private: - bool m_init; /*!< flag */ - CDBusServer *m_dbusServer; - CContextNetwork *m_contextNetwork; - CContextAudio *m_contextAudio; - CContextSettings *m_contextSettings; - CContextApplication *m_contextApplication; - CContextSimulator *m_contextSimulator; - - //! \brief Init - void init(bool withDbus); - - public: - //! \brief Constructor - CCoreRuntime(bool withDbus = true, QObject *parent = nullptr); - - //! \brief Destructor - virtual ~CCoreRuntime() {} - - //! \brief DBus server - const CDBusServer *getDBusServer() const - { - return this->m_dbusServer; - } - - //! \brief Context for network - IContextNetwork *getIContextNetwork(); - - //! \brief Context for network - const IContextNetwork *getIContextNetwork() const; - - //! \brief Context for network - IContextAudio *getIContextAudio(); - - //! \brief Context for network - const IContextAudio *getIContextAudio() const; - - //! \brief Settings - IContextSettings *getIContextSettings(); - - //! \brief Settings - const IContextSettings *getIContextSettings() const; - - //! \brief Context for application - const IContextApplication *getIContextApplication() const; - - //! \brief Application - IContextApplication *getIContextApplication(); - - //! \brief Context for simulator - const IContextSimulator *getIContextSimulator() const; - - //! \brief Simulator - IContextSimulator *getIContextSimulator(); - - }; -} -#endif // guard