Adding per-keyset editable data
[pierogi] / keysets / mce.cpp
index 68ea81a..ef6c9ac 100644 (file)
@@ -2,14 +2,24 @@
 #include "protocols/mceprotocol.h"
 
 MCERemote1::MCERemote1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
-      "Remote mode 1",
+      "Windows MCE Remote 1",
       Microsoft_Make,
       index)
 {
-  addControlledDevice(Any_Make, "ASRock HT330", Computer_Device);
+  addControlledDevice(Microsoft_Make, "Windows PC ASRock HT330", Computer_Device);
+}
+
+
+void MCERemote1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
 
   threadableProtocol = new MCEProtocol(guiObject, index, 0x800F);
 
@@ -43,8 +53,8 @@ MCERemote1::MCERemote1(
   addKey("Record", Record_Key, 0x17, 8);
   addKey("Pause", Pause_Key, 0x18, 8);
   addKey("Stop", Stop_Key, 0x19, 8);
-  addKey("Skip", Advance_Key, 0x1A, 8);
-  addKey("Replay", Replay_Key, 0x1B, 8);
+  addKey("Skip", Advance_Key, 0x1A, 8); // next?
+  addKey("Replay", Replay_Key, 0x1B, 8); // previous?
 
   addKey("Hash", Unmapped_Key, 0x1C, 8); // "Caps Lock"
   addKey("Star", Unmapped_Key, 0x1D, 8); // "Mouse"
@@ -73,10 +83,10 @@ MCERemote1::MCERemote1(
   addKey("DVD angle", Angle_Key, 0x4B, 8);
   addKey("DVD audio", Audio_Key, 0x4C, 8);
   addKey("DVD subtitle", Captions_Key, 0x4D, 8);
-
   addKey("Print", Unmapped_Key, 0x4E, 8);
-  addKey("Radio", TunerInput_Key, 0x50, 8);
 
+  addKey("Radio", TunerInput_Key, 0x50, 8);
+  addKey("title", DiscTitle_Key, 0x51, 8);
   addKey("Teletext", Teletext_Key, 0x5A, 8);
   addKey("Red", Red_Key, 0x5B, 8);
   addKey("Green", Green_Key, 0x5C, 8);
@@ -91,77 +101,187 @@ MCERemote1::MCERemote1(
 
 
 MCERemote1a::MCERemote1a(
-  QObject *guiObject,
   unsigned int index)
-  : MCERemote1(guiObject, index)
+  : MCERemote1(index)
 {
-  setKeysetName("Remote mode 2");
+  setKeysetName("Windows MCE Remote 2");
+}
+
+
+void MCERemote1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MCERemote1::populateProtocol(guiObject);
 
   setPreData(0x14, 7);
 }
 
 
 MCERemote1b::MCERemote1b(
-  QObject *guiObject,
   unsigned int index)
-  : MCERemote1(guiObject, index)
+  : MCERemote1(index)
+{
+  setKeysetName("Windows MCE Remote 3");
+}
+
+
+void MCERemote1b::populateProtocol(
+  QObject *guiObject)
 {
-  setKeysetName("Remote mode 3");
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MCERemote1::populateProtocol(guiObject);
 
   setPreData(0x24, 7);
 }
 
 
 MCERemote1c::MCERemote1c(
-  QObject *guiObject,
   unsigned int index)
-  : MCERemote1(guiObject, index)
+  : MCERemote1(index)
 {
-  setKeysetName("Remote mode 4");
+  setKeysetName("Windows MCE Remote 4");
+}
+
+
+void MCERemote1c::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MCERemote1::populateProtocol(guiObject);
 
   setPreData(0x34, 7);
 }
 
 
 MCERemote1d::MCERemote1d(
-  QObject *guiObject,
   unsigned int index)
-  : MCERemote1(guiObject, index)
+  : MCERemote1(index)
+{
+  setKeysetName("Windows MCE Remote 5");
+}
+
+
+void MCERemote1d::populateProtocol(
+  QObject *guiObject)
 {
-  setKeysetName("Remote mode 5");
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MCERemote1::populateProtocol(guiObject);
 
   setPreData(0x44, 7);
 }
 
 
 MCERemote1e::MCERemote1e(
-  QObject *guiObject,
   unsigned int index)
-  : MCERemote1(guiObject, index)
+  : MCERemote1(index)
 {
-  setKeysetName("Remote mode 6");
+  setKeysetName("Windows MCE Remote 6");
+}
+
+
+void MCERemote1e::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MCERemote1::populateProtocol(guiObject);
 
   setPreData(0x54, 7);
 }
 
 
 MCERemote1f::MCERemote1f(
-  QObject *guiObject,
   unsigned int index)
-  : MCERemote1(guiObject, index)
+  : MCERemote1(index)
 {
-  setKeysetName("Remote mode 7");
+  setKeysetName("Windows MCE Remote 7");
+}
+
+
+void MCERemote1f::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MCERemote1::populateProtocol(guiObject);
 
   setPreData(0x64, 7);
 }
 
 
 MCERemote1g::MCERemote1g(
-  QObject *guiObject,
   unsigned int index)
-  : MCERemote1(guiObject, index)
+  : MCERemote1(index)
 {
-  setKeysetName("Remote mode 8");
+  setKeysetName("Windows MCE Remote 8");
+}
+
+
+void MCERemote1g::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MCERemote1::populateProtocol(guiObject);
 
   setPreData(0x74, 7);
 }
+
+
+MCEXboxRemote1::MCEXboxRemote1(
+  unsigned int index)
+  : MCERemote1g(index)
+{
+  setKeysetName("XBox 360 Remote 1");
+}
+
+
+void MCEXboxRemote1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // Keyset already populated.
+    return;
+  }
+
+  MCERemote1g::populateProtocol(guiObject);
+
+  addKey("A", Green_Key, 0x12, 8);
+  addKey("X", Blue_Key, 0x13, 8);
+  addKey("B", Red_Key, 0x25, 8);
+  addKey("Y", Yellow_Key, 0x26, 8);
+}