mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
Reload hotkey settings when they have changed
This also includes changing the registration refs #83
This commit is contained in:
@@ -25,7 +25,8 @@ namespace BlackCore
|
||||
CContextAudio::CContextAudio(QObject *parent) :
|
||||
IContextAudio(parent),
|
||||
m_voice(nullptr),
|
||||
m_keyboard(nullptr)
|
||||
m_keyboard(nullptr),
|
||||
m_contextSettings(nullptr)
|
||||
{
|
||||
// 1. Init by "voice driver"
|
||||
this->m_voice = new CVoiceVatlib(this);
|
||||
@@ -44,6 +45,12 @@ namespace BlackCore
|
||||
this->leaveAllVoiceRooms();
|
||||
}
|
||||
|
||||
void CContextAudio::init()
|
||||
{
|
||||
m_contextSettings = getRuntime()->getIContextSettings();
|
||||
connect(m_contextSettings, &IContextSettings::changedSettings, this, &CContextAudio::settingsChanged);
|
||||
}
|
||||
|
||||
/*
|
||||
* Own aircraft
|
||||
*/
|
||||
@@ -281,4 +288,15 @@ namespace BlackCore
|
||||
return static_cast<double>(this->m_voice->inputSquelch());
|
||||
}
|
||||
|
||||
void CContextAudio::settingsChanged(IContextSettings::SettingsType type)
|
||||
{
|
||||
if (type == IContextSettings::SettingsHotKeys)
|
||||
{
|
||||
CKeyboardKeyList hotKeys = m_contextSettings->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);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user