Adding Macros!
authorJohn Pietrzak <john@pietrzak.org>
Sat, 15 Sep 2012 00:48:20 +0000 (20:48 -0400)
committerJohn Pietrzak <john@pietrzak.org>
Sat, 15 Sep 2012 00:48:20 +0000 (20:48 -0400)
I'm going ahead and pushing up an initial implementation of macros.
They are currently limited in capability, not completely debugged,
and thoroughly undocumented, but probably ready for testing anyway.
Also in this commit, updates to the Creative, Grundig, and RCA keysets,
and a bugfix for the RCA protocol.

55 files changed:
dialogs/pircreatecommanddialog.cpp
dialogs/pircreatecommanddialog.h
dialogs/pircreatecommanddialog.ui
dialogs/pirdeletemacrodialog.cpp [new file with mode: 0644]
dialogs/pirdeletemacrodialog.h [new file with mode: 0644]
dialogs/pirdeletemacrodialog.ui [new file with mode: 0644]
dialogs/pireditcommanddialog.cpp [new file with mode: 0644]
dialogs/pireditcommanddialog.h [new file with mode: 0644]
dialogs/pireditcommanddialog.ui [new file with mode: 0644]
dialogs/pireditmacrodialog.cpp [new file with mode: 0644]
dialogs/pireditmacrodialog.h [new file with mode: 0644]
dialogs/pireditmacrodialog.ui [new file with mode: 0644]
dialogs/pirselectmacrodialog.cpp
dialogs/pirselectmacrodialog.h
dialogs/pirselectmacrodialog.ui
dialogs/pirtabschoicedialog.cpp
forms/pirmacroform.cpp
forms/pirmacroform.h
forms/pirmacroform.ui
forms/piruserform.cpp [new file with mode: 0644]
forms/piruserform.h [new file with mode: 0644]
forms/piruserform.ui [new file with mode: 0644]
keysets/creative.cpp
keysets/creative.h
keysets/grundig.cpp
keysets/grundig.h
keysets/rca.cpp
macros/pirmacro.cpp
macros/pirmacro.h
macros/pirmacrocommanditem.cpp
macros/pirmacrocommanditem.h
macros/pirmacromanager.cpp [new file with mode: 0644]
macros/pirmacromanager.h [new file with mode: 0644]
macros/pirmacropack.cpp
macros/pirmacropack.h
macros/pirreversemultitap.cpp
macros/pirreversemultitap.h
mainwindow.cpp
mainwindow.h
pierogi.pro
pierogi.pro.user
pirkeynames.cpp
pirkeynames.h
pirkeysetmanager.cpp
pirpanelmanager.cpp
pirpanelmanager.h
pirpanelnames.h
pirpreferencesform.cpp
pirpreferencesform.h
pirpreferencesform.ui
pirselectkeysetform.cpp
pirselectkeysetform.h
protocols/rcaprotocol.cpp
qtc_packaging/debian_fremantle/changelog
qtc_packaging/debian_fremantle/control

index 7f1cb19..8daa979 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "mainwindow.h"
 
+extern PIRKeynameMgr keynameMgr;
+
 /*
 PIRCreateCommandDialog::PIRCreateCommandDialog(QWidget *parent) :
   QDialog(parent),
@@ -13,15 +15,259 @@ PIRCreateCommandDialog::PIRCreateCommandDialog(QWidget *parent) :
 */
 
 
-PIRCreateCommandDialog::PIRCreateCommandDialog(
-  MainWindow *mw)
-  : QDialog(mw),
+PIRCreateCommandDialog::PIRCreateCommandDialog()
+  : QDialog(0),
     ui(new Ui::PIRCreateCommandDialog)
 {
   ui->setupUi(this);
+
+  setupPowerKeys(ui->powerKeysComboBox);
+  setupNumericKeys(ui->numericKeysComboBox);
+  setupChannelKeys(ui->channelKeysComboBox);
+  setupVolumeKeys(ui->volumeKeysComboBox);
+  setupMenuKeys(ui->menuKeysComboBox);
+  setupMediaKeys(ui->mediaKeysComboBox);
+  setupInputKeys(ui->inputKeysComboBox);
+  keynameMgr.populateComboBox(ui->allKeysComboBox);
 }
 
+
 PIRCreateCommandDialog::~PIRCreateCommandDialog()
 {
   delete ui;
 }
+
+
+QComboBox *PIRCreateCommandDialog::getKeysetComboBox()
+{
+  return ui->keysetComboBox;
+}
+
+
+CommandType PIRCreateCommandDialog::getCommandType()
+{
+  switch (ui->commandTypeComboBox->currentIndex())
+  {
+  case 0:
+    return Keyset_Command;
+
+  case 1:
+    return Key_Command;
+
+  case 2:
+    return Pause_Command;
+
+  default:
+    return No_Command;
+  }
+}
+
+
+QString PIRCreateCommandDialog::getKeysetName()
+{
+  return ui->keysetComboBox->itemText(
+    ui->keysetComboBox->currentIndex());
+}
+
+
+unsigned int PIRCreateCommandDialog::getKeysetID()
+{
+  return ui->keysetComboBox->itemData(
+    ui->keysetComboBox->currentIndex()).toInt();
+}
+
+
+PIRKeyName PIRCreateCommandDialog::getKeyName()
+{
+  switch (ui->keyCategoryComboBox->currentIndex())
+  {
+  case 0:
+    return (PIRKeyName) ui->powerKeysComboBox->itemData(
+      ui->powerKeysComboBox->currentIndex()).toInt();
+
+  case 1:
+    return (PIRKeyName) ui->numericKeysComboBox->itemData(
+      ui->numericKeysComboBox->currentIndex()).toInt();
+
+  case 2:
+    return (PIRKeyName) ui->channelKeysComboBox->itemData(
+      ui->channelKeysComboBox->currentIndex()).toInt();
+
+  case 3:
+    return (PIRKeyName) ui->volumeKeysComboBox->itemData(
+      ui->volumeKeysComboBox->currentIndex()).toInt();
+
+  case 4:
+    return (PIRKeyName) ui->menuKeysComboBox->itemData(
+      ui->menuKeysComboBox->currentIndex()).toInt();
+
+  case 5:
+    return (PIRKeyName) ui->mediaKeysComboBox->itemData(
+      ui->mediaKeysComboBox->currentIndex()).toInt();
+
+  case 6:
+    return (PIRKeyName) ui->inputKeysComboBox->itemData(
+      ui->inputKeysComboBox->currentIndex()).toInt();
+
+  case 7:
+    return (PIRKeyName) ui->allKeysComboBox->itemData(
+      ui->allKeysComboBox->currentIndex()).toInt();
+
+  default:
+    return Unmapped_Key;
+  }
+}
+
+
+unsigned int PIRCreateCommandDialog::getTimeToWait()
+{
+  return ui->pauseTimeSpinBox->value();
+}
+
+
+void PIRCreateCommandDialog::setupPowerKeys(
+  QComboBox *cb)
+{
+  setupKey(cb, Power_Key);
+  setupKey(cb, PowerOn_Key);
+  setupKey(cb, PowerOff_Key);
+}
+
+
+void PIRCreateCommandDialog::setupNumericKeys(
+  QComboBox *cb)
+{
+  setupKey(cb, Zero_Key);
+  setupKey(cb, One_Key);
+  setupKey(cb, Two_Key);
+  setupKey(cb, Three_Key);
+  setupKey(cb, Four_Key);
+  setupKey(cb, Five_Key);
+  setupKey(cb, Six_Key);
+  setupKey(cb, Seven_Key);
+  setupKey(cb, Eight_Key);
+  setupKey(cb, Nine_Key);
+  setupKey(cb, Enter_Key);
+  setupKey(cb, Clear_Key);
+  setupKey(cb, PlusOneHundred_Key);
+  setupKey(cb, Dash_Key);
+  setupKey(cb, DoubleDigit_Key);
+}
+
+
+void PIRCreateCommandDialog::setupChannelKeys(
+  QComboBox *cb)
+{
+  setupKey(cb, ChannelUp_Key);
+  setupKey(cb, ChannelDown_Key);
+  setupKey(cb, PrevChannel_Key);
+}
+
+
+void PIRCreateCommandDialog::setupVolumeKeys(
+  QComboBox *cb)
+{
+  setupKey(cb, VolumeUp_Key);
+  setupKey(cb, VolumeDown_Key);
+  setupKey(cb, Mute_Key);
+  setupKey(cb, Surround_Key);
+  setupKey(cb, RearVolumeUp_Key);
+  setupKey(cb, RearVolumeDown_Key);
+  setupKey(cb, CenterVolumeUp_Key);
+  setupKey(cb, CenterVolumeDown_Key);
+  setupKey(cb, WooferUp_Key);
+  setupKey(cb, WooferDown_Key);
+}
+
+
+void PIRCreateCommandDialog::setupMenuKeys(
+  QComboBox *cb)
+{
+  setupKey(cb, Menu_Key);
+  setupKey(cb, Up_Key);
+  setupKey(cb, Down_Key);
+  setupKey(cb, Left_Key);
+  setupKey(cb, Right_Key);
+  setupKey(cb, Select_Key);
+  setupKey(cb, Exit_Key);
+  setupKey(cb, Guide_Key);
+}
+
+
+void PIRCreateCommandDialog::setupMediaKeys(
+  QComboBox *cb)
+{
+  setupKey(cb, Play_Key);
+  setupKey(cb, Pause_Key);
+  setupKey(cb, Stop_Key);
+  setupKey(cb, FastForward_Key);
+  setupKey(cb, Rewind_Key);
+  setupKey(cb, PlayX2_Key);
+  setupKey(cb, Next_Key);
+  setupKey(cb, Previous_Key);
+  setupKey(cb, StepForward_Key);
+  setupKey(cb, StepBack_Key);
+  setupKey(cb, Advance_Key);
+  setupKey(cb, Replay_Key);
+  setupKey(cb, Eject_Key);
+  setupKey(cb, Random_Key);
+  setupKey(cb, Repeat_Key);
+  setupKey(cb, RepeatAB_Key);
+  setupKey(cb, Slow_Key);
+  setupKey(cb, SlowPlus_Key);
+  setupKey(cb, SlowMinus_Key);
+}
+
+
+void PIRCreateCommandDialog::setupInputKeys(
+  QComboBox *cb)
+{
+  setupKey(cb, Input_Key);
+  setupKey(cb, CDInput_Key);
+  setupKey(cb, PhonoInput_Key);
+  setupKey(cb, TunerInput_Key);
+  setupKey(cb, LineInput_Key);
+  setupKey(cb, TapeInput_Key);
+  setupKey(cb, AntennaInput_Key);
+  setupKey(cb, Antenna2Input_Key);
+  setupKey(cb, PCInput_Key);
+  setupKey(cb, CompositeInput_Key);
+  setupKey(cb, Composite2Input_Key);
+  setupKey(cb, SVideoInput_Key);
+  setupKey(cb, SVideo2Input_Key);
+  setupKey(cb, ComponentInput_Key);
+  setupKey(cb, Component2Input_Key);
+  setupKey(cb, HDMIInput_Key);
+  setupKey(cb, HDMI2Input_Key);
+  setupKey(cb, HDMI3Input_Key);
+  setupKey(cb, ScartInput_Key);
+  setupKey(cb, AuxInput_Key);
+  setupKey(cb, MDInput_Key);
+  setupKey(cb, LDInput_Key);
+  setupKey(cb, DVDInput_Key);
+  setupKey(cb, VCRInput_Key);
+  setupKey(cb, HDDInput_Key);
+  setupKey(cb, CableInput_Key);
+  setupKey(cb, SatInput_Key);
+  setupKey(cb, DVRInput_Key);
+  setupKey(cb, OpticalInput_Key);
+  setupKey(cb, DigitalCoaxInput_Key);
+  setupKey(cb, USBInput_Key);
+}
+
+
+void PIRCreateCommandDialog::setupKey(
+  QComboBox *cb,
+  PIRKeyName keyName)
+{
+  cb->addItem(
+    keynameMgr.getKeynameString(keyName),
+    QVariant(keyName));
+}
+
+
+void PIRCreateCommandDialog::init()
+{
+  ui->commandTypeComboBox->setCurrentIndex(0);
+  ui->commandEditorStackedWidget->setCurrentIndex(0);
+}
index 2c7d699..acfe046 100644 (file)
@@ -3,7 +3,17 @@
 
 #include <QDialog>
 
-class MainWindow;
+#include "pirkeynames.h"
+
+class QComboBox;
+
+enum CommandType
+{
+  No_Command,
+  Key_Command,
+  Keyset_Command,
+  Pause_Command
+};
 
 namespace Ui {
 class PIRCreateCommandDialog;
@@ -16,12 +26,50 @@ class PIRCreateCommandDialog : public QDialog
 public:
 //  explicit PIRCreateCommandDialog(QWidget *parent = 0);
 
-  PIRCreateCommandDialog(
-    MainWindow *mw);
+  PIRCreateCommandDialog();
 
   ~PIRCreateCommandDialog();
+
+  QComboBox *getKeysetComboBox();
+
+  CommandType getCommandType();
+
+  QString getKeysetName();
+
+  unsigned int getKeysetID();
+
+  PIRKeyName getKeyName();
+
+  unsigned int getTimeToWait();
+
+  void init();
   
 private:
+  void setupPowerKeys(
+    QComboBox *cb);
+
+  void setupNumericKeys(
+    QComboBox *cb);
+
+  void setupChannelKeys(
+    QComboBox *cb);
+
+  void setupVolumeKeys(
+    QComboBox *cb);
+
+  void setupMenuKeys(
+    QComboBox *cb);
+
+  void setupMediaKeys(
+    QComboBox *cb);
+
+  void setupInputKeys(
+    QComboBox *cb);
+
+  void setupKey(
+    QComboBox *cb,
+    PIRKeyName keyName);
+
   Ui::PIRCreateCommandDialog *ui;
 };
 
index abffb4b..a0eb4ea 100644 (file)
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Choose a Command</string>
+   <string>Command Choices</string>
   </property>
   <layout class="QGridLayout" name="gridLayout">
    <item row="0" column="0">
-    <widget class="QRadioButton" name="selectKeysetRadioButton">
-     <property name="text">
-      <string>Select Keyset</string>
-     </property>
+    <widget class="QComboBox" name="commandTypeComboBox">
+     <item>
+      <property name="text">
+       <string>Choose Keyset Command</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Execute Key Command</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Pause Command</string>
+      </property>
+     </item>
     </widget>
    </item>
-   <item row="0" column="1">
-    <widget class="QComboBox" name="keysetComboBox"/>
-   </item>
-   <item row="1" column="0">
-    <widget class="QRadioButton" name="pressKeyRadioButton">
-     <property name="text">
-      <string>Press a Key</string>
+   <item row="1" column="0" colspan="2">
+    <widget class="QStackedWidget" name="commandEditorStackedWidget">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
      </property>
-    </widget>
-   </item>
-   <item row="1" column="1">
-    <widget class="QComboBox" name="keyComboBox"/>
-   </item>
-   <item row="2" column="0">
-    <widget class="QRadioButton" name="pauseRadioButton">
-     <property name="text">
-      <string>Pause (in Seconds)</string>
+     <property name="currentIndex">
+      <number>2</number>
      </property>
+     <widget class="QWidget" name="keysetPage">
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QLabel" name="keysetLabel">
+         <property name="text">
+          <string>Keyset:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="keysetComboBox">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="keyPage">
+      <layout class="QGridLayout" name="gridLayout_2">
+       <item row="0" column="0">
+        <widget class="QLabel" name="keyCategoryLabel">
+         <property name="text">
+          <string>Key Category: </string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="QComboBox" name="keyCategoryComboBox">
+         <item>
+          <property name="text">
+           <string>Power Keys</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Numeric Keys</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Channel Keys</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Volume Keys</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Menu Keys</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Media Keys</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Input Keys</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>All Keys</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="1" column="0" colspan="2">
+        <widget class="QStackedWidget" name="keySelectionStackedWidget">
+         <property name="currentIndex">
+          <number>0</number>
+         </property>
+         <widget class="QWidget" name="powerKeysPage">
+          <layout class="QHBoxLayout" name="horizontalLayout_3">
+           <item>
+            <widget class="QComboBox" name="powerKeysComboBox"/>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="numericKeysPage">
+          <layout class="QHBoxLayout" name="horizontalLayout_4">
+           <item>
+            <widget class="QComboBox" name="numericKeysComboBox"/>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="channelKeysPage">
+          <layout class="QHBoxLayout" name="horizontalLayout_5">
+           <item>
+            <widget class="QComboBox" name="channelKeysComboBox"/>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="volumeKeysPage">
+          <layout class="QHBoxLayout" name="horizontalLayout_6">
+           <item>
+            <widget class="QComboBox" name="volumeKeysComboBox"/>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="menuKeysPage">
+          <layout class="QHBoxLayout" name="horizontalLayout_7">
+           <item>
+            <widget class="QComboBox" name="menuKeysComboBox"/>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="mediaKeysPage">
+          <layout class="QHBoxLayout" name="horizontalLayout_8">
+           <item>
+            <widget class="QComboBox" name="mediaKeysComboBox"/>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="inputKeysPage">
+          <layout class="QHBoxLayout" name="horizontalLayout_9">
+           <item>
+            <widget class="QComboBox" name="inputKeysComboBox"/>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="allKeysPage">
+          <layout class="QHBoxLayout" name="horizontalLayout_10">
+           <item>
+            <widget class="QComboBox" name="allKeysComboBox">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="pausePage">
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <item>
+        <widget class="QLabel" name="pauseLabel">
+         <property name="text">
+          <string>Pause duration (in seconds)</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QSpinBox" name="pauseTimeSpinBox">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+         <property name="maximum">
+          <number>9999</number>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
    <item row="2" column="1">
-    <widget class="QSpinBox" name="pauseTimeSpinBox">
-     <property name="maximum">
-      <number>9999</number>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0" colspan="2">
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>commandTypeComboBox</sender>
+   <signal>currentIndexChanged(int)</signal>
+   <receiver>commandEditorStackedWidget</receiver>
+   <slot>setCurrentIndex(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>325</x>
+     <y>22</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>500</x>
+     <y>200</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>keyCategoryComboBox</sender>
+   <signal>currentIndexChanged(int)</signal>
+   <receiver>keySelectionStackedWidget</receiver>
+   <slot>setCurrentIndex(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>589</x>
+     <y>64</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>399</x>
+     <y>249</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>
diff --git a/dialogs/pirdeletemacrodialog.cpp b/dialogs/pirdeletemacrodialog.cpp
new file mode 100644 (file)
index 0000000..2bce0cd
--- /dev/null
@@ -0,0 +1,23 @@
+#include "pirdeletemacrodialog.h"
+#include "ui_pirdeletemacrodialog.h"
+
+#include "macros/pirmacro.h"
+
+PIRDeleteMacroDialog::PIRDeleteMacroDialog(QWidget *parent) :
+  QDialog(parent),
+  ui(new Ui::PIRDeleteMacroDialog)
+{
+  ui->setupUi(this);
+}
+
+PIRDeleteMacroDialog::~PIRDeleteMacroDialog()
+{
+  delete ui;
+}
+
+
+void PIRDeleteMacroDialog::setup(
+  PIRMacro *macro)
+{
+  ui->macroNameLabel->setText(macro->getName());
+}
diff --git a/dialogs/pirdeletemacrodialog.h b/dialogs/pirdeletemacrodialog.h
new file mode 100644 (file)
index 0000000..3132228
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef PIRDELETEMACRODIALOG_H
+#define PIRDELETEMACRODIALOG_H
+
+#include <QDialog>
+
+class PIRMacro;
+
+namespace Ui {
+class PIRDeleteMacroDialog;
+}
+
+class PIRDeleteMacroDialog : public QDialog
+{
+  Q_OBJECT
+  
+public:
+  explicit PIRDeleteMacroDialog(QWidget *parent = 0);
+  ~PIRDeleteMacroDialog();
+
+  void setup(
+    PIRMacro *macro);
+  
+private:
+  Ui::PIRDeleteMacroDialog *ui;
+};
+
+#endif // PIRDELETEMACRODIALOG_H
diff --git a/dialogs/pirdeletemacrodialog.ui b/dialogs/pirdeletemacrodialog.ui
new file mode 100644 (file)
index 0000000..a24d761
--- /dev/null
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PIRDeleteMacroDialog</class>
+ <widget class="QDialog" name="PIRDeleteMacroDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Delete Macro</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="margin">
+    <number>8</number>
+   </property>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="prefixLabel">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Name: </string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="macroNameLabel">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Unnamed</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QLabel" name="questionLabel">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Delete this macro?</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="standardButtons">
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::No|QDialogButtonBox::Yes</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PIRDeleteMacroDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PIRDeleteMacroDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/dialogs/pireditcommanddialog.cpp b/dialogs/pireditcommanddialog.cpp
new file mode 100644 (file)
index 0000000..837bcaa
--- /dev/null
@@ -0,0 +1,45 @@
+#include "pireditcommanddialog.h"
+#include "ui_pireditcommanddialog.h"
+
+#include "macros/pirmacrocommanditem.h"
+
+PIREditCommandDialog::PIREditCommandDialog(QWidget *parent) :
+  QDialog(parent),
+  ui(new Ui::PIREditCommandDialog)
+{
+  ui->setupUi(this);
+}
+
+PIREditCommandDialog::~PIREditCommandDialog()
+{
+  delete ui;
+}
+
+
+void PIREditCommandDialog::setup(
+  QString typeString,
+  QString name)
+{
+  ui->commandTypeLabel->setText(typeString);
+
+  ui->commandValueLabel->setText(name);
+}
+
+
+void PIREditCommandDialog::on_moveUpButton_clicked()
+{
+  emit moveCommandUp();
+  accept();
+}
+
+void PIREditCommandDialog::on_moveDownButton_clicked()
+{
+  emit moveCommandDown();
+  accept();
+}
+
+void PIREditCommandDialog::on_deleteButton_clicked()
+{
+  emit deleteCommand();
+  accept();
+}
diff --git a/dialogs/pireditcommanddialog.h b/dialogs/pireditcommanddialog.h
new file mode 100644 (file)
index 0000000..5719fbb
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef PIREDITCOMMANDDIALOG_H
+#define PIREDITCOMMANDDIALOG_H
+
+#include <QDialog>
+
+class PIRMacroCommandItem;
+
+namespace Ui {
+class PIREditCommandDialog;
+}
+
+class PIREditCommandDialog : public QDialog
+{
+  Q_OBJECT
+  
+public:
+  explicit PIREditCommandDialog(QWidget *parent = 0);
+  ~PIREditCommandDialog();
+
+  void setup(
+    QString typeString,
+    QString name);
+
+signals:
+  void deleteCommand();
+  void moveCommandUp();
+  void moveCommandDown();
+
+private slots:
+  void on_moveUpButton_clicked();
+  void on_moveDownButton_clicked();
+  void on_deleteButton_clicked();
+
+private:
+  Ui::PIREditCommandDialog *ui;
+};
+
+#endif // PIREDITCOMMANDDIALOG_H
diff --git a/dialogs/pireditcommanddialog.ui b/dialogs/pireditcommanddialog.ui
new file mode 100644 (file)
index 0000000..5a5d543
--- /dev/null
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PIREditCommandDialog</class>
+ <widget class="QDialog" name="PIREditCommandDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Edit Command</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="commandTypeLabel">
+       <property name="text">
+        <string>Command Type</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="commandValueLabel">
+       <property name="text">
+        <string>Command Value</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QPushButton" name="moveUpButton">
+       <property name="text">
+        <string>Move Up</string>
+       </property>
+       <property name="icon">
+        <iconset resource="../PierogiResources.qrc">
+         <normaloff>:/icons/br_up_icon&amp;48.png</normaloff>:/icons/br_up_icon&amp;48.png</iconset>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="moveDownButton">
+       <property name="text">
+        <string>Move Down</string>
+       </property>
+       <property name="icon">
+        <iconset resource="../PierogiResources.qrc">
+         <normaloff>:/icons/br_down_icon&amp;48.png</normaloff>:/icons/br_down_icon&amp;48.png</iconset>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="deleteButton">
+       <property name="text">
+        <string>Delete</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="../PierogiResources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PIREditCommandDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PIREditCommandDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/dialogs/pireditmacrodialog.cpp b/dialogs/pireditmacrodialog.cpp
new file mode 100644 (file)
index 0000000..24abdc2
--- /dev/null
@@ -0,0 +1,118 @@
+#include "pireditmacrodialog.h"
+#include "ui_pireditmacrodialog.h"
+
+#include <QTreeWidgetItem>
+#include "macros/pirmacro.h"
+
+#include <iostream>
+
+PIREditMacroDialog::PIREditMacroDialog(QWidget *parent) :
+  QDialog(parent),
+  ui(new Ui::PIREditMacroDialog)
+{
+  ui->setupUi(this);
+
+  // Set up the button names:
+  ui->macroButtonComboBox->addItem("None");
+  ui->macroButtonComboBox->addItem("User Defined 1");
+  ui->macroButtonComboBox->addItem("User Defined 2");
+  ui->macroButtonComboBox->addItem("User Defined 3");
+  ui->macroButtonComboBox->addItem("User Defined 4");
+  ui->macroButtonComboBox->addItem("User Defined 5");
+  ui->macroButtonComboBox->addItem("User Defined 6");
+
+  // Set up the key names:
+  ui->macroKeyComboBox->addItem("None", 0);
+  ui->macroKeyComboBox->addItem("A", 'A');
+  ui->macroKeyComboBox->addItem("B", 'B');
+  ui->macroKeyComboBox->addItem("C", 'C');
+  ui->macroKeyComboBox->addItem("D", 'D');
+  ui->macroKeyComboBox->addItem("E", 'E');
+  ui->macroKeyComboBox->addItem("F", 'F');
+  ui->macroKeyComboBox->addItem("G", 'G');
+  ui->macroKeyComboBox->addItem("H", 'H');
+  ui->macroKeyComboBox->addItem("I", 'I');
+  ui->macroKeyComboBox->addItem("J", 'J');
+  ui->macroKeyComboBox->addItem("K", 'K');
+  ui->macroKeyComboBox->addItem("L", 'L');
+  ui->macroKeyComboBox->addItem("M", 'M');
+  ui->macroKeyComboBox->addItem("N", 'N');
+  ui->macroKeyComboBox->addItem("O", 'O');
+  ui->macroKeyComboBox->addItem("P", 'P');
+  ui->macroKeyComboBox->addItem("Q", 'Q');
+  ui->macroKeyComboBox->addItem("R", 'R');
+  ui->macroKeyComboBox->addItem("S", 'S');
+  ui->macroKeyComboBox->addItem("T", 'T');
+  ui->macroKeyComboBox->addItem("U", 'U');
+  ui->macroKeyComboBox->addItem("V", 'V');
+  ui->macroKeyComboBox->addItem("W", 'W');
+  ui->macroKeyComboBox->addItem("X", 'X');
+  ui->macroKeyComboBox->addItem("Y", 'Y');
+  ui->macroKeyComboBox->addItem("Z", 'Z');
+  ui->macroKeyComboBox->addItem("Space", ' ');
+}
+
+
+PIREditMacroDialog::~PIREditMacroDialog()
+{
+  delete ui;
+}
+
+
+void PIREditMacroDialog::clear()
+{
+  ui->macroNameLineEdit->clear();
+
+  ui->macroButtonComboBox->setCurrentIndex(0);
+
+  ui->macroKeyComboBox->setCurrentIndex(0);
+}
+
+
+void PIREditMacroDialog::setup(
+  QTreeWidgetItem *item)
+{
+  if (!item) return;
+
+  PIRMacro *m = dynamic_cast<PIRMacro *> (item);
+
+  if (!m) return;
+
+  ui->macroNameLineEdit->setText(m->getName());
+
+  ui->macroButtonComboBox->setCurrentIndex(m->getButtonID());
+
+  char key = m->getKey();
+  int index = 0;
+  int count = ui->macroKeyComboBox->count();
+
+  while (index < count)
+  {
+    if (ui->macroKeyComboBox->itemData(index).toInt() == key)
+    {
+      ui->macroKeyComboBox->setCurrentIndex(index);
+      break;
+    }
+
+    ++index;
+  }
+}
+
+
+QString PIREditMacroDialog::getText()
+{
+  return ui->macroNameLineEdit->text();
+}
+
+
+char PIREditMacroDialog::getKey()
+{
+  return ui->macroKeyComboBox->itemData(
+    ui->macroKeyComboBox->currentIndex()).toInt();
+}
+
+
+unsigned int PIREditMacroDialog::getButtonID()
+{
+  return ui->macroButtonComboBox->currentIndex();
+}
diff --git a/dialogs/pireditmacrodialog.h b/dialogs/pireditmacrodialog.h
new file mode 100644 (file)
index 0000000..876d098
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef PIREDITMACRODIALOG_H
+#define PIREDITMACRODIALOG_H
+
+#include <QDialog>
+
+class QTreeWidgetItem;
+
+namespace Ui {
+class PIREditMacroDialog;
+}
+
+class PIREditMacroDialog : public QDialog
+{
+  Q_OBJECT
+  
+public:
+  explicit PIREditMacroDialog(QWidget *parent = 0);
+  ~PIREditMacroDialog();
+
+  void clear();
+
+  void setup(
+    QTreeWidgetItem *item);
+
+  QString getText();
+
+  char getKey();
+
+  unsigned int getButtonID();
+  
+private:
+  Ui::PIREditMacroDialog *ui;
+};
+
+#endif // PIREDITMACRODIALOG_H
diff --git a/dialogs/pireditmacrodialog.ui b/dialogs/pireditmacrodialog.ui
new file mode 100644 (file)
index 0000000..9661c3a
--- /dev/null
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PIREditMacroDialog</class>
+ <widget class="QDialog" name="PIREditMacroDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Macro Properties</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <property name="margin">
+    <number>8</number>
+   </property>
+   <item row="0" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="macroNameLabel">
+       <property name="text">
+        <string>Name:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="macroNameLineEdit"/>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QLabel" name="panelButtonLabel">
+         <property name="text">
+          <string>Assigned Panel Button:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="macroButtonComboBox"/>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QLabel" name="keyboardKeyLabel">
+         <property name="text">
+          <string>Assigned Keyboard Key:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="macroKeyComboBox"/>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item row="2" column="0">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PIREditMacroDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PIREditMacroDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index 6d58a3a..96c353f 100644 (file)
@@ -2,8 +2,13 @@
 #include "ui_pirselectmacrodialog.h"
 
 #include "macros/pirmacropack.h"
+#include "macros/pirmacro.h"
 #include "macros/pirreversemultitap.h"
 #include "mainwindow.h"
+#include <QMaemo5InformationBox>
+
+// Debugging includes:
+#include <iostream>
 
 /*
 PIRSelectMacroDialog::PIRSelectMacroDialog(QWidget *parent) :
@@ -15,25 +20,30 @@ PIRSelectMacroDialog::PIRSelectMacroDialog(QWidget *parent) :
 */
 
 
-PIRSelectMacroDialog::PIRSelectMacroDialog(
-  MainWindow *mw)
-  : QDialog(mw),
+PIRSelectMacroDialog::PIRSelectMacroDialog()
+  : QDialog(0),
     ui(new Ui::PIRSelectMacroDialog)
-//    mainWindow(mw)
 {
   ui->setupUi(this);
-
-  userPack = new PIRMacroPack(ui->macroTreeWidget, "User Defined Macros");
-  multitapPack = new PIRReverseMultitap(ui->macroTreeWidget, mw);
 }
 
 
 PIRSelectMacroDialog::~PIRSelectMacroDialog()
 {
+  // This is a hack to get around object ownership issues:
+  while (ui->macroTreeWidget->topLevelItemCount())
+  {
+    ui->macroTreeWidget->takeTopLevelItem(0);
+  }
+
   delete ui;
+}
 
-  delete userPack;
-  delete multitapPack;
+
+void PIRSelectMacroDialog::addPack(
+  PIRMacroPack *pack)
+{
+  ui->macroTreeWidget->addTopLevelItem(pack);
 }
 
 
@@ -65,3 +75,58 @@ void PIRSelectMacroDialog::on_buttonBox_rejected()
 
 }
 */
+
+void PIRSelectMacroDialog::on_newButton_clicked()
+{
+  emit newMacroRequested();
+  accept();
+}
+
+
+void PIRSelectMacroDialog::on_editButton_clicked()
+{
+  // Find the first selected macro, if any:
+  QList<QTreeWidgetItem *> items = ui->macroTreeWidget->selectedItems();
+
+  if (items.size() > 0)
+  {
+    if (items[0]->parent() == 0)
+    {
+      QMaemo5InformationBox::information(0, "Cannot Edit MacroPacks");
+    }
+    else
+    {
+      emit editMacroRequested(items[0]);
+    }
+  }
+
+  accept();
+}
+
+
+void PIRSelectMacroDialog::on_deleteButton_clicked()
+{
+  // Find the first selected macro, if any:
+  QList<QTreeWidgetItem *> items = ui->macroTreeWidget->selectedItems();
+
+  if (items.size() > 0)
+  {
+    if (items[0]->parent() == 0)
+    {
+      QMaemo5InformationBox::information(0, "Cannot Delete MacroPacks");
+    }
+    else
+    {
+      emit deleteMacroRequested(items[0]);
+    }
+  }
+
+  accept();
+}
+
+
+void PIRSelectMacroDialog::resetIndices()
+{
+  ui->macroTreeWidget->setCurrentItem(
+    ui->macroTreeWidget->topLevelItem(0));
+}
index af3c901..9541d91 100644 (file)
@@ -3,8 +3,8 @@
 
 #include <QDialog>
 
-class MainWindow;
 class PIRMacroPack;
+class PIRMacro;
 class PIRReverseMultitap;
 class QTreeWidgetItem;
 
@@ -19,26 +19,36 @@ class PIRSelectMacroDialog : public QDialog
 public:
 //  explicit PIRSelectMacroDialog(QWidget *parent = 0);
 
-  PIRSelectMacroDialog(
-    MainWindow *mw);
+  PIRSelectMacroDialog();
 
   ~PIRSelectMacroDialog();
 
+  void addPack(
+    PIRMacroPack *pack);
+
+  void resetIndices();
+
 signals:
   void macroChosen(
     QTreeWidgetItem *item);
+
+  void newMacroRequested();
+
+  void editMacroRequested(
+    QTreeWidgetItem *item);
+
+  void deleteMacroRequested(
+    QTreeWidgetItem *item);
   
 private slots:
   void on_buttonBox_accepted();
 //  void on_buttonBox_rejected();
+  void on_newButton_clicked();
+  void on_editButton_clicked();
+  void on_deleteButton_clicked();
 
 private:
   Ui::PIRSelectMacroDialog *ui;
-
-  PIRMacroPack *userPack;
-  PIRReverseMultitap *multitapPack;
-
-//  MainWindow *mainWindow;
 };
 
 #endif // PIRSELECTMACRODIALOG_H
index 9579059..c3906ed 100644 (file)
@@ -17,7 +17,7 @@
    <property name="margin">
     <number>8</number>
    </property>
-   <item row="0" column="0" colspan="4">
+   <item row="0" column="0" rowspan="4" colspan="4">
     <widget class="QTreeWidget" name="macroTreeWidget">
      <property name="headerHidden">
       <bool>true</bool>
      </column>
     </widget>
    </item>
-   <item row="1" column="0">
+   <item row="0" column="4">
     <widget class="QPushButton" name="newButton">
      <property name="text">
       <string>New</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="1">
+   <item row="1" column="4">
     <widget class="QPushButton" name="editButton">
      <property name="text">
       <string>Edit</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="2">
+   <item row="2" column="4">
     <widget class="QPushButton" name="deleteButton">
      <property name="text">
       <string>Delete</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="3">
+   <item row="3" column="4">
     <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="layoutDirection">
+      <enum>Qt::LeftToRight</enum>
+     </property>
      <property name="orientation">
-      <enum>Qt::Horizontal</enum>
+      <enum>Qt::Vertical</enum>
      </property>
      <property name="standardButtons">
       <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
index 6cfeb60..a383999 100644 (file)
@@ -36,10 +36,8 @@ PIRTabsChoiceDialog::PIRTabsChoiceDialog(
   ui->tabsChoiceListWidget->addItem(
     new PIRTabsWidgetItem("Roomba Panels", Roomba_Tabs));
 
-/*
   ui->tabsChoiceListWidget->addItem(
     new PIRTabsWidgetItem("Macro Panels", Macro_Tabs));
-*/
 
   ui->tabsChoiceListWidget->addItem(
     new PIRTabsWidgetItem("Keyset Search Panels", PowerSearch_Tabs));
index e0f5426..4646320 100644 (file)
@@ -1,11 +1,14 @@
 #include "pirmacroform.h"
 #include "ui_pirmacroform.h"
 
-//#include "mainwindow.h"
+#include "mainwindow.h"
 #include "macros/pirmacro.h"
+#include "macros/pirmacropack.h"
+#include "macros/pirmacrocommanditem.h"
+
+#include <iostream>
 
 class QTreeWidgetItem;
-class MainWindow;
 
 /*
 PIRMacroForm::PIRMacroForm(QWidget *parent) :
@@ -20,19 +23,77 @@ PIRMacroForm::PIRMacroForm(
   MainWindow *mw)
   : QWidget(0),
     ui(new Ui::PIRMacroForm),
-    smd(mw),
-    ccd(mw),
-    currentMacro(0)
+    currentMacro(0),
+    userRequestMacro(0),
+    request(No_Request),
+    mainWindow(mw)
 {
   ui->setupUi(this);
 
+  PIRMacroPack *userPack = mainWindow->getUserPack();
+  if (userPack)
+  {
+    if (userPack->childCount())
+    {
+      currentMacro = dynamic_cast<PIRMacro *> (userPack->child(0));
+      if (currentMacro)
+      {
+        ui->macroNameLabel->setText(currentMacro->getName());
+        currentMacro->populateList(ui->macroListWidget);
+        ui->addButton->setEnabled(true);
+      }
+    }
+  }
+
   connect(
     &smd,
     SIGNAL(macroChosen(QTreeWidgetItem *)),
     this,
     SLOT(displayMacro(QTreeWidgetItem *)));
+
+  connect(
+    &smd,
+    SIGNAL(newMacroRequested()),
+    this,
+    SLOT(createNewMacro()));
+
+  connect(
+    &smd,
+    SIGNAL(editMacroRequested(QTreeWidgetItem *)),
+    this,
+    SLOT(editMacro(QTreeWidgetItem *)));
+
+  connect(
+    &smd,
+    SIGNAL(deleteMacroRequested(QTreeWidgetItem *)),
+    this,
+    SLOT(deleteMacro(QTreeWidgetItem *)));
+
+  // Set up the select macro dialog:
+  smd.addPack(mw->getUserPack());
+  smd.addPack(mw->getMultitapPack());
+
+  // Connect to edit command dialog signals:
+  connect(
+    &ecd,
+    SIGNAL(deleteCommand()),
+    this,
+    SLOT(deleteCurrentCommand()));
+
+  connect(
+    &ecd,
+    SIGNAL(moveCommandUp()),
+    this,
+    SLOT(moveCurrentCommandUp()));
+
+  connect(
+    &ecd,
+    SIGNAL(moveCommandDown()),
+    this,
+    SLOT(moveCurrentCommandDown()));
 }
 
+
 PIRMacroForm::~PIRMacroForm()
 {
   delete ui;
@@ -41,13 +102,110 @@ PIRMacroForm::~PIRMacroForm()
 
 void PIRMacroForm::on_chooseMacroButton_clicked()
 {
+  request = No_Request;
   smd.exec();
+
+  // Loop until the user either selects a macro to display,
+  // or makes no request:
+  while (request != No_Request)
+  {
+    switch (request)
+    {
+    case DisplayMacro_Request:
+      currentMacro = userRequestMacro;
+      userRequestMacro = 0;
+
+      ui->macroNameLabel->setText(currentMacro->getName());
+
+      // Turn on the "new" button
+      ui->addButton->setEnabled(true);
+
+      currentMacro->populateList(ui->macroListWidget);
+
+      return;
+
+    case NewMacro_Request:
+      emd.clear();
+      if (emd.exec() == QDialog::Accepted)
+      {
+        // Create the new macro:
+        currentMacro = new PIRMacro(
+          mainWindow->getUserPack(),
+          emd.getText(),
+          emd.getKey(),
+          emd.getButtonID(),
+          mainWindow);
+
+        ui->macroNameLabel->setText(emd.getText());
+
+        // Turn on the "new" button
+        ui->addButton->setEnabled(true);
+
+        mainWindow->updateUserButtons();
+
+        ui->macroListWidget->clear();
+
+        mainWindow->storeMacros();
+
+        return;
+      }
+      break;
+
+    case EditMacro_Request:
+      emd.setup(userRequestMacro);
+      if (emd.exec() == QDialog::Accepted)
+      {
+        // Store the changes:
+        userRequestMacro->setName(emd.getText());
+        userRequestMacro->setKey(emd.getKey());
+        userRequestMacro->setButtonID(emd.getButtonID());
+
+        mainWindow->updateUserButtons();
+
+        mainWindow->storeMacros();
+      }
+      userRequestMacro = 0;
+      break;
+
+    case DeleteMacro_Request:
+      dmd.setup(userRequestMacro);
+      if (dmd.exec() == QDialog::Accepted)
+      {
+        if (currentMacro == userRequestMacro)
+        {
+          currentMacro = 0;
+          ui->macroNameLabel->setText("No Macro Selected");
+          ui->addButton->setEnabled(false);
+          ui->macroListWidget->clear();
+        }
+
+        // Delete the macro:
+        delete userRequestMacro;
+
+        // Make sure no dangling buttons exist:
+        mainWindow->updateUserButtons();
+
+        mainWindow->storeMacros();
+
+        smd.resetIndices();
+      }
+      userRequestMacro = 0;
+      break;
+
+    default:
+      break;
+    }
+
+    // Return to the selector dialog:
+    request = No_Request;
+    smd.exec();
+  }
 }
 
 
 void PIRMacroForm::on_runButton_clicked()
 {
-  currentMacro->executeMacro();
+  if (currentMacro) currentMacro->executeMacro();
 }
 
 
@@ -60,13 +218,186 @@ void PIRMacroForm::displayMacro(
 
   if (!m) return;
 
-  currentMacro = m;
+  userRequestMacro = m;
+  request = DisplayMacro_Request;
+}
+
+
+QComboBox *PIRMacroForm::getKeysetComboBox()
+{
+  return ccd.getKeysetComboBox();
+}
+
 
-  currentMacro->populateList(ui->macroListWidget);
+void PIRMacroForm::createNewMacro()
+{
+  request = NewMacro_Request;
+}
+
+
+void PIRMacroForm::editMacro(
+  QTreeWidgetItem *item)
+{
+  if (!item) return;
+  userRequestMacro = dynamic_cast<PIRMacro *> (item);
+  request = EditMacro_Request;
+}
+
+
+void PIRMacroForm::deleteMacro(
+  QTreeWidgetItem *item)
+{
+  if (!item) return;
+  userRequestMacro = dynamic_cast<PIRMacro *> (item);
+  request = DeleteMacro_Request;
 }
 
 
 void PIRMacroForm::on_addButton_clicked()
 {
-  ccd.exec();
+  // Sanity check:
+  if (!currentMacro) return;
+
+  // Initialize the choose command dialog:
+  ccd.init();
+
+  // Check whether the user has actually created a command:
+  if (ccd.exec() != QDialog::Accepted) return;
+
+  int index = ui->macroListWidget->currentRow();
+
+  switch (ccd.getCommandType())
+  {
+  case Keyset_Command:
+    currentMacro->appendCommand(
+      new PIRKeysetCommandItem(
+        ccd.getKeysetID(),
+        mainWindow));
+
+    currentMacro->populateList(ui->macroListWidget);
+    ui->macroListWidget->setCurrentRow(index);
+
+    mainWindow->storeMacros();
+
+    break;
+
+  case Key_Command:
+    currentMacro->appendCommand(
+      new PIRKeyCommandItem(
+        ccd.getKeyName(),
+        mainWindow));
+
+    currentMacro->populateList(ui->macroListWidget);
+    ui->macroListWidget->setCurrentRow(index);
+
+    mainWindow->storeMacros();
+
+    break;
+
+  case Pause_Command:
+    currentMacro->appendCommand(
+      new PIRPauseCommandItem(
+        ccd.getTimeToWait()));
+
+    currentMacro->populateList(ui->macroListWidget);
+    ui->macroListWidget->setCurrentRow(index);
+
+    mainWindow->storeMacros();
+
+    break;
+
+  case No_Command:
+  default:
+    break;
+  }
+}
+
+
+void PIRMacroForm::deleteCurrentCommand()
+{
+  int index = ui->macroListWidget->currentRow();
+  if (currentMacro->deleteCommand(index))
+  {
+    currentMacro->populateList(ui->macroListWidget);
+
+    if (index == ui->macroListWidget->count()) --index;
+
+    if (index)
+    {
+      ui->macroListWidget->setCurrentRow(index);
+    }
+
+    mainWindow->storeMacros();
+  }
 }
+
+
+void PIRMacroForm::moveCurrentCommandUp()
+{
+  int index = ui->macroListWidget->currentRow();
+  if (currentMacro->moveUp(index))
+  {
+    currentMacro->populateList(ui->macroListWidget);
+    ui->macroListWidget->setCurrentRow(index - 1);
+
+    mainWindow->storeMacros();
+  }
+}
+
+
+void PIRMacroForm::moveCurrentCommandDown()
+{
+  int index = ui->macroListWidget->currentRow();
+
+  if (currentMacro->moveDown(index))
+  {
+    currentMacro->populateList(ui->macroListWidget);
+    ui->macroListWidget->setCurrentRow(index + 1);
+
+    mainWindow->storeMacros();
+  }
+}
+
+
+//void PIRMacroForm::on_macroListWidget_itemClicked(QListWidgetItem *item)
+void PIRMacroForm::on_macroListWidget_itemClicked()
+{
+  ecd.setup(
+    currentMacro->getCommandType(ui->macroListWidget->currentRow()),
+    currentMacro->getCommandName(ui->macroListWidget->currentRow()));
+
+  ecd.exec();
+}
+
+
+/*
+void PIRMacroForm::on_newMacroButton_clicked()
+{
+  emd.clear();
+
+  // If no new macro, just give up:
+  if (emd.exec() != QDialog::Accepted) return;
+
+  // Create the new macro:
+  currentMacro = new PIRMacro(
+    mainWindow->getUserPack(),
+    emd.getText(),
+    emd.getKey(),
+    emd.getButtonID());
+
+  ui->macroNameLabel->setText(emd.getText());
+
+  // Turn on the "new" button
+  ui->addButton->setEnabled(true);
+
+  if (emd.getButtonID())
+  {
+    mainWindow->updateUserButtons();
+  }
+
+  ui->macroListWidget->clear();
+
+  mainWindow->storeMacros();
+}
+*/
+
index c02114f..d9da559 100644 (file)
@@ -3,9 +3,23 @@
 
 #include <QWidget>
 #include "dialogs/pirselectmacrodialog.h"
+#include "dialogs/pireditmacrodialog.h"
+#include "dialogs/pirdeletemacrodialog.h"
 #include "dialogs/pircreatecommanddialog.h"
+#include "dialogs/pireditcommanddialog.h"
 
 class PIRMacro;
+class QComboBox;
+class QListWidgetItem;
+class MainWindow;
+
+enum UserRequest {
+  No_Request,
+  DisplayMacro_Request,
+  NewMacro_Request,
+  EditMacro_Request,
+  DeleteMacro_Request
+};
 
 namespace Ui {
 class PIRMacroForm;
@@ -22,22 +36,47 @@ public:
     MainWindow *mw);
 
   ~PIRMacroForm();
+
+  QComboBox *getKeysetComboBox();
   
 private slots:
   void on_chooseMacroButton_clicked();
-  void on_addButton_clicked();
+//  void on_newMacroButton_clicked();
   void on_runButton_clicked();
+  void on_addButton_clicked();
+//  void on_macroListWidget_itemClicked(QListWidgetItem *item);
+  void on_macroListWidget_itemClicked();
 
   void displayMacro(
     QTreeWidgetItem *item);
 
+  void createNewMacro();
+
+  void editMacro(
+    QTreeWidgetItem *item);
+
+  void deleteMacro(
+    QTreeWidgetItem *item);
+
+  void deleteCurrentCommand();
+  void moveCurrentCommandUp();
+  void moveCurrentCommandDown();
+
 private:
   Ui::PIRMacroForm *ui;
 
   PIRSelectMacroDialog smd;
+  PIREditMacroDialog emd;
+  PIRDeleteMacroDialog dmd;
   PIRCreateCommandDialog ccd;
+  PIREditCommandDialog ecd;
 
   PIRMacro *currentMacro;
+  PIRMacro *userRequestMacro;
+
+  UserRequest request;
+
+  MainWindow *mainWindow;
 };
 
 #endif // PIRMACROFORM_H
index 72e8cac..db47dc5 100644 (file)
    <string>Macro Processor</string>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <property name="margin">
-    <number>8</number>
-   </property>
-   <item row="0" column="0">
-    <widget class="QPushButton" name="chooseMacroButton">
+   <item row="3" column="0">
+    <widget class="QPushButton" name="addButton">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
      <property name="text">
-      <string>Select Macro</string>
+      <string>Command</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="0" colspan="3">
+   <item row="1" column="1" rowspan="4" colspan="2">
     <widget class="QListWidget" name="macroListWidget"/>
    </item>
-   <item row="0" column="2">
+   <item row="4" column="0">
     <widget class="QPushButton" name="runButton">
      <property name="text">
-      <string>Run Macro</string>
+      <string>Run</string>
      </property>
     </widget>
    </item>
-   <item row="0" column="1">
-    <widget class="QPushButton" name="addButton">
+   <item row="2" column="0">
+    <widget class="QPushButton" name="chooseMacroButton">
+     <property name="text">
+      <string>Macro</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0" colspan="3">
+    <widget class="QLabel" name="macroNameLabel">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <property name="text">
-      <string>Add Command</string>
+      <string>No Macro Selected</string>
      </property>
     </widget>
    </item>
diff --git a/forms/piruserform.cpp b/forms/piruserform.cpp
new file mode 100644 (file)
index 0000000..ae7b1b4
--- /dev/null
@@ -0,0 +1,132 @@
+#include "piruserform.h"
+#include "ui_piruserform.h"
+
+#include "mainwindow.h"
+
+/*
+PIRUserForm::PIRUserForm(QWidget *parent) :
+  QWidget(parent),
+  ui(new Ui::PIRUserForm)
+{
+  ui->setupUi(this);
+}
+*/
+
+
+PIRUserForm::PIRUserForm(
+  MainWindow *mw)
+  : QWidget(0),
+    ui(new Ui::PIRUserForm),
+    mainWindow(mw)
+{
+  ui->setupUi(this);
+}
+
+
+PIRUserForm::~PIRUserForm()
+{
+  delete ui;
+}
+
+
+void PIRUserForm::setupButtons()
+{
+
+  if (mainWindow->hasMacroButton(1))
+  {
+    ui->userDef1Button->setEnabled(true);
+    ui->userDef1Button->setText(mainWindow->getMacroButtonText(1));
+  }
+  else
+  {
+    ui->userDef1Button->setEnabled(false);
+    ui->userDef1Button->setText("User Defined 1");
+  }
+
+  if (mainWindow->hasMacroButton(2))
+  {
+    ui->userDef2Button->setEnabled(true);
+    ui->userDef2Button->setText(mainWindow->getMacroButtonText(2));
+  }
+  else
+  {
+    ui->userDef2Button->setEnabled(false);
+    ui->userDef2Button->setText("User Defined 2");
+  }
+
+  if (mainWindow->hasMacroButton(3))
+  {
+    ui->userDef3Button->setEnabled(true);
+    ui->userDef3Button->setText(mainWindow->getMacroButtonText(3));
+  }
+  else
+  {
+    ui->userDef3Button->setEnabled(false);
+    ui->userDef3Button->setText("User Defined 3");
+  }
+
+  if (mainWindow->hasMacroButton(4))
+  {
+    ui->userDef4Button->setEnabled(true);
+    ui->userDef4Button->setText(mainWindow->getMacroButtonText(4));
+  }
+  else
+  {
+    ui->userDef4Button->setEnabled(false);
+    ui->userDef4Button->setText("User Defined 4");
+  }
+
+  if (mainWindow->hasMacroButton(5))
+  {
+    ui->userDef5Button->setEnabled(true);
+    ui->userDef5Button->setText(mainWindow->getMacroButtonText(5));
+  }
+  else
+  {
+    ui->userDef5Button->setEnabled(false);
+    ui->userDef5Button->setText("User Defined 5");
+  }
+
+  if (mainWindow->hasMacroButton(6))
+  {
+    ui->userDef6Button->setEnabled(true);
+    ui->userDef6Button->setText(mainWindow->getMacroButtonText(6));
+  }
+  else
+  {
+    ui->userDef6Button->setEnabled(false);
+    ui->userDef6Button->setText("User Defined 6");
+  }
+
+}
+
+
+void PIRUserForm::on_userDef1Button_clicked()
+{
+  mainWindow->executeMacroButton(1);
+}
+
+void PIRUserForm::on_userDef2Button_clicked()
+{
+  mainWindow->executeMacroButton(2);
+}
+
+void PIRUserForm::on_userDef3Button_clicked()
+{
+  mainWindow->executeMacroButton(3);
+}
+
+void PIRUserForm::on_userDef4Button_clicked()
+{
+  mainWindow->executeMacroButton(4);
+}
+
+void PIRUserForm::on_userDef5Button_clicked()
+{
+  mainWindow->executeMacroButton(5);
+}
+
+void PIRUserForm::on_userDef6Button_clicked()
+{
+  mainWindow->executeMacroButton(6);
+}
diff --git a/forms/piruserform.h b/forms/piruserform.h
new file mode 100644 (file)
index 0000000..23ee14a
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef PIRUSERFORM_H
+#define PIRUSERFORM_H
+
+#include <QWidget>
+
+class MainWindow;
+
+namespace Ui {
+class PIRUserForm;
+}
+
+class PIRUserForm : public QWidget
+{
+  Q_OBJECT
+  
+public:
+//  explicit PIRUserForm(QWidget *parent = 0);
+
+  PIRUserForm(
+    MainWindow *mw);
+
+  ~PIRUserForm();
+
+  void setupButtons();
+  
+private slots:
+  void on_userDef1Button_clicked();
+  void on_userDef2Button_clicked();
+  void on_userDef3Button_clicked();
+  void on_userDef4Button_clicked();
+  void on_userDef5Button_clicked();
+  void on_userDef6Button_clicked();
+
+private:
+  Ui::PIRUserForm *ui;
+
+  MainWindow *mainWindow;
+};
+
+#endif // PIRUSERFORM_H
diff --git a/forms/piruserform.ui b/forms/piruserform.ui
new file mode 100644 (file)
index 0000000..372c96e
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PIRUserForm</class>
+ <widget class="QWidget" name="PIRUserForm">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <property name="margin">
+    <number>8</number>
+   </property>
+   <item row="0" column="0">
+    <widget class="QPushButton" name="userDef1Button">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>User Defined 1</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QPushButton" name="userDef4Button">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>User Defined 4</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QPushButton" name="userDef2Button">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>User Defined 2</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QPushButton" name="userDef5Button">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>User Defined 5</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QPushButton" name="userDef3Button">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>User Defined 3</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QPushButton" name="userDef6Button">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>User Defined 6</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index a3e2fae..f51eacd 100644 (file)
@@ -85,7 +85,78 @@ void CreativeAudio2::populateProtocol(
 }
 
 
-CreativeMisc1::CreativeMisc1(
+CreativeAudio3::CreativeAudio3(
+  unsigned int index)
+  : PIRKeysetMetaData(
+      "Sound Card Keyset 1",
+      Creative_Make,
+      index)
+{
+}
+
+
+void CreativeAudio3::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // Keyset alredy populated.
+    return;
+  }
+
+  threadableProtocol = new NECProtocol(guiObject, index, true, true);
+
+  setPreData(0x44C1, 16);
+
+  addKey("1", One_Key, 0xD1, 8);
+  addKey("2", Two_Key, 0xF1, 8);
+  addKey("3", Three_Key, 0x09, 8);
+  addKey("4", Four_Key, 0x51, 8);
+  addKey("5", Five_Key, 0x21, 8);
+  addKey("6", Six_Key, 0x1E, 8);
+  addKey("7", Seven_Key, 0x91, 8);
+  addKey("8", Eight_Key, 0xC1, 8);
+  addKey("9", Nine_Key, 0xEE, 8);
+  addKey("0", Zero_Key, 0x01, 8);
+  addKey("stop", Stop_Key, 0xA1, 8);
+  addKey("stop_eject", Eject_Key, 0xA1, 8);
+  addKey("play", Play_Key, 0x9E, 8);
+  addKey("pause", Pause_Key, 0x9E, 8);
+  addKey("slow", Slow_Key, 0xBE, 8);
+  addKey("step", StepForward_Key, 0x7E, 8);
+  addKey("prev", Previous_Key, 0xFE, 8);
+  addKey("next", Next_Key, 0x5E, 8);
+  addKey("mute", Mute_Key, 0x76, 8);
+  addKey("vol-", VolumeDown_Key, 0xC6, 8);
+  addKey("vol+", VolumeUp_Key, 0x46, 8);
+  addKey("eax", Unmapped_Key, 0x31, 8);
+  addKey("EAX_Up", Unmapped_Key, 0x69, 8);
+  addKey("EAX_Down", Unmapped_Key, 0xE9, 8);
+  addKey("options", Unmapped_Key, 0x41, 8);
+  addKey("display", Info_Key, 0x6E, 8);
+  addKey("return", Exit_Key, 0x71, 8);
+  addKey("start", Unmapped_Key, 0x11, 8);
+  addKey("close", Unmapped_Key, 0x3E, 8);
+  addKey("up", Up_Key, 0xDE, 8);
+  addKey("down", Down_Key, 0xB1, 8);
+  addKey("left", Left_Key, 0xE1, 8);
+  addKey("right", Right_Key, 0xAE, 8);
+  addKey("ok", Select_Key, 0x81, 8);
+  addKey("power", Power_Key, 0x86, 8);
+  addKey("cmss", Unmapped_Key, 0x8E, 8);
+  addKey("CMSS_Up", Unmapped_Key, 0x29, 8);
+  addKey("CMSS_Down", Unmapped_Key, 0xA9, 8);
+  addKey("record", Record_Key, 0xCE, 8);
+  addKey("24bit", Unmapped_Key, 0x89, 8); // "x-fi_crystal_on"
+  addKey("24bit_Up", Unmapped_Key, 0x49, 8); // "x-fi_crystal+"
+  addKey("24bit_Down", Unmapped_Key, 0xC9, 8); // "x-fi_crystal-"
+  addKey("3dMidi", Unmapped_Key, 0x19, 8);
+  addKey("3dMidi_Up", Unmapped_Key, 0x99, 8);
+  addKey("3dMidi_Down", Unmapped_Key, 0x59, 8);
+}
+
+
+CreativeAudio4::CreativeAudio4(
   unsigned int index)
   : PIRKeysetMetaData(
       "Infra Keyset",
@@ -95,7 +166,7 @@ CreativeMisc1::CreativeMisc1(
 }
 
 
-void CreativeMisc1::populateProtocol(
+void CreativeAudio4::populateProtocol(
   QObject *guiObject)
 {
   if (threadableProtocol)
index a1b1700..db2f687 100644 (file)
@@ -25,10 +25,20 @@ public:
     QObject *guiObject);
 };
 
-class CreativeMisc1: public PIRKeysetMetaData
+class CreativeAudio3: public PIRKeysetMetaData
 {
 public:
-  CreativeMisc1(
+  CreativeAudio3(
+    unsigned int index);
+
+  virtual void populateProtocol(
+    QObject *guiObject);
+};
+
+class CreativeAudio4: public PIRKeysetMetaData
+{
+public:
+  CreativeAudio4(
     unsigned int index);
 
   virtual void populateProtocol(
index 3b5aca7..8c56c44 100644 (file)
@@ -2,6 +2,7 @@
 #include "protocols/rc5protocol.h"
 #include "protocols/necxprotocol.h"
 #include "protocols/necprotocol.h"
+#include "protocols/protonprotocol.h"
 
 // This one is iffy, might be another brand:
 GrundigSat1::GrundigSat1(
@@ -645,6 +646,56 @@ void GrundigTV3::populateProtocol(
 }
 
 
+GrundigTV4::GrundigTV4(
+  unsigned int index)
+  : PIRKeysetMetaData(
+      "TV Keyset 4",
+      Grundig_Make,
+      index)
+{
+}
+
+
+void GrundigTV4::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // Keyset already populated.
+    return;
+  }
+
+  threadableProtocol = new ProtonProtocol(guiObject, index);
+
+  setPreData(0x1B, 8);
+
+  addKey("vol-", VolumeDown_Key, 0x00, 8);
+  addKey("vol+", VolumeUp_Key, 0x04, 8);
+  addKey("exp", Unmapped_Key, 0x05, 8);
+  addKey("tune", Unmapped_Key, 0x07, 8);
+  addKey("mute", Mute_Key, 0x08, 8);
+  addKey("text/mix", TeletextMix_Key, 0x09, 8);
+  addKey("hold", TeletextHold_Key, 0x0A, 8);
+  addKey("menu", Menu_Key, 0x0C, 8);
+  addKey("0", Zero_Key, 0x0D, 8);
+  addKey("tv", Input_Key, 0x0E, 8); // not sure
+  addKey("7", Seven_Key, 0x10, 8);
+  addKey("8", Eight_Key, 0x11, 8);
+  addKey("9", Nine_Key, 0x12, 8);
+  addKey("ch-", ChannelDown_Key, 0x13, 8);
+  addKey("4", Four_Key, 0x14, 8);
+  addKey("5", Five_Key, 0x15, 8);
+  addKey("6", Six_Key, 0x16, 8);
+  addKey("ch+", ChannelUp_Key, 0x17, 8);
+  addKey("1", One_Key, 0x18, 8);
+  addKey("2", Two_Key, 0x19, 8);
+  addKey("3", Three_Key, 0x1A, 8);
+  addKey("info", Info_Key, 0x1C, 8);
+  addKey("store", Unmapped_Key, 0x1D, 8);
+  addKey("power", Power_Key, 0x1F, 8);
+}
+
+
 GrundigDVD1::GrundigDVD1(
   unsigned int index)
   : PIRKeysetMetaData(
index 567330c..cfffb80 100644 (file)
@@ -115,6 +115,16 @@ public:
     QObject *guiObject);
 };
 
+class GrundigTV4: public PIRKeysetMetaData
+{
+public:
+  GrundigTV4(
+    unsigned int index);
+
+  virtual void populateProtocol(
+    QObject *guiObject);
+};
+
 class GrundigDVD1: public PIRKeysetMetaData
 {
 public:
index e2e583b..0788ea6 100644 (file)
@@ -26,23 +26,37 @@ void RCATV1::populateProtocol(
   setPreData(0xF, 4);
 
   addKey("Fav", Favorites_Key, 0x00, 8);
+  addKey("Band", Unmapped_Key, 0x04, 8);
   addKey("tv-antenna", AntennaInput_Key, 0x05, 8);
   addKey("tv-clear", Clear_Key, 0x06, 8);
   addKey("tv-clear", Exit_Key, 0x06, 8);
   addKey("Sleep", Sleep_Key, 0x07, 8);
   addKey("tv-menu", Menu_Key, 0x08, 8);
+  addKey("Tracking Down", TrackingMinus_Key, 0x0A, 8);
+  addKey("Tracking Up", TrackingPlus_Key, 0x0B, 8);
+  addKey("Pip Freeze", PIPPause_Key, 0x0C, 8);
+  addKey("Slow", Slow_Key, 0x10, 8);
   addKey("Presets", Unmapped_Key, 0x12, 8);
+  addKey("Pip Move", PIPMove_Key, 0x14, 8);
   addKey("tv-play", Play_Key, 0x15, 8);
+  addKey("Alarm", Unmapped_Key, 0x16, 8);
   addKey("tv-record", Record_Key, 0x17, 8);
-  addKey("setup-", Unmapped_Key, 0x18, 8);
+  addKey("setup-", Program_Key, 0x18, 8); // "Program"
   addKey("tv-pause", Pause_Key, 0x19, 8);
   addKey("tv-guide", Guide_Key, 0x1A, 8);
   addKey("pip", PIP_Key, 0x1B, 8);
   addKey("tv-forward", FastForward_Key, 0x1C, 8);
   addKey("tv-reverse", Rewind_Key, 0x1D, 8);
   addKey("tv-stop", Stop_Key, 0x1F, 8);
+  addKey("Band Right", Unmapped_Key, 0x20, 8);
+  addKey("Band Left", Unmapped_Key, 0x22, 8);
+  addKey("Erase", Unmapped_Key, 0x23, 8);
+  addKey("Add", Unmapped_Key, 0x24, 8);
   addKey("tv-go-back", PrevChannel_Key, 0x27, 8); // "pc"
+  addKey("Seek", Unmapped_Key, 0x28, 8);
+  addKey("Surr Frz Rig", Unmapped_Key, 0x29, 8);
   addKey("tv-on-off", Power_Key, 0x2A, 8);
+  addKey("Surr Frz Lef", Unmapped_Key, 0x2B, 8);
   addKey("tv-ch-", ChannelDown_Key, 0x2C, 8);
   addKey("tv-ch+", ChannelUp_Key, 0x2D, 8);
   addKey("vol-left", VolumeDown_Key, 0x2E, 8);
@@ -60,25 +74,48 @@ void RCATV1::populateProtocol(
   addKey("tv", PowerOn_Key, 0x3A, 8); // "on"
   addKey("off", PowerOff_Key, 0x3B, 8);
   addKey("tv-info", Info_Key, 0x3C, 8); // "display"
+  addKey("Minute", Unmapped_Key, 0x3D, 8);
+  addKey("Clock", Clock_Key, 0x3E, 8);
   addKey("mute", Mute_Key, 0x3F, 8);
-  addKey("skip", Advance_Key, 0x53, 8);
-  addKey("tv-right", Right_Key, 0x57, 8);
+  addKey("Speed", VHSSpeed_Key, 0x46, 8);
+  addKey("Input", Unmapped_Key, 0x47, 8); // Which input is right? Both?
+  addKey("Pip Recall", Unmapped_Key, 0x49, 8);
+  addKey("Ch Memory", Unmapped_Key, 0x4A, 8);
+  addKey("Call Counter", Unmapped_Key, 0x4C, 8);
+  addKey("Call Channel", Unmapped_Key, 0x4D, 8);
+  addKey("Alternate Menu", Unmapped_Key, 0x52, 8);
+  addKey("skip", Advance_Key, 0x53, 8); // "Cs"
+  addKey("Zoom Out", Unmapped_Key, 0x54, 8);
+  addKey("Zoom In", Unmapped_Key, 0x55, 8);
   addKey("tv-left", Left_Key, 0x56, 8);
+  addKey("tv-right", Right_Key, 0x57, 8);
   addKey("tv-down", Down_Key, 0x58, 8);
   addKey("tv-up", Up_Key, 0x59, 8);
-  addKey("Sound", SoundMode_Key, 0x5A, 8);
-  addKey("tv-who", Unmapped_Key, 0x61, 8);
-  addKey("vid+", Unmapped_Key, 0x64, 8);
-  addKey("setup+", Unmapped_Key, 0x65, 8);
+  addKey("Sound", SoundMode_Key, 0x5A, 8); // "Surr On/Off"
+  addKey("Surr Frz", Unmapped_Key, 0x5B, 8);
+  addKey("Surr Zoom Out", Unmapped_Key, 0x5C, 8);
+  addKey("Surr Zoom In", Unmapped_Key, 0x5D, 8);
+  addKey("Surr Frz Dow", Unmapped_Key, 0x5E, 8);
+  addKey("Surr Frz Up", Unmapped_Key, 0x5F, 8);
+  addKey("tv-who", Unmapped_Key, 0x61, 8); // "Favorite"
+  addKey("Down", Unmapped_Key, 0x62, 8);
+  addKey("Up", Unmapped_Key, 0x63, 8);
+  addKey("vid+", Unmapped_Key, 0x64, 8); // "Menu -"
+  addKey("setup+", Unmapped_Key, 0x65, 8); // "Menu +"
   addKey("CC", Captions_Key, 0x80, 8);
+  addKey("Text On", Unmapped_Key, 0x85, 8);
   addKey("aspect", AspectRatio_Key, 0x90, 8);
   addKey("tv-fetch", Unmapped_Key, 0x93, 8);
   addKey("vport", Unmapped_Key, 0x99, 8);
   addKey("tv-input", Input_Key, 0xA3, 8);
+  addKey("Alt Audio", Unmapped_Key, 0xB0, 8);
   addKey("tv_again", Unmapped_Key, 0xBA, 8);
   addKey("swap", PIPSwap_Key, 0xC3, 8);
-  addKey("pgm", Program_Key, 0xE1, 8);
-  addKey("vid-", Unmapped_Key, 0xE2, 8);
+  addKey("100", PlusOneHundred_Key, 0xD1, 8);
+  addKey("Help", Unmapped_Key, 0xD5, 8);
+  addKey("pgm", Unmapped_Key, 0xE1, 8); // "Audio Menu"
+  addKey("vid-", Unmapped_Key, 0xE2, 8); // "Video Menu"
+  addKey("Ch. cntrl", Unmapped_Key, 0xE5, 8);
   addKey("tv-ok", Select_Key, 0xF4, 8);
 }
 
index 0d39209..b1a9475 100644 (file)
@@ -1,17 +1,61 @@
 #include "pirmacro.h"
 
-#include "macros/pirmacrocommanditem.h"
+#include "pirmacrocommanditem.h"
+#include "pirmacropack.h"
+#include "mainwindow.h"
+
+#include <QSettings>
+
+#include <iostream>
 
 bool PIRMacro::macroRunning = false;
 
 PIRMacro::PIRMacro(
-  QTreeWidgetItem *parent,
-  QString n,
-  char k)
+  PIRMacroPack *parent,
+  QString name,
+  char k,
+  unsigned int b,
+  MainWindow *mw)
   : QTreeWidgetItem(parent),
-    keyMapping(k)
+    key(k),
+    buttonID(b),
+    mainWindow(mw)
 {
-  setText(0, n);
+  setText(0, name);
+
+  if (key)
+  {
+    parent->registerKey(key, this);
+  }
+
+  if (buttonID)
+  {
+    parent->registerButton(buttonID, this);
+  }
+}
+
+
+PIRMacro::~PIRMacro()
+{
+  PIRMacroPack *mp = dynamic_cast<PIRMacroPack*> (QTreeWidgetItem::parent());
+
+  if (key)
+  {
+    mp->eraseKey(key, this);
+  }
+
+  if (buttonID)
+  {
+    mp->eraseButton(buttonID, this);
+  }
+
+  currentCommand = commands.begin();
+  while (currentCommand != commands.end())
+  {
+    delete *currentCommand;
+    commands.pop_front();
+    currentCommand = commands.begin();
+  }
 }
 
 
@@ -21,12 +65,38 @@ QString PIRMacro::getName()
 }
 
 
-char PIRMacro::getKeyMapping()
+void PIRMacro::setName(
+  QString name)
 {
-  return keyMapping;
+  setText(0, name);
 }
 
 
+char PIRMacro::getKey()
+{
+  return key;
+}
+
+
+void PIRMacro::setKey(
+  char k)
+{
+  key = k;
+}
+
+
+unsigned int PIRMacro::getButtonID()
+{
+  return buttonID;
+}
+
+
+void PIRMacro::setButtonID(
+  unsigned int id)
+{
+  buttonID = id;
+}
+
 void PIRMacro::appendCommand(
   PIRMacroCommandItem *c)
 {
@@ -34,6 +104,81 @@ void PIRMacro::appendCommand(
 }
 
 
+bool PIRMacro::deleteCommand(
+  int index)
+{
+  CommandSequence::iterator i = commands.begin();
+  int count = 0;
+
+  while (i != commands.end())
+  {
+    if (index == count)
+    {
+      delete (*i);
+      commands.erase(i);
+      return true;
+    }
+    ++count;
+    ++i;
+  }
+
+  return false;
+}
+
+
+bool PIRMacro::moveUp(
+  int index)
+{
+  CommandSequence::iterator i = commands.begin();
+  int count = 0;
+  CommandSequence::iterator previ = commands.begin();
+
+  while (i != commands.end())
+  {
+    if (index == count)
+    {
+      PIRMacroCommandItem *mci = *i;
+      commands.erase(i);
+      commands.insert(previ, mci);
+      return true;
+    }
+
+    previ = i;
+    ++count;
+    ++i;
+  }
+
+  return false;
+}
+
+
+bool PIRMacro::moveDown(
+  int index)
+{
+  CommandSequence::iterator i = commands.begin();
+  CommandSequence::iterator nexti = commands.begin();
+  int count = 0;
+
+  while (i != commands.end())
+  {
+    ++nexti;
+    if ((index == count) && nexti != commands.end())
+    {
+      PIRMacroCommandItem *mci = *i;
+      commands.erase(i);
+      ++nexti;
+      commands.insert(nexti, mci);
+      return true;
+    }
+
+    ++count;
+    ++i;
+  }
+
+  return false;
+}
+
+
 void PIRMacro::populateList(
   QListWidget *lw)
 {
@@ -43,7 +188,7 @@ void PIRMacro::populateList(
 
   while (i != commands.end())
   {
-    lw->addItem(*i);
+    lw->addItem(new QListWidgetItem((*i)->getName()));
     ++i;
   }
 }
@@ -67,6 +212,9 @@ bool PIRMacro::executeMacro()
   // Start running the list of commands:
   macroRunning = true;
 
+  // Take note of the current keyset id:
+  preMacroKeysetID = mainWindow->getCurrentKeyset();
+
   connect(
     *currentCommand,
     SIGNAL(commandCompleted()),
@@ -75,19 +223,26 @@ bool PIRMacro::executeMacro()
 
   (*currentCommand)->executeCommand();
 
-  ++currentCommand;
-
   return true;
 }
 
 
 void PIRMacro::startNextCommand()
 {
+  disconnect(
+    *currentCommand,
+    SIGNAL(commandCompleted()),
+    0,
+    0);
+
+  ++currentCommand;
+
   // Are we done?
   if (currentCommand == commands.end())
   {
     // We are done.
     macroRunning = false;
+    mainWindow->updateKeysetSelection(preMacroKeysetID);
     emit macroCompleted();
     return;
   }
@@ -100,6 +255,64 @@ void PIRMacro::startNextCommand()
     SLOT(startNextCommand()));
 
   (*currentCommand)->executeCommand();
+}
 
-  ++currentCommand;
+
+void PIRMacro::storeSettings(
+  QSettings &settings)
+{
+  settings.setValue("macroName", text(0));
+  settings.setValue("macroKey", key);
+  settings.setValue("macroButtonID", buttonID);
+
+  CommandSequence::const_iterator i = commands.begin();
+
+  int index = 0;
+  while (i != commands.end())
+  {
+    (*i)->storeSettings(settings, index);
+    ++index;
+    ++i;
+  }
+}
+
+
+QString PIRMacro::getCommandType(
+  int index)
+{
+  CommandSequence::iterator i = commands.begin();
+
+  // Advance 'index' steps into the sequence:
+  while (i != commands.end() && index)
+  {
+    ++i;
+    --index;
+  }
+
+  if (i != commands.end())
+  {
+    return (*i)->getTypeString();
+  }
+
+  return "";
+}
+
+
+QString PIRMacro::getCommandName(
+  int index)
+{
+  CommandSequence::iterator i = commands.begin();
+
+  while (i != commands.end() && index)
+  {
+    ++i;
+    --index;
+  }
+
+  if (i != commands.end())
+  {
+    return (*i)->getName();
+  }
+
+  return "";
 }
index fe0b583..a803eeb 100644 (file)
@@ -6,7 +6,10 @@
 #include <QString>
 
 class PIRMacroCommandItem;
+class PIRMacroPack;
 class QListWidget;
+class QSettings;
+class MainWindow;
 
 #include <list>
 typedef std::list<PIRMacroCommandItem *> CommandSequence;
@@ -17,22 +20,55 @@ class PIRMacro: public QObject, public QTreeWidgetItem
 
 public:
   PIRMacro(
-    QTreeWidgetItem *parent,
-    QString n,
-    char k);
+    PIRMacroPack *parent,
+    QString name,
+    char key,
+    unsigned int buttonID,
+    MainWindow *mw);
+
+  ~PIRMacro();
 
   QString getName();
 
-  char getKeyMapping();
+  void setName(
+    QString name);
+
+  char getKey();
+
+  void setKey(
+    char key);
+
+  unsigned int getButtonID();
+
+  void setButtonID(
+    unsigned int id);
 
   void appendCommand(
     PIRMacroCommandItem *c);
 
+  bool deleteCommand(
+    int index);
+
+  bool moveUp(
+    int index);
+
+  bool moveDown(
+    int index);
+
   void populateList(
     QListWidget *lw);
 
   bool executeMacro();
 
+  void storeSettings(
+    QSettings &settings);
+
+  QString getCommandType(
+    int index);
+
+  QString getCommandName(
+    int index);
+
 signals:
   void macroCompleted();
 
@@ -40,12 +76,15 @@ private slots:
   void startNextCommand();
 
 private:
-  QString name;
-  char keyMapping;
+  char key;
+  unsigned int buttonID;
   CommandSequence commands;
   CommandSequence::iterator currentCommand;
+  unsigned int preMacroKeysetID;
 
   static bool macroRunning; // only one macro can run at a time!
+
+  MainWindow *mainWindow;
 };
 
 #endif // PIRMACRO_H
index 755b5a6..f78deb3 100644 (file)
@@ -3,15 +3,37 @@
 #include "mainwindow.h"
 #include "pirkeynames.h"
 
+#include <QSettings>
 #include <QTimer>
 
+#include <iostream>
+
 PIRKeynameMgr keynameMgr;
 
 
+PIRMacroCommandItem::PIRMacroCommandItem()
+  : name("Unnamed")
+{
+}
+
+
 PIRMacroCommandItem::PIRMacroCommandItem(
   QString displayName)
-  : QListWidgetItem(displayName)
+  : name(displayName)
+{
+}
+
+
+QString PIRMacroCommandItem::getName() const
+{
+  return name;
+}
+
+
+void PIRMacroCommandItem::setName(
+  QString n)
 {
+  name = n;
 }
 
 
@@ -26,6 +48,12 @@ PIRKeyCommandItem::PIRKeyCommandItem(
 }
 
 
+PIRKeyCommandItem::~PIRKeyCommandItem()
+{
+  if (advanceTimer) delete advanceTimer;
+}
+
+
 void PIRKeyCommandItem::executeCommand()
 {
   // First, make sure no other macro is running:
@@ -63,6 +91,26 @@ void PIRKeyCommandItem::stopRunningCommand()
 }
 
 
+void PIRKeyCommandItem::storeSettings(
+  QSettings &settings,
+  int index)
+{
+  QString commandName = "commandType";
+  commandName.append(QString::number(index));
+  settings.setValue(commandName, KeyCommand_Type);
+
+  commandName = "commandKeyID";
+  commandName.append(QString::number(index));
+  settings.setValue(commandName, key);
+}
+
+
+QString PIRKeyCommandItem::getTypeString() const
+{
+  return "Execute Keypress: ";
+}
+
+
 PIRKeysetCommandItem::PIRKeysetCommandItem(
   QString displayName,
   unsigned int keysetToChoose,
@@ -74,6 +122,17 @@ PIRKeysetCommandItem::PIRKeysetCommandItem(
 }
 
 
+PIRKeysetCommandItem::PIRKeysetCommandItem(
+  unsigned int keysetToChoose,
+  MainWindow *mw)
+  : PIRMacroCommandItem(),
+    id(keysetToChoose),
+    mainWindow(mw)
+{
+  setName(mainWindow->getFullKeysetName(keysetToChoose));
+}
+
+
 void PIRKeysetCommandItem::executeCommand()
 {
   mainWindow->updateKeysetSelection(id);
@@ -81,13 +140,50 @@ void PIRKeysetCommandItem::executeCommand()
 }
 
 
+void PIRKeysetCommandItem::storeSettings(
+  QSettings &settings,
+  int index)
+{
+  QString commandName = "commandType";
+  commandName.append(QString::number(index));
+  settings.setValue(commandName, KeysetCommand_Type);
+
+  commandName = "commandKeysetMake";
+  commandName.append(QString::number(index));
+  settings.setValue(commandName, mainWindow->getKeysetMake(id));
+
+  commandName = "commandKeysetName";
+  commandName.append(QString::number(index));
+  settings.setValue(commandName, mainWindow->getKeysetName(id));
+
+  commandName = "commandKeysetDisplayName";
+  commandName.append(QString::number(index));
+  settings.setValue(commandName, mainWindow->getFullKeysetName(id));
+}
+
+
+QString PIRKeysetCommandItem::getTypeString() const
+{
+  return "Choose Keyset: ";
+}
+
+
 PIRPauseCommandItem::PIRPauseCommandItem(
-  QString displayName,
   unsigned int timeToWait)
-  : PIRMacroCommandItem(displayName),
-    timeInSeconds(timeToWait),
+  : timeInSeconds(timeToWait),
     advanceTimer(0)
 {
+  QString pauseName = "Pause for ";
+  pauseName.append(QString::number(timeToWait));
+  pauseName.append(" seconds");
+
+  setName(pauseName);
+}
+
+
+PIRPauseCommandItem::~PIRPauseCommandItem()
+{
+  if (advanceTimer) delete advanceTimer;
 }
 
 
@@ -111,3 +207,23 @@ void PIRPauseCommandItem::finishedWaiting()
 
   emit commandCompleted();
 }
+
+
+void PIRPauseCommandItem::storeSettings(
+  QSettings &settings,
+  int index)
+{
+  QString commandName = "commandType";
+  commandName.append(QString::number(index));
+  settings.setValue(commandName, PauseCommand_Type);
+
+  commandName = "commandPause";
+  commandName.append(QString::number(index));
+  settings.setValue(commandName, timeInSeconds);
+}
+
+
+QString PIRPauseCommandItem::getTypeString() const
+{
+  return "Pause (in seconds): ";
+}
index 2114902..892a15b 100644 (file)
@@ -8,21 +8,45 @@
 #include "pirkeynames.h"
 
 class QTimer;
+class QSettings;
 class MainWindow;
 
+// For convenience:
+enum CommandItemType{
+  NoCommand_Type,
+  KeysetCommand_Type,
+  KeyCommand_Type,
+  PauseCommand_Type
+};
 
-class PIRMacroCommandItem: public QObject, public QListWidgetItem
+class PIRMacroCommandItem: public QObject
 {
   Q_OBJECT
 
 public:
+  PIRMacroCommandItem();
+
   PIRMacroCommandItem(
     QString displayName);
 
   virtual void executeCommand() = 0;
 
+  virtual void storeSettings(
+    QSettings &settings,
+    int index) = 0;
+
+  virtual QString getTypeString() const = 0;
+
+  QString getName() const;
+
+  void setName(
+    QString name);
+
 signals:
   void commandCompleted();
+
+private:
+  QString name;
 };
 
 
@@ -35,8 +59,16 @@ public:
     PIRKeyName keyToExecute,
     MainWindow *mw);
 
+  ~PIRKeyCommandItem();
+
   virtual void executeCommand();
 
+  virtual void storeSettings(
+    QSettings &settings,
+    int index);
+
+  virtual QString getTypeString() const;
+
 private slots:
   void startRunningCommand();
   void stopRunningCommand();
@@ -58,8 +90,18 @@ public:
     unsigned int keysetToChoose,
     MainWindow *mw);
 
+  PIRKeysetCommandItem(
+    unsigned int keysetToChoose,
+    MainWindow *mw);
+
   virtual void executeCommand();
 
+  virtual void storeSettings(
+    QSettings &settings,
+    int index);
+
+  virtual QString getTypeString() const;
+
 private:
   unsigned int id;
   MainWindow *mainWindow;
@@ -72,11 +114,18 @@ class PIRPauseCommandItem: public PIRMacroCommandItem
 
 public:
   PIRPauseCommandItem(
-    QString displayName,
     unsigned int timeToWait);
 
+  ~PIRPauseCommandItem();
+
   virtual void executeCommand();
 
+  virtual void storeSettings(
+    QSettings &settings,
+    int index);
+
+  virtual QString getTypeString() const;
+
 private slots:
   void finishedWaiting();
 
diff --git a/macros/pirmacromanager.cpp b/macros/pirmacromanager.cpp
new file mode 100644 (file)
index 0000000..3c8db07
--- /dev/null
@@ -0,0 +1,242 @@
+#include "pirmacromanager.h"
+
+#include "pirmacropack.h"
+#include "pirreversemultitap.h"
+#include "pirmacro.h"
+#include "pirmacrocommanditem.h"
+#include "mainwindow.h"
+
+#include <QSettings>
+#include <iostream>
+
+PIRMacroManager::PIRMacroManager(
+  MainWindow *mw)
+  : userPack(0),
+    multitapPack(0),
+    keyboardController(0),
+    buttonsController(0),
+    mainWindow(mw)
+{
+  userPack = new PIRMacroPack("User Defined Macros");
+  multitapPack = new PIRReverseMultitap(mw);
+
+  retrieveSettings();
+
+  // For testing, set the multitap pack as the keyboard controller:
+//  keyboardController = multitapPack;
+
+  // And more testing, userpack as button controller:
+//  buttonsController = userPack;
+}
+
+
+PIRMacroManager::~PIRMacroManager()
+{
+// The UI currently owns the macro packs...
+//  delete userPack;
+//  delete multitapPack;
+}
+
+
+PIRMacroPack *PIRMacroManager::getUserPack()
+{
+  return userPack;
+}
+
+
+PIRMacroPack *PIRMacroManager::getMultitapPack()
+{
+  return multitapPack;
+}
+
+
+void PIRMacroManager::setKeyboardController(
+  PIRMacroPack *pack)
+{
+  keyboardController = pack;
+}
+
+
+void PIRMacroManager::setButtonsController(
+  PIRMacroPack *pack)
+{
+  buttonsController = pack;
+}
+
+
+void PIRMacroManager::handleKeypress(
+  char key)
+{
+  if (keyboardController)
+  {
+    keyboardController->executeKey(key);
+  }
+}
+
+
+bool PIRMacroManager::hasMacroButton(
+  unsigned int buttonID)
+{
+  if (buttonsController)
+    return buttonsController->hasButton(buttonID);
+
+  return false;
+}
+
+
+QString PIRMacroManager::getMacroButtonText(
+  unsigned int buttonID)
+{
+  if (buttonsController)
+    return buttonsController->buttonText(buttonID);
+
+  return "No Macro Found";
+}
+
+
+void PIRMacroManager::executeMacroButton(
+  unsigned int buttonID)
+{
+  if (buttonsController)
+    buttonsController->executeButton(buttonID);
+}
+
+
+void PIRMacroManager::storeSettings()
+{
+  if (userPack) userPack->storeSettings();
+}
+
+
+void PIRMacroManager::retrieveSettings()
+{
+  // Pull in any user-defined macros:
+  QSettings settings("pietrzak.org", "Pierogi");
+  int size = settings.beginReadArray("userMacros");
+  int index = 0;
+  QString macroName;
+  char macroKey;
+  unsigned int macroButtonID;
+  PIRMacro *macro;
+  PIRMacroCommandItem *macroCommand;
+  int commandIndex;
+  QString commandName;
+  int commandType;
+  unsigned int keysetID;
+  QString commandKeysetName;
+  QString commandKeysetMakeStr;
+  QString commandKeysetDisplayName;
+  PIRKeyName commandKeyID;
+  unsigned int commandPause;
+
+  while (index < size)
+  {
+    settings.setArrayIndex(index);
+    macroName = settings.value("macroName").toString();
+    macroKey = settings.value("macroKey").toInt();
+    macroButtonID = settings.value("macroButtonID").toInt();
+
+    macro = new PIRMacro(
+      userPack, macroName, macroKey, macroButtonID, mainWindow);
+
+    commandIndex = 0;
+    commandName = "commandType";
+    commandName.append(QString::number(commandIndex));
+    while (settings.contains(commandName))
+    {
+      commandType = settings.value(commandName).toInt();
+      switch(CommandItemType(commandType))
+      {
+      case KeysetCommand_Type:
+        commandName = "commandKeysetName";
+        commandName.append(QString::number(commandIndex));
+        commandKeysetName = settings.value(commandName).toString();
+
+        commandName = "commandKeysetMake";
+        commandName.append(QString::number(commandIndex));
+        commandKeysetMakeStr = settings.value(commandName).toString();
+
+        commandName = "commandKeysetDisplayName";
+        commandName.append(QString::number(commandIndex));
+        commandKeysetDisplayName = settings.value(commandName).toString();
+
+        if (mainWindow->findKeysetID(
+            commandKeysetMakeStr,
+            commandKeysetName,
+            keysetID))
+        {
+          macroCommand = new PIRKeysetCommandItem(
+            commandKeysetDisplayName,
+            keysetID,
+            mainWindow);
+
+          macro->appendCommand(macroCommand);
+        }
+
+        break;
+
+      case KeyCommand_Type:
+        commandName = "commandKeyID";
+        commandName.append(QString::number(commandIndex));
+        commandKeyID = PIRKeyName(settings.value(commandName).toInt());
+
+        macroCommand = new PIRKeyCommandItem(commandKeyID, mainWindow);
+
+        macro->appendCommand(macroCommand);
+
+        break;
+
+      case PauseCommand_Type:
+        commandName = "commandPause";
+        commandName.append(QString::number(commandIndex));
+        commandPause = settings.value(commandName).toInt();
+
+        macroCommand = new PIRPauseCommandItem(commandPause);
+
+        macro->appendCommand(macroCommand);
+
+        break;
+
+      default:
+        break;
+      }
+
+      ++commandIndex;
+      commandName = "commandType";
+      commandName.append(QString::number(commandIndex));
+    }
+
+    ++index;
+  }
+
+  settings.endArray();
+}
+
+
+// This needs to be done differently!!!
+void PIRMacroManager::setKbdFocus(
+  int index)
+{
+  if (index == 0)
+  {
+    keyboardController = userPack;
+  }
+  else
+  {
+    keyboardController = multitapPack;
+  }
+}
+
+
+void PIRMacroManager::setBtnFocus(
+  int index)
+{
+  if (index == 0)
+  {
+    buttonsController = userPack;
+  }
+  else
+  {
+    buttonsController = multitapPack;
+  }
+}
diff --git a/macros/pirmacromanager.h b/macros/pirmacromanager.h
new file mode 100644 (file)
index 0000000..20c585c
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef PIRMACROMANAGER_H
+#define PIRMACROMANAGER_H
+
+class PIRMacroPack;
+class PIRReverseMultitap;
+class MainWindow;
+class QString;
+
+class PIRMacroManager
+{
+public:
+  PIRMacroManager(
+    MainWindow *mw);
+
+  ~PIRMacroManager();
+
+  PIRMacroPack *getUserPack();
+  PIRMacroPack *getMultitapPack();
+
+  void setKeyboardController(
+    PIRMacroPack *pack);
+
+  void setButtonsController(
+    PIRMacroPack *pack);
+
+  void handleKeypress(
+    char key);
+
+  bool hasMacroButton(
+    unsigned int buttonID);
+
+  QString getMacroButtonText(
+    unsigned int buttonID);
+
+  void executeMacroButton(
+    unsigned int buttonID);
+
+  void storeSettings();
+
+  void setKbdFocus(
+    int index);
+
+  void setBtnFocus(
+    int index);
+
+private:
+  void retrieveSettings();
+
+  PIRMacroPack *userPack;
+  PIRReverseMultitap *multitapPack;
+
+  PIRMacroPack *keyboardController;
+  PIRMacroPack *buttonsController;
+
+  MainWindow *mainWindow;
+};
+
+#endif // PIRMACROMANAGER_H
index 275e9d0..61137c7 100644 (file)
 #include "pirmacropack.h"
 
+#include "pirmacro.h"
+
+#include <QSettings>
+
+#include <iostream>
+
 PIRMacroPack::PIRMacroPack(
-  QTreeWidget *parent,
   QString name)
-  : QTreeWidgetItem(parent)
 {
   setText(0, name);
 }
 
+
+bool PIRMacroPack::hasButton(
+  unsigned int buttonID)
+{
+  ButtonCollection::const_iterator i = buttons.find(buttonID);
+
+  if (i != buttons.end())
+  {
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
+
+
+void PIRMacroPack::registerButton(
+  unsigned int buttonID,
+  PIRMacro *macro)
+{
+  buttons[buttonID] = macro;
+}
+
+
+void PIRMacroPack::eraseButton(
+  unsigned int buttonID,
+  PIRMacro *macro)
+{
+  ButtonCollection::iterator i = buttons.find(buttonID);
+
+  if (i != buttons.end() && (*i).second == macro)
+  {
+    buttons.erase(i);
+  }
+}
+
+
+QString PIRMacroPack::buttonText(
+  unsigned int buttonID)
+{
+  ButtonCollection::const_iterator i = buttons.find(buttonID);
+
+  if (i != buttons.end())
+  {
+    return i->second->getName();
+  }
+  else
+  {
+    return "Error: Macro not found";
+  }
+}
+
+
+void PIRMacroPack::executeButton(
+  unsigned int buttonID)
+{
+  ButtonCollection::const_iterator i = buttons.find(buttonID);
+
+  if (i != buttons.end())
+  {
+    i->second->executeMacro();
+  }
+}
+
+
+bool PIRMacroPack::hasKey(
+  char key)
+{
+  KeyboardCollection::const_iterator i = keymaps.find(key);
+
+  if (i != keymaps.end())
+  {
+    return true;
+  }
+  else
+  {
+    return false;
+  }
+}
+
+
+void PIRMacroPack::registerKey(
+  char key,
+  PIRMacro *macro)
+{
+  keymaps[key] = macro;
+}
+
+
+void PIRMacroPack::eraseKey(
+  char key,
+  PIRMacro *macro)
+{
+  KeyboardCollection::iterator i = keymaps.find(key);
+
+  if (i != keymaps.end() && (*i).second == macro)
+  {
+    keymaps.erase(i);
+  }
+}
+
+
+void PIRMacroPack::executeKey(
+  char key)
+{
+  KeyboardCollection::const_iterator i = keymaps.find(key);
+
+  if (i != keymaps.end())
+  {
+    i->second->executeMacro();
+  }
+}
+
+
+void PIRMacroPack::storeSettings()
+{
+  QSettings settings("pietrzak.org", "Pierogi");
+
+  // Erase any existing macros:
+  settings.remove("userMacros");
+
+  // First, do we even have any macros?  If not, quit.
+  int macroCount = childCount();
+  if (macroCount == 0) return;
+
+  // (Re-) Construct the macros array:
+
+  int index = 0;
+  PIRMacro *macro;
+
+  settings.beginWriteArray("userMacros");
+
+  while (index < macroCount)
+  {
+    settings.setArrayIndex(index);
+    macro = dynamic_cast<PIRMacro *> (child(index));
+
+    macro->storeSettings(settings);
+
+    ++index;
+  }
+
+  settings.endArray();
+}
index 5325229..55c4f77 100644 (file)
@@ -3,16 +3,56 @@
 
 #include <QTreeWidgetItem>
 #include <QString>
+#include <map>
 
 class QTreeWidget;
 class PIRMacro;
 
+typedef std::map<unsigned int, PIRMacro *> ButtonCollection;
+typedef std::map<char, PIRMacro *> KeyboardCollection;
+
 class PIRMacroPack: public QTreeWidgetItem
 {
 public:
   PIRMacroPack(
-    QTreeWidget *parent,
     QString n);
+
+  bool hasButton(
+    unsigned int buttonID);
+
+  void registerButton(
+    unsigned int buttonID,
+    PIRMacro *macro);
+
+  void eraseButton(
+    unsigned int buttonID,
+    PIRMacro *macro);
+
+  QString buttonText(
+    unsigned int buttonID);
+
+  void executeButton(
+    unsigned int buttonID);
+
+  bool hasKey(
+    char key);
+
+  void registerKey(
+    char key,
+    PIRMacro *macro);
+
+  void eraseKey(
+    char key,
+    PIRMacro *macro);
+
+  void executeKey(
+    char key);
+
+  void storeSettings();
+
+private:
+  ButtonCollection buttons;
+  KeyboardCollection keymaps;
 };
 
 #endif // PIRMACROPACK_H
index b9fde79..6a93f67 100644 (file)
@@ -3,12 +3,11 @@
 #include "pirmacro.h"
 #include "pirmacrocommanditem.h"
 
+#include <iostream>
 
 PIRReverseMultitap::PIRReverseMultitap(
-  QTreeWidget *qtw,
   MainWindow *mw)
   : PIRMacroPack(
-      qtw,
       "Reverse Multitap Keyboard Macros"),
     mainWindow(mw)
 {
@@ -43,219 +42,219 @@ PIRReverseMultitap::PIRReverseMultitap(
 
 void PIRReverseMultitap::generateLetterA()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap A", 'A');
+  PIRMacro *m = new PIRMacro(this, "Multitap A", 'A', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Two_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('A', m);
 }
 
 void PIRReverseMultitap::generateLetterB()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap B", 'B');
+  PIRMacro *m = new PIRMacro(this, "Multitap B", 'B', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Two_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Two_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('B', m);
 }
 
 void PIRReverseMultitap::generateLetterC()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap C", 'C');
+  PIRMacro *m = new PIRMacro(this, "Multitap C", 'C', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Two_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Two_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Two_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('C', m);
 }
 
 void PIRReverseMultitap::generateLetterD()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap D", 'D');
+  PIRMacro *m = new PIRMacro(this, "Multitap D", 'D', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Three_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('D', m);
 }
 
 void PIRReverseMultitap::generateLetterE()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap E", 'E');
+  PIRMacro *m = new PIRMacro(this, "Multitap E", 'E', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Three_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Three_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('E', m);
 }
 
 void PIRReverseMultitap::generateLetterF()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap F", 'F');
+  PIRMacro *m = new PIRMacro(this, "Multitap F", 'F', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Three_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Three_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Three_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('F', m);
 }
 
 void PIRReverseMultitap::generateLetterG()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap G", 'G');
+  PIRMacro *m = new PIRMacro(this, "Multitap G", 'G', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Four_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('G', m);
 }
 
 void PIRReverseMultitap::generateLetterH()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap H", 'H');
+  PIRMacro *m = new PIRMacro(this, "Multitap H", 'H', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Four_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Four_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('H', m);
 }
 
 void PIRReverseMultitap::generateLetterI()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap I", 'I');
+  PIRMacro *m = new PIRMacro(this, "Multitap I", 'I', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Four_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Four_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Four_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('I', m);
 }
 
 void PIRReverseMultitap::generateLetterJ()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap J", 'J');
+  PIRMacro *m = new PIRMacro(this, "Multitap J", 'J', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Five_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('J', m);
 }
 
 void PIRReverseMultitap::generateLetterK()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap K", 'K');
+  PIRMacro *m = new PIRMacro(this, "Multitap K", 'K', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Five_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Five_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('K', m);
 }
 
 void PIRReverseMultitap::generateLetterL()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap L", 'L');
+  PIRMacro *m = new PIRMacro(this, "Multitap L", 'L', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Five_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Five_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Five_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('L', m);
 }
 
 void PIRReverseMultitap::generateLetterM()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap M", 'M');
+  PIRMacro *m = new PIRMacro(this, "Multitap M", 'M', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Six_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('M', m);
 }
 
 void PIRReverseMultitap::generateLetterN()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap N", 'N');
+  PIRMacro *m = new PIRMacro(this, "Multitap N", 'N', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Six_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Six_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('N', m);
 }
 
 void PIRReverseMultitap::generateLetterO()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap O", 'O');
+  PIRMacro *m = new PIRMacro(this, "Multitap O", 'O', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Six_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Six_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Six_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('O', m);
 }
 
 void PIRReverseMultitap::generateLetterP()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap P", 'P');
+  PIRMacro *m = new PIRMacro(this, "Multitap P", 'P', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('P', m);
 }
 
 void PIRReverseMultitap::generateLetterQ()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap Q", 'Q');
+  PIRMacro *m = new PIRMacro(this, "Multitap Q", 'Q', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('Q', m);
 }
 
 void PIRReverseMultitap::generateLetterR()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap R", 'R');
+  PIRMacro *m = new PIRMacro(this, "Multitap R", 'R', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('R', m);
 }
 
 void PIRReverseMultitap::generateLetterS()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap S", 'S');
+  PIRMacro *m = new PIRMacro(this, "Multitap S", 'S', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Seven_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('S', m);
 }
 
 void PIRReverseMultitap::generateLetterT()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap T", 'T');
+  PIRMacro *m = new PIRMacro(this, "Multitap T", 'T', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Eight_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('T', m);
 }
 
 void PIRReverseMultitap::generateLetterU()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap U", 'U');
+  PIRMacro *m = new PIRMacro(this, "Multitap U", 'U', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Eight_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Eight_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('U', m);
 }
 
 void PIRReverseMultitap::generateLetterV()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap V", 'V');
+  PIRMacro *m = new PIRMacro(this, "Multitap V", 'V', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Eight_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Eight_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Eight_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('V', m);
 }
 
 void PIRReverseMultitap::generateLetterW()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap W", 'W');
+  PIRMacro *m = new PIRMacro(this, "Multitap W", 'W', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('W', m);
 }
 
 void PIRReverseMultitap::generateLetterX()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap X", 'X');
+  PIRMacro *m = new PIRMacro(this, "Multitap X", 'X', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('X', m);
 }
 
 void PIRReverseMultitap::generateLetterY()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap Y", 'Y');
+  PIRMacro *m = new PIRMacro(this, "Multitap Y", 'Y', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('Y', m);
 }
 
 void PIRReverseMultitap::generateLetterZ()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap Z", 'Z');
+  PIRMacro *m = new PIRMacro(this, "Multitap Z", 'Z', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
   m->appendCommand(new PIRKeyCommandItem(Nine_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey('Z', m);
 }
 
 void PIRReverseMultitap::generateSpace()
 {
-  PIRMacro *m = new PIRMacro(this, "Multitap Space", ' ');
+  PIRMacro *m = new PIRMacro(this, "Multitap Space", ' ', 0, mainWindow);
   m->appendCommand(new PIRKeyCommandItem(Zero_Key, mainWindow));
-//  macros[m->getName()] = m;
+//  registerKey(' ', m);
 }
index ab18d36..d5371d2 100644 (file)
@@ -10,7 +10,6 @@ class PIRReverseMultitap: public PIRMacroPack
 {
 public:
   PIRReverseMultitap(
-    QTreeWidget *qtw,
     MainWindow *mw);
 
 private:
index 82f7a72..c0b190c 100644 (file)
@@ -9,6 +9,7 @@
 #include <QDialogButtonBox>
 #include <QScrollArea>
 #include <QSettings>
+#include <QKeyEvent>
 
 #include "pirkeysetmetadata.h"
 
 
 #include "pirkeysetmanager.h"
 #include "pirpanelmanager.h"
+#include "macros/pirmacromanager.h"
 
 //#define DEBUGGING
-//#include <iostream>
+#include <iostream>
 
 // Some ugly globals used for thread communications:
 
@@ -50,8 +52,10 @@ MainWindow::MainWindow(QWidget *parent)
     preferencesForm(0),
     documentationForm(0),
     aboutForm(0),
+    favoritesDialog(0),
     myKeysets(0),
     myPanels(0),
+    myMacros(0),
     currentKeyset(1) // Zero is not a valid keyset any more
 {
   ui->setupUi(this);
@@ -61,6 +65,7 @@ MainWindow::MainWindow(QWidget *parent)
 
   // Create the managers:
   myKeysets = new PIRKeysetManager();
+  myMacros = new PIRMacroManager(this);
   myPanels = new PIRPanelManager(this);
 
   // Display the panels:
@@ -70,6 +75,7 @@ MainWindow::MainWindow(QWidget *parent)
   selectKeysetForm = new PIRSelectKeysetForm(this);
   favoritesDialog = new PIRFavoritesDialog(this);
   myKeysets->populateListWidgets(selectKeysetForm, favoritesDialog);
+  selectKeysetForm->populateKeysetComboBox(myPanels->getKeysetComboBox());
 
   selectDeviceForm = new PIRSelectDeviceForm(this);
   PIRKeysetMetaData::populateDevices(selectDeviceForm);
@@ -91,7 +97,9 @@ MainWindow::MainWindow(QWidget *parent)
   // Add the corner buttons:
   insertCornerButtons();
 
+  // Set up all the buttons:
   enableButtons();
+  myPanels->updateUserButtons();
 
   // Make sure the three selection lists don't show different selections:
   QListWidget *klw = selectKeysetForm->getKeysetListWidget();
@@ -133,11 +141,17 @@ MainWindow::MainWindow(QWidget *parent)
 MainWindow::~MainWindow()
 {
   delete myKeysets;
-  if (selectKeysetForm) delete selectKeysetForm;
-  if (selectDeviceForm) delete selectDeviceForm;
-//  if (panelSelectionForm) delete panelSelectionForm;
-  if (documentationForm) delete documentationForm;
+
   if (aboutForm) delete aboutForm;
+  if (documentationForm) delete documentationForm;
+  if (preferencesForm) delete preferencesForm;
+  if (selectDeviceForm) delete selectDeviceForm;
+  if (favoritesDialog) delete favoritesDialog;
+  if (selectKeysetForm) delete selectKeysetForm;
+
+  if (myPanels) delete myPanels;
+  if (myMacros) delete myMacros;
+//  if (myKeysets) delete myKeysets;
   delete ui;
 }
 
@@ -248,7 +262,37 @@ QString MainWindow::getCurrentName()
 
 QString MainWindow::getCurrentFullName()
 {
-  return selectKeysetForm->getKeysetName();
+  return selectKeysetForm->getCurrentKeysetName();
+}
+
+
+QString MainWindow::getKeysetMake(
+  unsigned int id)
+{
+  return makeManager.getMakeString(myKeysets->getMake(id));
+}
+
+
+QString MainWindow::getKeysetName(
+  unsigned int id)
+{
+  return myKeysets->getDisplayName(id);
+}
+
+
+QString MainWindow::getFullKeysetName(
+  unsigned int id)
+{
+  return selectKeysetForm->getKeysetName(id);
+}
+
+
+bool MainWindow::findKeysetID(
+  QString make,
+  QString name,
+  unsigned int &id)
+{
+  return myKeysets->findKeysetID(make, name, id);
 }
 
 
@@ -597,3 +641,155 @@ void MainWindow::updateKeysetSelection(
 {
   selectKeysetForm->selectKeyset(targetID);
 }
+
+
+PIRMacroPack *MainWindow::getUserPack()
+{
+  return myMacros->getUserPack();
+}
+
+
+PIRMacroPack *MainWindow::getMultitapPack()
+{
+  return myMacros->getMultitapPack();
+}
+
+
+void MainWindow::keyPressEvent(
+  QKeyEvent *event)
+{
+  switch(event->key())
+  {
+  case Qt::Key_A:
+    myMacros->handleKeypress('A');
+    break;
+  case Qt::Key_B:
+    myMacros->handleKeypress('B');
+    break;
+  case Qt::Key_C:
+    myMacros->handleKeypress('C');
+    break;
+  case Qt::Key_D:
+    myMacros->handleKeypress('D');
+    break;
+  case Qt::Key_E:
+    myMacros->handleKeypress('E');
+    break;
+  case Qt::Key_F:
+    myMacros->handleKeypress('F');
+    break;
+  case Qt::Key_G:
+    myMacros->handleKeypress('G');
+    break;
+  case Qt::Key_H:
+    myMacros->handleKeypress('H');
+    break;
+  case Qt::Key_I:
+    myMacros->handleKeypress('I');
+    break;
+  case Qt::Key_J:
+    myMacros->handleKeypress('J');
+    break;
+  case Qt::Key_K:
+    myMacros->handleKeypress('K');
+    break;
+  case Qt::Key_L:
+    myMacros->handleKeypress('L');
+    break;
+  case Qt::Key_M:
+    myMacros->handleKeypress('M');
+    break;
+  case Qt::Key_N:
+    myMacros->handleKeypress('N');
+    break;
+  case Qt::Key_O:
+    myMacros->handleKeypress('O');
+    break;
+  case Qt::Key_P:
+    myMacros->handleKeypress('P');
+    break;
+  case Qt::Key_Q:
+    myMacros->handleKeypress('Q');
+    break;
+  case Qt::Key_R:
+    myMacros->handleKeypress('R');
+    break;
+  case Qt::Key_S:
+    myMacros->handleKeypress('S');
+    break;
+  case Qt::Key_T:
+    myMacros->handleKeypress('T');
+    break;
+  case Qt::Key_U:
+    myMacros->handleKeypress('U');
+    break;
+  case Qt::Key_V:
+    myMacros->handleKeypress('V');
+    break;
+  case Qt::Key_W:
+    myMacros->handleKeypress('W');
+    break;
+  case Qt::Key_X:
+    myMacros->handleKeypress('X');
+    break;
+  case Qt::Key_Y:
+    myMacros->handleKeypress('Y');
+    break;
+  case Qt::Key_Z:
+    myMacros->handleKeypress('Z');
+    break;
+  case Qt::Key_Space:
+    myMacros->handleKeypress(' ');
+    break;
+  default:
+    QMainWindow::keyPressEvent(event);
+    break;
+  }
+}
+
+
+bool MainWindow::hasMacroButton(
+  unsigned int buttonID)
+{
+  return myMacros->hasMacroButton(buttonID);
+}
+
+
+QString MainWindow::getMacroButtonText(
+  unsigned int buttonID)
+{
+  return myMacros->getMacroButtonText(buttonID);
+}
+
+
+void MainWindow::executeMacroButton(
+  unsigned int buttonID)
+{
+  myMacros->executeMacroButton(buttonID);
+}
+
+
+void MainWindow::updateUserButtons()
+{
+  myPanels->updateUserButtons();
+}
+
+
+void MainWindow::storeMacros()
+{
+  myMacros->storeSettings();
+}
+
+
+void MainWindow::setMacroKbdFocus(
+  int index)
+{
+  myMacros->setKbdFocus(index);
+}
+
+
+void MainWindow::setMacroBtnFocus(
+  int index)
+{
+  myMacros->setBtnFocus(index);
+}
index c27aedf..e173610 100644 (file)
@@ -10,6 +10,7 @@
 class QListWidget;
 class QListWidgetItem;
 class QDialog;
+class QKeyEvent;
 
 class PIRSelectKeysetForm;
 class PIRSelectDeviceForm;
@@ -18,9 +19,11 @@ class PIRDocumentationForm;
 class PIRAboutForm;
 class PIRFavoritesDialog;
 class PIRKeysetWidgetItem;
+class PIRMacroPack;
 
 class PIRKeysetManager;
 class PIRPanelManager;
+class PIRMacroManager;
 
 namespace Ui {
     class MainWindow;
@@ -71,11 +74,25 @@ public:
   QString getCurrentName();
   QString getCurrentFullName();
 
+  QString getKeysetMake(
+    unsigned int id);
+
+  QString getKeysetName(
+    unsigned int id);
+
+  QString getFullKeysetName(
+    unsigned int id);
+
   unsigned int getCurrentKeyset()
   {
     return currentKeyset;
   }
 
+  bool findKeysetID(
+    QString make,
+    QString name,
+    unsigned int &id);
+
   void insertCornerButtons();
   void disableUpdates();
   void enableUpdates();
@@ -93,6 +110,28 @@ public:
   void updateKeysetSelection(
     unsigned int targetID);
 
+  PIRMacroPack *getUserPack();
+  PIRMacroPack *getMultitapPack();
+
+  bool hasMacroButton(
+    unsigned int buttonID);
+
+  QString getMacroButtonText(
+    unsigned int buttonID);
+
+  void executeMacroButton(
+    unsigned int buttonID);
+
+  void updateUserButtons(); // Should this be a slot?
+
+  void storeMacros();
+
+  void setMacroKbdFocus(
+    int index);
+
+  void setMacroBtnFocus(
+    int index);
+
 signals:
   void buttonPressed(
     unsigned int keysetID,
@@ -121,6 +160,9 @@ private slots:
   void finalCleanup();
 
 private:
+  void keyPressEvent(
+    QKeyEvent *event);
+
   void populateFavorites();
 
   Ui::MainWindow *ui;
@@ -134,6 +176,7 @@ private:
 
   PIRKeysetManager *myKeysets;
   PIRPanelManager *myPanels;
+  PIRMacroManager *myMacros;
 
   unsigned int currentKeyset;
 
index c07f271..fe1b5dc 100644 (file)
@@ -223,7 +223,12 @@ SOURCES += main.cpp mainwindow.cpp \
     pirkeynames.cpp \
     dialogs/pircreatecommanddialog.cpp \
     keysets/creative.cpp \
-    keysets/crown.cpp
+    keysets/crown.cpp \
+    dialogs/pireditmacrodialog.cpp \
+    dialogs/pirdeletemacrodialog.cpp \
+    forms/piruserform.cpp \
+    macros/pirmacromanager.cpp \
+    dialogs/pireditcommanddialog.cpp
 HEADERS += mainwindow.h \
     pirkeynames.h \
     pirmakenames.h \
@@ -421,7 +426,12 @@ HEADERS += mainwindow.h \
     macros/pirreversemultitap.h \
     dialogs/pircreatecommanddialog.h \
     keysets/creative.h \
-    keysets/crown.h
+    keysets/crown.h \
+    dialogs/pireditmacrodialog.h \
+    dialogs/pirdeletemacrodialog.h \
+    forms/piruserform.h \
+    macros/pirmacromanager.h \
+    dialogs/pireditcommanddialog.h
 FORMS += mainwindow.ui \
     pirdocumentationform.ui \
     piraboutform.ui \
@@ -454,7 +464,11 @@ FORMS += mainwindow.ui \
     forms/pircameraform.ui \
     forms/pirpowersearchform.ui \
     dialogs/pirselectmacrodialog.ui \
-    dialogs/pircreatecommanddialog.ui
+    dialogs/pircreatecommanddialog.ui \
+    dialogs/pireditmacrodialog.ui \
+    dialogs/pirdeletemacrodialog.ui \
+    forms/piruserform.ui \
+    dialogs/pireditcommanddialog.ui
 
 # Please do not modify the following two lines. Required for deployment.
 include(deployment.pri)
index 473ff1b..767e2d6 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by Qt Creator 2.4.1, 2012-09-10T23:36:40. -->
+<!-- Written by Qt Creator 2.4.1, 2012-09-14T20:44:41. -->
 <qtcreator>
  <data>
   <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -79,7 +79,7 @@
       <value type="QString" key="ProjectExplorer.ProcessStep.Arguments">dpkg-buildpackage -sa -S -uc -us</value>
       <value type="QString" key="ProjectExplorer.ProcessStep.Command">/Users/john/QtSDK/Maemo/4.6.2/bin/mad</value>
       <value type="bool" key="ProjectExplorer.ProcessStep.Enabled">false</value>
-      <value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">/Users/john/Develop/n900/pierogi-1.1.10</value>
+      <value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">/Users/john/Develop/n900/pierogi-1.1.11</value>
       <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
       <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
       <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
       <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedFiles">
        <value type="QString">/Users/john/Develop/n900/pierogi-build-maemo-Qt_for_Fremantle_PR1_3_Devices__Qt_SDK__Release/pierogi_0_1_4_armel.deb</value>
        <value type="QString">/Users/john/Develop/n900/pierogi-build-maemo-Qt_for_Fremantle_PR1_3_Devices__Qt_SDK__Release/pierogi_0_6_9_armel.deb</value>
+       <value type="QString">/Users/john/Develop/n900/pierogi-build-maemo-Qt_for_Fremantle_PR1_3_Devices__Qt_SDK__Release/pierogi_1_1_11_armel.deb</value>
        <value type="QString">/Users/john/Develop/n900/pierogi-build-maemo-Qt_for_Fremantle_PR1_3_Devices__Qt_SDK__Release/pierogi_1_1_7_armel.deb</value>
        <value type="QString">/Users/john/Develop/n900/pierogi-build-maemo-Qt_for_Fremantle_PR1_3_Devices__Qt_SDK__Release/pierogi_0_5_1_armel.deb</value>
        <value type="QString">/Users/john/Develop/n900/pierogi-build-maemo-Qt_for_Fremantle_PR1_3_Devices__Qt_SDK__Release/pierogi_0_5_3_armel.deb</value>
        <value type="QString">192.168.0.15</value>
        <value type="QString">192.168.0.15</value>
        <value type="QString">192.168.0.15</value>
+       <value type="QString">192.168.0.15</value>
        <value type="QString">localhost</value>
        <value type="QString">192.168.0.15</value>
        <value type="QString">192.168.0.15</value>
        <value type="QString"></value>
        <value type="QString"></value>
        <value type="QString"></value>
+       <value type="QString"></value>
       </valuelist>
       <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedTimes">
        <value type="QDateTime">2012-01-19T22:18:07</value>
        <value type="QDateTime">2012-02-22T09:24:57</value>
+       <value type="QDateTime">2012-09-14T20:39:15</value>
        <value type="QDateTime">2012-09-06T16:32:59</value>
        <value type="QDateTime">2012-02-06T17:22:16</value>
        <value type="QDateTime">2012-02-09T18:12:21</value>
        <value type="QDateTime">2012-09-02T20:43:12</value>
        <value type="QDateTime">2012-01-17T00:15:23</value>
        <value type="QDateTime">2012-01-17T13:21:05</value>
-       <value type="QDateTime">2012-09-10T20:28:17</value>
+       <value type="QDateTime">2012-09-10T23:40:52</value>
        <value type="QDateTime">2012-02-19T19:25:47</value>
        <value type="QDateTime">2012-09-03T18:20:27</value>
        <value type="QDateTime">2012-02-03T10:04:34</value>
index 1383817..d673c38 100644 (file)
@@ -1,6 +1,7 @@
 #include "pirkeynames.h"
 
 #include <QComboBox>
+#include <QVariant>
 
 PIRKeynameMgr::PIRKeynameMgr()
 {
@@ -226,10 +227,10 @@ PIRKeyName PIRKeynameMgr::getKeynameID(
 void PIRKeynameMgr::populateComboBox(
   QComboBox *cb)
 {
-  KeynameCollection::const_iterator i = keynameStrings.begin();
-  while (i != keynameStrings.end())
+  ReverseKeynameCollection::const_iterator i = keynameIDs.begin();
+  while (i != keynameIDs.end())
   {
-    cb->insertItem(i->first, i->second);
+    cb->addItem(i->first, QVariant(i->second));
     ++i;
   }
 }
index 0bd79f4..ffdff53 100644 (file)
@@ -8,6 +8,23 @@ enum PIRKeyName{
   // The "Unmapped" key is a placeholder for commands with no key mapping:
   Unmapped_Key,
 
+  // Power control:
+  Power_Key,
+  PowerOn_Key,
+  PowerOff_Key,
+
+  // Menu control:
+  Menu_Key,
+  Up_Key,
+  Down_Key,
+  Left_Key,
+  Right_Key,
+  Select_Key,
+  Exit_Key,
+  PageUp_Key,
+  PageDown_Key,
+  Guide_Key,
+
   // Number keys:
   Zero_Key,
   One_Key,
@@ -27,11 +44,6 @@ enum PIRKeyName{
   Dash_Key,
   DoubleDigit_Key,
 
-  // Power control:
-  Power_Key,
-  PowerOn_Key,
-  PowerOff_Key,
-
   // Volume control:
   VolumeUp_Key,
   VolumeDown_Key,
@@ -78,18 +90,6 @@ enum PIRKeyName{
   RecordTimed_Key,
   RecordPDC_Key,
 
-  // Menu control:
-  Menu_Key,
-  Up_Key,
-  Down_Key,
-  Left_Key,
-  Right_Key,
-  Select_Key,
-  Exit_Key,
-  PageUp_Key,
-  PageDown_Key,
-  Guide_Key,
-
   // Color buttons:
   Red_Key,
   Green_Key,
index 90ce663..5730ce2 100644 (file)
 #include <QMutex>
 
 // Debugging includes:
-//#include <iostream>
+#include <iostream>
 
 // Global communications mechanism:
 extern bool stopRepeatingFlag;
@@ -215,7 +215,8 @@ PIRKeysetManager::PIRKeysetManager()
 
   setupKeyset(new CreativeAudio1(++counter));
   setupKeyset(new CreativeAudio2(++counter));
-  setupKeyset(new CreativeMisc1(++counter));
+  setupKeyset(new CreativeAudio3(++counter));
+  setupKeyset(new CreativeAudio4(++counter));
 
   setupKeyset(new CrownTV1(++counter));
   setupKeyset(new CrownAudio1(++counter));
@@ -342,6 +343,7 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new GrundigTV1(++counter));
   setupKeyset(new GrundigTV2(++counter));
   setupKeyset(new GrundigTV3(++counter));
+  setupKeyset(new GrundigTV4(++counter));
   setupKeyset(new GrundigDVD1(++counter));
 
   setupKeyset(new HaierTV1(++counter));
index e6feafc..2e485c7 100644 (file)
@@ -15,6 +15,7 @@
 #include "forms/piraudiodeviceform.h"
 #include "forms/pircameraform.h"
 #include "forms/pirroombaform.h"
+#include "forms/piruserform.h"
 #include "forms/pirmacroform.h"
 #include "forms/pirpowersearchform.h"
 
@@ -26,7 +27,7 @@
 
 // Debugging:
 //#include <QMaemo5InformationBox>
-//#include <iostream>
+#include <iostream>
 
 PIRPanelManager::PIRPanelManager(
   MainWindow *mw):
@@ -45,6 +46,7 @@ PIRPanelManager::PIRPanelManager(
     audioDeviceForm(0),
     cameraForm(0),
     roombaForm(0),
+    userForm(0),
     macroForm(0),
     powerSearchForm(0),
     altMainPanelFlag(false),
@@ -109,7 +111,10 @@ PIRPanelManager::PIRPanelManager(
   shortPanelNames[Roomba_Panel] = "Roomba";
   longPanelNames[Roomba_Panel] =
     "Roomba Panel - robotic vacuum cleaner controls";
-  shortPanelNames[Macro_Panel] = "Edit Macros";
+  shortPanelNames[User_Panel] = "User";
+  longPanelNames[User_Panel] =
+    "User Panel - macro control buttons";
+  shortPanelNames[Macro_Panel] = "Edit Macro Contents";
   longPanelNames[Macro_Panel] =
     "Edit Macros Panel - create, delete, edit, and manage macros";
   shortPanelNames[PowerSearch_Panel] = "Keyset Search";
@@ -161,6 +166,9 @@ PIRPanelManager::PIRPanelManager(
   roombaForm = new PIRRoombaForm(mainWindow);
   panels[Roomba_Panel] = roombaForm;
 
+  userForm = new PIRUserForm(mainWindow);
+  panels[User_Panel] = userForm;
+
   macroForm = new PIRMacroForm(mainWindow);
   panels[Macro_Panel] = macroForm;
 
@@ -176,6 +184,7 @@ PIRPanelManager::PIRPanelManager(
   pset.push_back(Keypad_Panel);
   pset.push_back(Menu_Panel);
   pset.push_back(Media_Panel);
+  pset.push_back(User_Panel);
 //  pset.push_back(Input_Panel);
   tabLists[Universal_Tabs] = pset;
 
@@ -321,6 +330,12 @@ void PIRPanelManager::commonEnableButtons(
 }
 
 
+void PIRPanelManager::updateUserButtons()
+{
+  userForm->setupButtons();
+}
+
+
 void PIRPanelManager::useMainPanel()
 {
   if (!altMainPanelFlag)
@@ -404,3 +419,9 @@ void PIRPanelManager::setupTabs(
   currentTabsName = name;
   updateTabSet();
 }
+
+
+QComboBox *PIRPanelManager::getKeysetComboBox()
+{
+  return macroForm->getKeysetComboBox();
+}
index ac78131..5f221d4 100644 (file)
@@ -18,12 +18,14 @@ class PIRAirConditionerForm;
 class PIRAudioDeviceForm;
 class PIRCameraForm;
 class PIRRoombaForm;
+class PIRUserForm;
 class PIRMacroForm;
 class PIRPowerSearchForm;
 
 class PIRKeysetWidgetItem;
 class PIRKeysetManager;
 class QListWidget;
+class QComboBox;
 class MainWindow;
 
 #include <list>
@@ -57,6 +59,8 @@ public:
     unsigned int currentID,
     unsigned int defaultID);
 
+  void updateUserButtons();
+
   void useMainPanel();
   void useAltMainPanel();
 
@@ -69,6 +73,8 @@ public:
 */
   void setupTabs(PIRTabBarName name);
 
+  QComboBox *getKeysetComboBox();
+
 private:
   void commonEnableButtons(
     const PIRKeysetManager *keyset,
@@ -89,6 +95,7 @@ private:
   PIRAudioDeviceForm *audioDeviceForm;
   PIRCameraForm *cameraForm;
   PIRRoombaForm *roombaForm;
+  PIRUserForm *userForm;
   PIRMacroForm *macroForm;
   PIRPowerSearchForm *powerSearchForm;
 
index cec11b5..3f8102f 100644 (file)
@@ -18,6 +18,7 @@ enum PIRPanelName
   Audio_Panel,
   Camera_Panel,
   Roomba_Panel,
+  User_Panel,
   Macro_Panel,
   PowerSearch_Panel,
   Last_Panel_Marker // Used when traversing this enumeration.
index 029fa78..ff55152 100644 (file)
@@ -5,6 +5,7 @@
 #include "mainwindow.h"
 
 #include <QSettings>
+#include <QComboBox>
 
 //#include <iostream>
 
@@ -23,6 +24,9 @@ PIRPreferencesForm::PIRPreferencesForm(
   setAttribute(Qt::WA_Maemo5StackedWindow);
   setWindowFlags(windowFlags() | Qt::Window);
 
+  setupMacroComboBox(ui->macroKbdComboBox);
+  setupMacroComboBox(ui->macroBtnComboBox);
+
   QSettings settings("pietrzak.org", "Pierogi");
 
   settings.beginGroup("Preferences");
@@ -61,6 +65,38 @@ PIRPreferencesForm::PIRPreferencesForm(
     }
   }
 
+  if (settings.contains("macroKbdFocus"))
+  {
+/*
+    int index = mainWindow->findMacroPack(
+      settings.value("macroKbdFocus").toString());
+*/
+    int index = settings.value("macroKbdFocus").toInt();
+
+    ui->macroKbdComboBox->setCurrentIndex(index);
+    mainWindow->setMacroKbdFocus(index);
+  }
+  else
+  {
+    mainWindow->setMacroKbdFocus(0);
+  }
+
+  if (settings.contains("macroBtnFocus"))
+  {
+/*
+    int index = mainWindow->findMacroPack(
+      settings.value("macroBtnFocus").toString());
+*/
+    int index = settings.value("macroBtnFocus").toInt();
+
+    ui->macroBtnComboBox->setCurrentIndex(index);
+    mainWindow->setMacroBtnFocus(index);
+  }
+  else
+  {
+    mainWindow->setMacroBtnFocus(0);
+  }
+
   settings.endGroup();
 }
 
@@ -152,3 +188,35 @@ void PIRPreferencesForm::on_altMainCheckBox_stateChanged(
 
   settings.endGroup();
 }
+
+
+void PIRPreferencesForm::on_macroKbdComboBox_activated(int index)
+{
+  QSettings settings("pietrzak.org", "Pierogi");
+  settings.beginGroup("Preferences");
+  settings.setValue("macroKbdFocus", index);
+  settings.endGroup();
+
+  mainWindow->setMacroKbdFocus(index);
+}
+
+
+void PIRPreferencesForm::on_macroBtnComboBox_activated(int index)
+{
+  QSettings settings("pietrzak.org", "Pierogi");
+  settings.beginGroup("Preferences");
+  settings.setValue("macroBtnFocus", index);
+  settings.endGroup();
+
+  mainWindow->setMacroBtnFocus(index);
+  mainWindow->updateUserButtons();
+}
+
+
+void PIRPreferencesForm::setupMacroComboBox(
+  QComboBox *cb)
+{
+  // Crappy hardcoded list.  Need to replace this...
+  cb->addItem("User Defined Macros");
+  cb->addItem("Reverse Multitap Keboard Macros");
+}
index 322bbf4..8c7a9e6 100644 (file)
@@ -5,6 +5,7 @@
 
 class MainWindow;
 class PIRKeysetManager;
+class QComboBox;
 
 namespace Ui {
 class PIRPreferencesForm;
@@ -36,8 +37,13 @@ private slots:
   void on_clearDefaultButton_clicked();
   void on_useDefaultCheckBox_stateChanged(int arg1);
   void on_altMainCheckBox_stateChanged(int arg1);
+  void on_macroKbdComboBox_activated(int index);
+  void on_macroBtnComboBox_activated(int index);
 
 private:
+  void setupMacroComboBox(
+    QComboBox *cb);
+
   Ui::PIRPreferencesForm *ui;
 
   MainWindow *mainWindow;
index b149e70..aea5a6b 100644 (file)
          </property>
         </widget>
        </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLabel" name="macroKbdLabel">
+           <property name="text">
+            <string>Macro Pack with Keyboard Focus</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="macroKbdComboBox"/>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QLabel" name="macroBtnLabel">
+           <property name="text">
+            <string>Macro Pack for User Buttons</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="macroBtnComboBox"/>
+         </item>
+        </layout>
+       </item>
       </layout>
      </widget>
     </widget>
index 94617eb..69501c1 100644 (file)
@@ -4,6 +4,7 @@
 //#include <QListWidget>
 //#include <QListWidgetItem>
 #include <QKeyEvent>
+#include <QComboBox>
 
 #include "mainwindow.h"
 #include "pirkeysetwidgetitem.h"
@@ -162,7 +163,7 @@ bool PIRSelectKeysetForm::selectFirstKeyset()
 }
 
 
-QString PIRSelectKeysetForm::getKeysetName()
+QString PIRSelectKeysetForm::getCurrentKeysetName()
 {
   QListWidgetItem *item = ui->keysetListWidget->currentItem();
 
@@ -177,6 +178,38 @@ QString PIRSelectKeysetForm::getKeysetName()
 }
 
 
+QString PIRSelectKeysetForm::getKeysetName(
+  unsigned int id)
+{
+  int count = ui->keysetListWidget->count();
+
+  if (count == 0) return "";
+
+  QListWidgetItem *localItem;
+  PIRKeysetWidgetItem *kwi;
+  int row = 0;
+
+  while (row < count)
+  {
+    localItem = ui->keysetListWidget->item(row);
+
+    if (localItem)
+    {
+      kwi = dynamic_cast<PIRKeysetWidgetItem *> (localItem);
+
+      if (kwi->getID() == id)
+      {
+        return kwi->text();
+      }
+    }
+
+    ++row;
+  }
+
+  return "";
+}
+
+
 void PIRSelectKeysetForm::keyPressEvent(
   QKeyEvent *event)
 {
@@ -298,10 +331,7 @@ void PIRSelectKeysetForm::selectKeyset(
 {
   int count = ui->keysetListWidget->count();
 
-  if (count == 0)
-  {
-    return;
-  }
+  if (count == 0) return;
 
   QListWidgetItem *localItem;
   PIRKeysetWidgetItem *kwi;
@@ -330,3 +360,32 @@ void PIRSelectKeysetForm::selectKeyset(
     ++row;
   }
 }
+
+
+void PIRSelectKeysetForm::populateKeysetComboBox(
+  QComboBox *comboBox)
+{
+  int count = ui->keysetListWidget->count();
+
+  if (count == 0) return;
+
+  QListWidgetItem *localItem;
+  PIRKeysetWidgetItem *kwi;
+  int row = 0;
+
+  while (row < count)
+  {
+    localItem = ui->keysetListWidget->item(row);
+
+    if (localItem)
+    {
+      kwi = dynamic_cast<PIRKeysetWidgetItem *> (localItem);
+
+      comboBox->addItem(
+        kwi->text(),
+        QVariant(kwi->getID()));
+    }
+
+    ++row;
+  }
+}
index 85d579a..28961e3 100644 (file)
@@ -8,8 +8,9 @@
 
 class QListWidget;
 class QListWidgetItem;
-class PIRKeysetWidgetItem;
 class QKeyEvent;
+class QComboBox;
+class PIRKeysetWidgetItem;
 class PIREditKeysetDialog;
 class MainWindow;
 
@@ -46,13 +47,19 @@ public:
   bool selectPrevKeyset();
   bool selectFirstKeyset();
 
-  QString getKeysetName();
+  QString getCurrentKeysetName();
+
+  QString getKeysetName(
+    unsigned int id);
 
   void openCurrentKeysetDialog();
 
   void selectKeyset(
     unsigned int targetID);
 
+  void populateKeysetComboBox(
+    QComboBox *comboBox);
+
 protected:
   void keyPressEvent(
     QKeyEvent *event);
index 32b8337..593bb7f 100644 (file)
@@ -10,7 +10,7 @@ extern QMutex commandIFMutex;
 
 // I've found no official data on the RCA protocol yet, but from available
 // notes and guesswork I'm using the following:
-// A "zero" is encoded with a 500 usec pulse, 500 usec space.
+// A "zero" is encoded with a 500 usec pulse, 1000 usec space.
 // A "one" is encoded with a 500 usec pulse, and 2000 usec space.
 // The header is a 4000 usec pulse, 4000 usec space.
 // Commands end with a trailing 500 usec pulse.
@@ -28,7 +28,7 @@ RCAProtocol::RCAProtocol(
   unsigned int index)
   : SpaceProtocol(
       guiObject, index,
-      500, 500,
+      500, 1000,
       500, 2000,
       4000, 4000,
       500,
index 74022b4..c181660 100644 (file)
@@ -1,3 +1,16 @@
+pierogi (1.1.12) unstable; urgency=low
+  * Pushing up an initial implementation of Macros.  For now, they don't do much, they don't work terribly well, and they are thoroughly undocumented, but at least they exist. :)
+  * Updates to keysets for Creative, Grundig, and RCA, and a bugfix to the RCA protocol.
+
+ -- John Pietrzak <jpietrzak8@gmail.com>  Fri, 14 Sep 2012 20:44:44 -0400
+
+pierogi (1.1.11) unstable; urgency=low
+  * A handful of fixes and updates for the Power Search form -- some button interactions fixed (thanks Sixwheeledbeast), the Pioneer protocol sped up a bit, and an "edit keyset" button added to the panel.
+  * Removed the Triax testing keyset, it didn't work. :(
+  * First pass at keysets for Creative and Crown.
+
+ -- John Pietrzak <jpietrzak8@gmail.com>  Mon, 10 Sep 2012 23:49:23 -0400
+
 pierogi (1.1.10) unstable; urgency=low
   * Adding one more Triax keyset for testing. :)
 
index 1c962a0..4e367c1 100644 (file)
@@ -11,8 +11,8 @@ Architecture: armel
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Universal Infrared (IR) Remote Control for N900
  Pierogi is a Universal Infrared Remote Control app for the Nokia N900.  It is independent from the LIRC server, and stores all configuration info internally.
-XB-Maemo-Upgrade-Description: New Keyset on top of Bugfix
- On top of the bugfix added in the previous update, this update adds a new Triax keyset I'd like to test out.
+XB-Maemo-Upgrade-Description: Now with Macros!
+ Finally includes a very limited macro capability.  Please don't push it too hard.  Also includes updates to Creative, Grundig, and RCA keysets, as well as a bugfix for the RCA protocol.
 XSBC-Bugtracker: https://garage.maemo.org/tracker/?func=add&group_id=2286&atid=7641
 XB-Maemo-Display-Name: Pierogi
 XB-Maemo-Icon-26: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAEChJREFUaIHtmFmsXudVhp/1TXv/+x/OOZ4TO66dZmBo0jZJoxBQW8ookAq0mIhJQhUXcAGIAhICRClDb4q4YBRDGSoBFS2ikQoUSkpNIEkbnJQ0cVL7xLUd2/GZfKZ/2MP3fYuLE6LUDQEFQi/oe7e/X7/2++71an1rvfAlfAn/vyH/2Q+Hbzp89M47rvm1aw/0XvPs5ea+M5/b+OiJB5/88FX/1Vee4kvjagEC6Dt/+ns++Ya7Xn2ndWX2zkvKLV070Xp72Vy6PG4vLa0/8pcffuytlxcvr3wxSL8Q7qpnBXjzW+64M/QC1hiTUq0xWbHWihjf3TBvwqtene46e377/Z9swztWz59/9ovA+3nYqw9uv/uWH/y27/iat3rv1AcnkARjCSHgQ2FdqNT5Hgf27bpxfsF+/yTms2vPXjkJGL4Ilvo8AXfcfes9P/kTx96/sHtEKKwYURCHMULWjsnmhMlkXSbbG5J1m317Rr073nDknutvPPy2wZ6FA9syOzFbm7X/lwI+z0Jf+dob7jlw3UGsA8ioJlJWZpMpXUzEVGPFUpYW6xSqgeQ80bu/5tpbX/u6L7/1mvvnv+nPPvu3dwFw++2eEye6V1rA8xU4esvRr7/nnm9+z959C7hgVEQEMWxvbtE0nYoYYhxL7DJZjRZlya691zCc2y0qqPcq1+6vDp1f3r7UhbnF2RNPzF5p8rDTdQTQX3rvj11609fedo31EEqPNZa6bnjm7Clyakk5UlW7mN+9gKYZw+EuCBUiUA1203Yt0+01zjz1VJptPWtX1mZ84v6zf/nYE59779LppU++UgLcfwi44caD1zinIKJGDKpIU8/omimYoM4NWdg1J8ElEuhg6MkCvhiSESRNsXkmB665zmyWXncfcLJnz/Dtd9127dtOP33hn/75gUvfe+H0hYuvhIB86NChXbv3zZFF1bsgoLRtw3h7HaMd1hZiTY33Geug7BUSvEUNYKCdXcGZlqpX4Qplbu6oNG3UohDZtXu/XH/TdW8ajj7z4MO7ez/36YdOv/9/WwA33Hr4R3zwrQveOwf1dJvJZJvpeBvjoOh59u4/SGlm9IfzlFUBBkQcMW1Sb62QUkI1I5pw0lF1M7FuSt4TNO/bLUeOvOXab/9O/nh5efNP/uLP/+ETT55a/4Wzj589/j8VYHffvHv41Xfd9jOve/31ryoLb0R2rLO5tUE9ndDrlQyGQ8oS5kYjXGERieQYqSeb1OMVJqufQ0wPX1b0ewOMQSwR5y2+LPHOibGlQVqqasjBa689evjQwg+Ywvhzi5c//hyXl3WPuD3Vnptvvvnwm6wT1dRKypGuS7TNlJynDIZHCMHiQ0CskrqWGDtCWWIlo9aRZhsYU2KrEqO1kCdIEXBZwBbSpRbvS6xLErNRDh9kMBqxf9/gZ1dXZ/c/8fBn/w7IL6cC7pZbD//UzTcfwAqSsgCe6eQyuatxRglFxdxcn6IUvDOogoSC6dYq9fYa0/E5+nuvpywDqut4rVBbEqcrpDglY7DVQeqtc7hynrIsxZrIcDhiNP8V+q6f3//Rum44e/4yT51aO3VlffyRSxfXPnFhaXr8yuLi+Cph9rkqPX/mBtXwDS4MELGoJkUzQkJzLdZYykLRXKtmjzWVqCqqSSfrl6g3zyGFR5p1Uu6Is7GYakERI9urK9pfGGFMQCRjjZHcTDWpx2AwJspoWMnmaq29ysuNN15H09qbjhw58M47bnv1Oy+cX35o5XX7F1evbN136dzGw89IscjiYvMFFej1+vPWW1QziGINYq3HSMA6C0SscWIl03Y1sa2xoS9KDd4SwgDHDIlQhHlyO8UP9mFtKSJCzlHjeF1sb4E4HZPjtthehbM9jIVerxREQLJed2iPrCxfYTxpec1rjtw1HL7+rq7b/r7HP/PYhe3NrSc3Xvfap598fO23zjx14fHnBRR9c8aJ3u6LAksGyVr1K2ZTLzk2zLYv4WW3FsVeNGdJsWO6cVrjbBOLx6Qav+dGMAO0m4iJS2SF/p79KuKxdORmXZmMpTCBLlsVrXCi0uUJvTIznWyrNZ69+4Ys7JojpqBnz5xm45mTjEa7uPPuNx/U3B0M3n+DSP1DbTtjPN7kt379Y+9wVTBzYgPOCkYsYpyEUGCNo4s1WQ1qgqAdmhWNDcaI5BQRalKbIRnEeYwvUR3iwhwxduJDD2OtUlUy21iDXGMkSyg8mUTG4L1Q9voym05w3gAWY5CFXbvwwaDJELspwQecB6FSjJc5W3LnVx/6Tbc9bpK3ZqeHu4A1QgiOohzQNTO6aMg5YyTRzTaxCElB2zXoprTJMSufxQ4ivWqOToV28zLEGSxchw/zpA4wDqHEWQdGMOLxxiBEiuBJeYgSERXEGIrSk2KflHbe712BCw6DINmharTfGxb26Jcd3n/LrUff2BsM1BrBGCPWC84HVDOby4tYEjk1BN9nvD1mtr6E1JcxKM6MKEd7MdqQuzHd+kWsNOKDIbYJX1ZkrOh0E3JL2aski0NzRlONrw6h4lGN5JQQa4mxw7o+IhawDIYVvVGF9yVYxVqDYHnwoSd/zSw9szpeX10mx05SPZXY7gyRRa+iGgwRZ6lnV2imNVkV6wqKahcqGWwPHLRtS1fPaLeexYdK0myb6doSqKXeWpVc17hqH+Vor0g5h+QMucMYg3OKDxbnS5SEdeBDADLCToWc9zjrcSFgTRBjnYjJbF0ZXzQbk+ljy0uXaJuGLjbadTW5m2KkozcYUJRzNLOOWT1jur1CTmNcYUhqURmABHKMWGswRmgmK9pNO7pasdZDzJq7Bgl9CLsVP8C5HmJLxBeIEYwkrAEQBIuIJWsGFJFE2SvxwWMthBDUWof3ha6sbF+wo33zG6Ohe8sNNxzYb51I1oQzJUY6sTbjXA/nCt3aXAXjRHNCxehg/ghuVOGKCqsN4jLV/F4xtsD6nlQLB1SowXvUF0iuxViDQVA8zjmRmOjqTdpp0q5rmEzHIhLI2et00hHbGYNRn/n5CucDxlkRUUmJTtW6D/zBR99hTp04tbqxvvUvKXU55w5rrCRtJKZE1oQNJdXcHlnYf0S2t1apmylt24rxXpwfSujNSWxbMVpKbBNhMMJXFUUlEga7xNgSLyKiCdGEihWxVrouEdOOx1VqMdZI10FKiawiOUUJwchofig2BDFGRXJGsyrglpeXWFpamjiAja3miqasMbY4Z4BAzmCzEEIgGejRZ8v3mc4mqPSYjDep+gPEBEyoEOMwrkDjBGOVLGBcH0ODsSWaZiAexJC6KV09QaQgiSfHCbNZjTEOTYY21kDHaH6eajDCmA5RSAa0U0SsLJ4+dx6eG6efODv+vdiN3103lRpj6BU7cVHKineBqtqNVgv43hz1tGZ74zJrm+tMJhP6VWS0+xCikdw1JALGeUQ8YbAfm1tSOyYTyDgMlqyO7Cu6qKytTalniRgFpGI8UzS3XH/jTRRlj5RaMI7YKQZD1pn8y/0nxn/4Ox/5OkDMsWPH7LmHT14eb20S21piF1EiaIvmDiWDZqwUWO8pqxH90QEwPeoOZo0Qm4aMBRuwxYCMIQM5NeTYktqWFBvUWHJWkvSIuU8bC6azSN3srKxtkxCNjOb7FL0SY/PO3vFcCBhTy3Ra88D9j3545cLKIqDugx/8oAJsbW3n/lxhcnSqWBFRjOyM6G23iTGWspgnm4QyYDqep5nALAqz8QahN8SYRCjm0ay0TaLIkRQzSoGthnSdElOk7oTtrRkx1nT1NooiMkAl0R9WVP0SJJLZWZLAkbWj66KefOK0njx16V1Xj6c0KRy65SsGt2O9FMEgOKwxqEQ0TcmpRUXxrqIq57GhJFQLpAybWy1tSrTdFEMQTA9CxXTa0OVO6mbMxvqEre2JbG6OWb54kenkCk3dIa6PcwN6VZ9Xf9nNzC/spax6iAiaFEGp21ZzhKZN8vM/+9v7lxYvPr9bP58LXbw0/eVTp8ffdfsde+ZSFzE0RHEY/HMBaiZ1E1ocKomi1wOjIHuZTVaZ1pHgStQ0alsnLhhy1yHWqGJlY2OJrD2NMYkaCwTEBHqDOfqDAXPzB9C8BdYi6kj1FFUlK2jOiHj5t0c/Pb46j30+F1p5dmXTD/dW17+qelNVBZw1iChIQnAY4zFkcmbngnEZZwXnHAqkriFGS91MpGkauuiom8ysjlI3ibqJxJgl54wNA4regN6wz559BxmO9hBCSco1AKqZHBNZMzGhbYecO/MM7/+je3/48jNrj75QwBfE62/42q9646/88luOi7ZalIWU5Yi2XcMYSygGGGOxxu+0RmcRIzvku5a6qZluTTV2WWI3I2eLYlXEivUB55xa72Q4t4BxnuD6WNfDWEtOLTEZUqxJqaOLSVOGpo78ye/+6cp9Hz/5dUtnlh6/mu/V6bQ8/I8P/tPSs7dx4MC8NI3T3qCUwC5SnGKtJSdDlojkFkkeVHbGAG8JxuPcPKnrSHlI17VoBmMNRTHHTthn8KFCjMX5gpRaYlRyiojvAx6hIMZNFCObVzb52PFT37jyIuQ/z0IvRBiMbr7+6O5bjAv0ilKM8ZolY10pzlkQ0a6dkVJLzh2KoAJijRzd/000aUVUohahRyhLvA8UvaEYK1ix+GIBsVaMFKgAGFUgJZWui+SkTKednD97lg/9+b1//8jxJ3/1xXi+qIVeiB/9ybf+1du/++5vF2vUGS9F6WlmY3LeIW/FIs6BxOes4Ekpqg9DAYMxjqRGxThxboQxPU2pEWsCObfkHBECTbNFTBlNfZ1NNmVrY5Vffe/v/83qOb57cXFx66U4mhc7PHbsmAX49f7r335leRmiSJdcrusxWROqDqQk5kzXNmisyTGSYmKyMaFtZ2CElDKIRwRy7ohxihWDUCL06bpE09SIVMSIrq+dlaef+hQf+fC9PHTf4rc+R/4lP/KLWujkyZMKCMePa39+7vpd8/611XAksR3Tda0iRkI5T8odOWeUnU6lCr7ogRghJ3LOkBXNUbrYkNsZsaulaxti2zKrt5hOxsxmtXaR/MB9f20+fvzEB//tVPODVy6uXngp4v+Bl1T3Qrz1HW9747FvOXB8194FjHOIZHWuJ854yGMwCRSyqFrnRcQgGBQ0pyhJDTkmUofO2khKEclRzp+7yGceu3DmqafH73vgbz/9nhfw+m+ldC9agRfDZx998hyjw2UzWbvJS+yX/VE0OYiqilgla0ZzVlDJKZNzIkUFFbG2z2R7haaZaoxTbWczGY+35MK5JT5072d/+OwzxY+d+PinPvbf5fKyBAA89ciT9w1vuPPe9eXla/b0u1uKXk8wZa7KAeLnadqZpNhqzkLbNYCVtmu0LPYy3lpCsTKrG3n0xBn+9ZGVj33ykbVffOijj7xv+fz5+uWQhy+8B/5L3HHgVU+/+91/fOx9wI+/5103tPncmwfpqd9YWKjKqizVhVIwGXJmOmlZWd5kbePBlaXN8Idd4/56S8OZBz7w95dgp1k8xKdeLvcv4Uv438C/A7Q6fneUaSRcAAAAAElFTkSuQmCC