Adding per-keyset editable data
[pierogi] / keysets / mitsubishi.cpp
index f3a38e5..ae94c7d 100644 (file)
@@ -1,28 +1,39 @@
 #include "mitsubishi.h"
-#include "necprotocol.h"
+#include "protocols/lircprotocol.h"
 
 MitsubishiTV1::MitsubishiTV1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "TV Keyset 1",
       Mitsubishi_Make,
       index)
 {
-  NECProtocol *np = new NECProtocol(
+}
+
+
+void MitsubishiTV1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LIRCProtocol *lp = new LIRCProtocol(
     guiObject,
     index,
     300, 900,
     300, 2100,
     53715, true);
 
-  threadableProtocol = np;
+  threadableProtocol = lp;
 
-  np->setTrailerPulse(300);
+  lp->setTrailerPulse(300);
 
-  np->setPreData(0xE2, 8);
+//  lp->setMinimumRepetitions(1);
 
-//  np->setMinimumRepetitions(1);
+  setPreData(0xE2, 8);
 
   addKey("POWER", Power_Key, 0x40, 8);
   addKey("0", Zero_Key, 0x90, 8);
@@ -56,35 +67,35 @@ MitsubishiTV1::MitsubishiTV1(
   addKey("down", Down_Key, 0x36, 8);
   addKey("right", Right_Key, 0x82, 8);
   addKey("left", Left_Key, 0x92, 8);
-  addKey("TEXT", Unmapped_Key, 0x30, 8);
-  addKey("HOLD", Unmapped_Key, 0xA8, 8);
-  addKey("INDEX", Unmapped_Key, 0x64, 8);
-  addKey("CANCEL/TIME", Unmapped_Key, 0xB8, 8);
+  addKey("TEXT", Teletext_Key, 0x30, 8);
+  addKey("HOLD", TeletextHold_Key, 0xA8, 8);
+  addKey("INDEX", TeletextIndex_Key, 0x64, 8);
+  addKey("CANCEL/TIME", TeletextTime_Key, 0xB8, 8);
   addKey("RED", Red_Key, 0xF4, 8);
   addKey("GREEN", Green_Key, 0xEC, 8);
   addKey("YELLOW", Yellow_Key, 0xFC, 8);
   addKey("BLUE", Blue_Key, 0xE4, 8);
-  addKey("SIZE", Unmapped_Key, 0x34, 8);
+  addKey("SIZE", TeletextSize_Key, 0x34, 8);
   addKey("S****", Unmapped_Key, 0x74, 8);
-  addKey("REVEAL", Unmapped_Key, 0x7C, 8);
+  addKey("REVEAL", TeletextReveal_Key, 0x7C, 8);
   addKey("MODE", Unmapped_Key, 0xA4, 8);
-  addKey("STORE", Unmapped_Key, 0x78, 8);
+  addKey("STORE", TeletextStore_Key, 0x78, 8);
   addKey("STATUS", Unmapped_Key, 0xB0, 8);
   addKey("BROWSE", Unmapped_Key, 0x6C, 8);
   addKey("PIP", PIP_Key, 0xEE, 8);
   addKey("SOURCE", PIPSource_Key, 0xFA, 8);
   addKey("POSITION", PIPMove_Key, 0x76, 8);
   addKey("EXCHANGE", PIPSwap_Key, 0xFE, 8);
-  addKey("STILL", Unmapped_Key, 0xE6, 8);
+  addKey("STILL", PIPPause_Key, 0xE6, 8);
   addKey("PREVMENU", Exit_Key, 0xD2, 8);
   addKey("ENTER", Select_Key, 0xDE, 8);
-  addKey("VIDEO", Unmapped_Key, 0xCC, 8);
-  addKey("AUDIO", Unmapped_Key, 0xDC, 8);
+  addKey("VIDEO", PictureMode_Key, 0xCC, 8);
+  addKey("AUDIO", SoundMode_Key, 0xDC, 8);
   addKey("ST/MONO", Unmapped_Key, 0xC0, 8);
   addKey("DEGAUSS", Unmapped_Key, 0xCE, 8);
   addKey("DEMO", Unmapped_Key, 0x62, 8);
   addKey("PRESET", Unmapped_Key, 0xA2, 8);
-  addKey("BAND", Unmapped_Key, 0xAE, 8);
+  addKey("BAND", TunerInput_Key, 0xAE, 8);
   addKey("AFT", Unmapped_Key, 0xA6, 8);
   addKey("SKIP", Unmapped_Key, 0xB6, 8);
   addKey("REALNAME", Unmapped_Key, 0xDA, 8);
@@ -92,11 +103,23 @@ MitsubishiTV1::MitsubishiTV1(
 
 
 MitsubishiTV1a::MitsubishiTV1a(
-  QObject *guiObject,
   unsigned int index)
-  : MitsubishiTV1(guiObject, index)
+  : MitsubishiTV1(index)
 {
   setKeysetName("TV Keyset 1a");
+}
+
+
+void MitsubishiTV1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MitsubishiTV1::populateProtocol(guiObject);
 
   addKey("TURNLEFT", Unmapped_Key, 0xAC, 8);
   addKey("TURNRIGHT", Unmapped_Key, 0xB4, 8);
@@ -106,27 +129,39 @@ MitsubishiTV1a::MitsubishiTV1a(
 
 
 MitsubishiVCR1::MitsubishiVCR1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "VCR Keyset 1",
       Mitsubishi_Make,
       index)
 {
-  NECProtocol *np = new NECProtocol(
+}
+
+
+
+void MitsubishiVCR1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LIRCProtocol *lp = new LIRCProtocol(
     guiObject,
     index,
     300, 900,
     300, 2100,
     53815, true);
 
-  threadableProtocol = np;
+  threadableProtocol = lp;
 
-  np->setTrailerPulse(300);
+  lp->setTrailerPulse(300);
 
-  np->setPreData(0xEA, 8);
+//  lp->setMinimumRepetitions(1);
 
-//  np->setMinimumRepetitions(1);
+  setPreData(0xEA, 8);
 
   addKey("POWER", Power_Key, 0x40, 8);
   addKey("CH-", ChannelDown_Key, 0x48, 8);
@@ -144,11 +179,11 @@ MitsubishiVCR1::MitsubishiVCR1(
   addKey("REC", Record_Key, 0x30, 8);
   addKey("PAUSE", Pause_Key, 0x38, 8);
   addKey("STOP", Stop_Key, 0x28, 8);
-  addKey("SLOW", Unmapped_Key, 0x2C, 8); // "UP"
+  addKey("SLOW", Slow_Key, 0x2C, 8); // "UP"
   addKey("REW", Rewind_Key, 0x34, 8);
   addKey("PLAY", Play_Key, 0x20, 8);
   addKey("FF", FastForward_Key, 0x24, 8);
-  addKey("REPEAT", Unmapped_Key, 0xE8, 8);
+  addKey("REPEAT", Repeat_Key, 0xE8, 8);
   addKey("SKIP_SEARCH", Advance_Key, 0xBC, 8);
   addKey("INDEX_SEARCH-", Previous_Key, 0x68, 8);
   addKey("INDEX_SEARCH+", Next_Key, 0x70, 8);
@@ -173,7 +208,7 @@ MitsubishiVCR1::MitsubishiVCR1(
   addKey("DAILY/WEEKLY", Unmapped_Key, 0xF2, 8);
   addKey("COUNT_RES", Unmapped_Key, 0xDC, 8);
   addKey("display", Info_Key, 0xE4, 8); // "DATA_SCRN"
-  addKey("x2", Unmapped_Key, 0x5C, 8);
+  addKey("x2", PlayX2_Key, 0x5C, 8);
   addKey("audio/video", Unmapped_Key, 0x02, 8);
   addKey("adjust+", Right_Key, 0x82, 8);
   addKey("cancel", Exit_Key, 0xD0, 8);
@@ -185,11 +220,23 @@ MitsubishiVCR1::MitsubishiVCR1(
 
 
 MitsubishiVCR1a::MitsubishiVCR1a(
-  QObject *guiObject,
   unsigned int index)
-  : MitsubishiVCR1(guiObject, index)
+  : MitsubishiVCR1(index)
 {
   setKeysetName("VCR Keyset 1a");
+}
+
+
+void MitsubishiVCR1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  MitsubishiVCR1::populateProtocol(guiObject);
 
   addKey("->", Unmapped_Key, 0xAC, 8); // Shuttle right
   addKey("<-", Unmapped_Key, 0xD0, 8);  // Shuttle left