#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;
}
}
+PIRKeyCommandItem::~PIRKeyCommandItem()
+{
+ if (advanceTimer) delete advanceTimer;
+}
+
+
void PIRKeyCommandItem::executeCommand()
{
// First, make sure no other macro is running:
}
+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,
}
+PIRKeysetCommandItem::PIRKeysetCommandItem(
+ unsigned int keysetToChoose,
+ MainWindow *mw)
+ : PIRMacroCommandItem(),
+ id(keysetToChoose),
+ mainWindow(mw)
+{
+ setName(mainWindow->getFullKeysetName(keysetToChoose));
+}
+
+
void PIRKeysetCommandItem::executeCommand()
{
mainWindow->updateKeysetSelection(id);
}
+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;
}
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): ";
+}