refs #199 , adjusted context classes

* removed usingLocalObjects() now in CContext
* removed getRuntime() now in CContext
* Constructors no longer public, context can only be obtained via runtime object
* runtime class is friend class
This commit is contained in:
Klaus Basan
2014-04-01 11:48:45 +02:00
parent 0b033fdcac
commit 77fd3bcd70
28 changed files with 161 additions and 290 deletions

View File

@@ -25,31 +25,25 @@ namespace BlackCore
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTSETTINGS_INTERFACENAME)
public:
protected:
//! \brief Constructor
CContextSettings(QObject *runtime = nullptr);
CContextSettings(CRuntimeConfig::ContextMode mode, CRuntime *runtime = nullptr);
public:
//! Destructor
virtual ~CContextSettings() {}
//! \brief Register myself in DBus
void registerWithDBus(CDBusServer *server)
CContextSettings *registerWithDBus(CDBusServer *server)
{
server->addObject(IContextSettings::ObjectPath(), this);
return this;
}
//! \brief Runtime
CCoreRuntime *getRuntime()
{
return static_cast<CCoreRuntime *>(this->parent());
}
//! \brief settings file
const QString &getSettingsDirectory() const { return BlackMisc::Settings::CSettingUtilities::getSettingsDirectory(); }
//! \brief Runtime
const CCoreRuntime *getRuntime() const
{
return static_cast<CCoreRuntime *>(this->parent());
}
//! \copydoc IContextSettings::value()
public slots:
//! \copydoc IContextSettings::getNetworkSettings()
@@ -62,6 +56,7 @@ namespace BlackCore
virtual BlackMisc::CStatusMessageList value(const QString &path, const QString &command, const QVariant &value) override;
private:
friend class CRuntime;
BlackMisc::Settings::CSettingsNetwork m_settingsNetwork;
BlackMisc::Hardware::CKeyboardKeyList m_hotkeys;
};