context classes, runtime classes, and related infrastructure

refs #81
This commit is contained in:
Klaus Basan
2014-01-02 00:52:56 +00:00
committed by Mathew Sutcliffe
parent 34774bd005
commit 1f2a88e502
20 changed files with 2641 additions and 49 deletions

View File

@@ -0,0 +1,42 @@
#include "blackcore/coreruntime.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include "blackmisc/nwserver.h"
namespace BlackCore
{
/*
* Constructor
*/
CCoreRuntime::CCoreRuntime(bool withDbus, QObject *parent) :
QObject(parent), m_init(false), m_dbusServer(nullptr), m_contextNetwork(nullptr), m_settings(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_settings = new CContextSettings(this);
if (withDbus) this->m_settings->registerWithDBus(this->m_dbusServer);
this->m_contextNetwork = new CContextNetwork(this);
if (withDbus) this->m_contextNetwork->registerWithDBus(this->m_dbusServer); // complete object after init
// flag
m_init = true;
}
}