[cec] simplify settings - use an enum instead of logical addresses for the 'connected...
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 9 Oct 2012 00:02:38 +0000 (02:02 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 9 Oct 2012 00:02:38 +0000 (02:02 +0200)
language/English/strings.po
system/peripherals.xml
xbmc/peripherals/devices/PeripheralCecAdapter.cpp

index fb5abf8..fc23d6b 100644 (file)
@@ -10876,7 +10876,7 @@ msgid "Product ID"
 msgstr ""
 
 #empty strings from id 35505 to 35999
-
+#: xbmc/peripherals/devices/PeripheralCecAdapter.cpp
 msgctxt "#36000"
 msgid "Pulse-Eight CEC adapter"
 msgstr ""
@@ -11023,3 +11023,13 @@ msgstr ""
 msgctxt "#36036"
 msgid "On start/stop"
 msgstr ""
+
+#: xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+msgctxt "#36037"
+msgid "TV"
+msgstr ""
+
+msgctxt "#36038"
+msgid "Amplifier / AVR device"
+msgstr ""
+
index 8abd07f..26c3494 100644 (file)
@@ -40,9 +40,9 @@
     <setting key="send_inactive_source" type="bool" value="1" label="36025" order="8" />
     <setting key="use_tv_menu_language" type="bool" value="1" label="36018" order="9" />
     <setting key="pause_playback_on_deactivate" type="bool" value="1" label="36033" order="10" />
-    <setting key="physical_address" type="string" label="36021" value="0" order="11" />
+    <setting key="connected_device" type="enum" label="36019" value="36037" lvalues="36037|36038" order="11" />
     <setting key="cec_hdmi_port" type="int" value="1" min="1" max="15" label="36015" order="12" />
-    <setting key="connected_device" type="int" label="36019" value="0" min="0" max="15" step="1" order="13" />
+    <setting key="physical_address" type="string" label="36021" value="0" order="13" />
     <setting key="port" type="string" value="" label="36022" order="14" />
 
     <setting key="tv_vendor" type="int" value="0" configurable="0" />
index 4d510d4..6f20476 100644 (file)
@@ -51,6 +51,9 @@ using namespace std;
 #define VOLUME_CHANGE_TIMEOUT     250
 #define VOLUME_REFRESH_TIMEOUT    100
 
+#define LOCALISED_ID_TV           36037
+#define LOCALISED_ID_AVR          36038
+
 class DllLibCECInterface
 {
 public:
@@ -1226,7 +1229,7 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu
 
   // set the connected device
   m_configuration.baseDevice = config.baseDevice;
-  bChanged |= SetSetting("connected_device", (int)config.baseDevice);
+  bChanged |= SetSetting("connected_device", config.baseDevice == CECDEVICE_AUDIOSYSTEM ? LOCALISED_ID_AVR : LOCALISED_ID_TV);
 
   // set the HDMI port number
   m_configuration.iHDMIPort = config.iHDMIPort;
@@ -1328,9 +1331,10 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void)
 
   // set the connected device
   int iConnectedDevice = GetSettingInt("connected_device");
-  if (iConnectedDevice == CECDEVICE_TV ||
-      iConnectedDevice == CECDEVICE_AUDIOSYSTEM)
-    m_configuration.baseDevice = (cec_logical_address)iConnectedDevice;
+  if (iConnectedDevice == LOCALISED_ID_AVR)
+    m_configuration.baseDevice = CECDEVICE_AUDIOSYSTEM;
+  else if (iConnectedDevice == LOCALISED_ID_TV)
+    m_configuration.baseDevice = CECDEVICE_TV;
 
   // set the HDMI port number
   int iHDMIPort = GetSettingInt("cec_hdmi_port");