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

@@ -22,11 +22,10 @@ namespace BlackCore
/*
* Init this context
*/
CContextAudio::CContextAudio(QObject *parent) :
IContextAudio(parent),
m_voice(nullptr),
m_keyboard(nullptr),
m_contextSettings(nullptr)
CContextAudio::CContextAudio(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
IContextAudio(mode, runtime),
m_voice(nullptr),
m_keyboard(nullptr)
{
// 1. Init by "voice driver"
this->m_voice = new CVoiceVatlib(this);
@@ -288,11 +287,13 @@ namespace BlackCore
return static_cast<double>(this->m_voice->inputSquelch());
}
void CContextAudio::settingsChanged(IContextSettings::SettingsType type)
void CContextAudio::settingsChanged(uint typeValue)
{
if (!this->getRuntime()->getIContextSettings()) return;
IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue);
if (type == IContextSettings::SettingsHotKeys)
{
CKeyboardKeyList hotKeys = m_contextSettings->getHotkeys();
CKeyboardKeyList hotKeys = this->getRuntime()->getIContextSettings()->getHotkeys();
CKeyboardKey pttKey = hotKeys.findBy(&BlackMisc::Hardware::CKeyboardKey::getFunction, BlackMisc::Hardware::CKeyboardKey::HotkeyPtt).front();
m_keyboard->unregisterHotkey(m_handlePtt);
m_handlePtt = m_keyboard->registerHotkey(pttKey, m_voice, &CVoiceVatlib::handlePushToTalk);