Bugfixes and Keysets
[pierogi] / macros / pirmacrocommanditem.h
1 #ifndef PIRMACROCOMMANDITEM_H
2 #define PIRMACROCOMMANDITEM_H
3
4 #include <QListWidgetItem>
5 #include <QObject>
6 #include <QString>
7
8 #include "pirkeynames.h"
9
10 class QTimer;
11 class MainWindow;
12
13
14 class PIRMacroCommandItem: public QObject, public QListWidgetItem
15 {
16   Q_OBJECT
17
18 public:
19   PIRMacroCommandItem(
20     QString displayName);
21
22   virtual void executeCommand() = 0;
23
24 signals:
25   void commandCompleted();
26 };
27
28
29 class PIRKeyCommandItem: public PIRMacroCommandItem
30 {
31   Q_OBJECT
32
33 public:
34   PIRKeyCommandItem(
35     PIRKeyName keyToExecute,
36     MainWindow *mw);
37
38   virtual void executeCommand();
39
40 private slots:
41   void startRunningCommand();
42   void stopRunningCommand();
43
44 private:
45   PIRKeyName key;
46   QTimer *advanceTimer;
47   MainWindow *mainWindow;
48 };
49
50
51 class PIRKeysetCommandItem: public PIRMacroCommandItem
52 {
53   Q_OBJECT
54
55 public:
56   PIRKeysetCommandItem(
57     QString displayName,
58     unsigned int keysetToChoose,
59     MainWindow *mw);
60
61   virtual void executeCommand();
62
63 private:
64   unsigned int id;
65   MainWindow *mainWindow;
66 };
67
68
69 class PIRPauseCommandItem: public PIRMacroCommandItem
70 {
71   Q_OBJECT
72
73 public:
74   PIRPauseCommandItem(
75     QString displayName,
76     unsigned int timeToWait);
77
78   virtual void executeCommand();
79
80 private slots:
81   void finishedWaiting();
82
83 private:
84   unsigned int timeInSeconds;
85   QTimer *advanceTimer;
86 };
87
88
89 #endif // PIRMACROCOMMANDITEM_H