X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=macros%2Fpirmacrocommanditem.cpp;fp=macros%2Fpirmacrocommanditem.cpp;h=f78deb31ca4439dd2532893096e2949e5d10d1c9;hb=afbbd0cd07a3f63c95969633bae56fcdd58c71b8;hp=755b5a63ec206bcb1bbbed1a7e74ec0504cdb13b;hpb=6331b1b21bde2a80e6a0895d9cce865c8b558bc5;p=pierogi diff --git a/macros/pirmacrocommanditem.cpp b/macros/pirmacrocommanditem.cpp index 755b5a6..f78deb3 100644 --- a/macros/pirmacrocommanditem.cpp +++ b/macros/pirmacrocommanditem.cpp @@ -3,15 +3,37 @@ #include "mainwindow.h" #include "pirkeynames.h" +#include #include +#include + 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): "; +}