<string id="35006">Device removed</string>
<string id="35007">Keymap to use for this device</string>
<string id="35008">Keymap enabled</string>
+ <string id="35009">Do not use the custom keymap for this device</string>
<string id="35500">Location</string>
<string id="35501">Class</string>
<peripherals>
<peripheral vendor_product="1915:003B,22B8:003B" bus="usb" name="Motorola Nyxboard Hybrid" mapTo="nyxboard">
- <setting key="keymap_enabled" type="bool" value="1" label="35008" order="1" />
+ <setting key="do_not_use_custom_keymap" type="bool" value="0" label="35009" order="1" />
<setting key="keymap" value="nyxboard" label="35007" configurable="0" />
<setting key="enable_flip_commands" type="bool" value="1" label="36005" order="2" />
<setting key="flip_keyboard" value="XBMC.VideoLibrary.Search" label="36002" order="3" />
}
}
+void CPeripheral::SetSettingVisible(const CStdString &strKey, bool bSetTo)
+{
+ map<CStdString, CSetting *>::iterator it = m_settings.find(strKey);
+ if (it != m_settings.end())
+ (*it).second->SetVisible(bSetTo);
+}
+
+bool CPeripheral::IsSettingVisible(const CStdString &strKey) const
+{
+ map<CStdString, CSetting *>::const_iterator it = m_settings.find(strKey);
+ if (it != m_settings.end())
+ return (*it).second->IsVisible();
+ return false;
+}
+
void CPeripheral::SetSetting(const CStdString &strKey, const CStdString &strValue)
{
map<CStdString, CSetting *>::iterator it = m_settings.find(strKey);
*/
virtual const CStdString GetSettingString(const CStdString &strKey) const;
virtual void SetSetting(const CStdString &strKey, const CStdString &strValue);
+ virtual void SetSettingVisible(const CStdString &strKey, bool bSetTo);
+ virtual bool IsSettingVisible(const CStdString &strKey) const;
virtual int GetSettingInt(const CStdString &strKey) const;
virtual void SetSetting(const CStdString &strKey, int iValue);
CPeripheralHID::~CPeripheralHID(void)
{
- if (!m_strKeymap.IsEmpty() && GetSettingBool("keymap_enabled"))
+ if (!m_strKeymap.IsEmpty() && !GetSettingBool("do_not_use_custom_keymap"))
{
CLog::Log(LOGDEBUG, "%s - switching active keymapping to: default", __FUNCTION__);
CButtonTranslator::GetInstance().RemoveDevice(m_strKeymap);
SetSetting("keymap", m_strKeymap);
}
+ if (!IsSettingVisible("keymap"))
+ SetSettingVisible("do_not_use_custom_keymap", false);
+
if (!m_strKeymap.IsEmpty())
{
- bool bKeymapEnabled(GetSettingBool("keymap_enabled"));
+ bool bKeymapEnabled(!GetSettingBool("do_not_use_custom_keymap"));
if (bKeymapEnabled)
{
CLog::Log(LOGDEBUG, "%s - adding keymapping for: %s", __FUNCTION__, m_strKeymap.c_str());
void CPeripheralHID::OnSettingChanged(const CStdString &strChangedSetting)
{
- if (m_bInitialised && ((strChangedSetting.Equals("keymap") && GetSettingBool("keymap_enabled")) || strChangedSetting.Equals("keymap_enabled")))
+ if (m_bInitialised && ((strChangedSetting.Equals("keymap") && !GetSettingBool("do_not_use_custom_keymap")) || strChangedSetting.Equals("keymap_enabled")))
{
m_bInitialised = false;
InitialiseFeature(FEATURE_HID);