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

@@ -8,7 +8,7 @@
#include "context_audio.h"
#include "context_settings.h"
#include "coreruntime.h"
#include "context_runtime.h"
#include "dbus_server.h"
#include "voice_vatlib.h"
#include "blackcore/keyboard.h"
@@ -23,9 +23,6 @@ namespace BlackCore
public:
//! \brief Constructor
CContextAudio(QObject *runtime);
//! \brief Destructor
virtual ~CContextAudio();
@@ -34,22 +31,9 @@ namespace BlackCore
{
Q_ASSERT(server);
server->addObject(IContextAudio::ObjectPath(), this);
return this;
}
//! \brief Runtime
CCoreRuntime *getRuntime()
{
return static_cast<CCoreRuntime *>(this->parent());
}
//! \brief Const runtime
const CCoreRuntime *getRuntime() const
{
return static_cast<CCoreRuntime *>(this->parent());
}
//! \copydoc IContextAudio::usingLocalObjects()
virtual bool usingLocalObjects() const override { return true; }
//! \brief Initialize voice context
void init();
@@ -121,15 +105,18 @@ namespace BlackCore
//! \copydoc IContextAudio::getSquelchValue()
virtual double getSquelchValue() const override;
protected:
//! \brief Constructor
CContextAudio(CRuntimeConfig::ContextMode mode, CRuntime *runtime);
private slots:
void settingsChanged(IContextSettings::SettingsType type);
friend class CRuntime;
void settingsChanged(uint typeValue);
private:
CVoiceVatlib *m_voice; //!< underlying voice lib
IKeyboard *m_keyboard;
IKeyboard::RegistrationHandle m_handlePtt;
IContextSettings *m_contextSettings;
};
}