Advanced Settings Panel
[pierogi] / mainwindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3
4 #include <QtGui/QMainWindow>
5
6 #include "pirkeynames.h"
7 #include "pirpanelnames.h"
8 #include "pirmodprobe.h"
9
10 class QListWidget;
11 class QListWidgetItem;
12 class QDialog;
13 class QKeyEvent;
14
15 //class PIRTabWidget;
16
17 class PIRSelectKeysetForm;
18 class PIRSelectDeviceForm;
19 class PIRPreferencesForm;
20 class PIRDocumentationForm;
21 class PIRAboutForm;
22 class PIRFavoritesDialog;
23 class PIRKeysetWidgetItem;
24 class PIRMacroPack;
25
26 class PIRKeysetManager;
27 class PIRPanelManager;
28 class PIRMacroManager;
29
30 namespace Ui {
31     class MainWindow;
32 }
33
34 class MainWindow : public QMainWindow
35 {
36   Q_OBJECT
37
38 public:
39   enum ScreenOrientation {
40     ScreenOrientationLockPortrait,
41     ScreenOrientationLockLandscape,
42     ScreenOrientationAuto
43   };
44
45   explicit MainWindow(QWidget *parent = 0);
46   virtual ~MainWindow();
47
48   // Note that this will only have an effect on Symbian and Fremantle.
49   void setOrientation(ScreenOrientation orientation);
50
51   void showExpanded();
52
53   bool startRepeating(
54     PIRKeyName name);
55
56   bool startRepeating(
57     PIRKeyName name,
58     unsigned int keysetID);
59
60   void stopRepeating();
61
62   // Favorites panel actions:
63   void addToFavorites(
64     PIRKeysetWidgetItem *kwi);
65
66   void removeFromFavorites(
67     unsigned int keysetID);
68
69   void enableButtons();
70
71   // Preferences actions:
72   void useMainPanel();
73   void useAltMainPanel();
74
75   QString getCurrentMake();
76   QString getCurrentName();
77   QString getCurrentFullName();
78
79   QString getKeysetMake(
80     unsigned int id);
81
82   QString getKeysetName(
83     unsigned int id);
84
85   QString getFullKeysetName(
86     unsigned int id);
87
88   unsigned int getCurrentKeyset()
89   {
90     return currentKeyset;
91   }
92
93   bool findKeysetID(
94     QString make,
95     QString name,
96     unsigned int &id);
97
98   void insertCornerButtons();
99   void disableUpdates();
100   void enableUpdates();
101   void clearTabs();
102   void addTab(
103     QWidget *page,
104     QString label);
105   void setupTabs(PIRTabBarName name);
106
107   bool selectNextKeyset();
108   bool selectPrevKeyset();
109   bool selectFirstKeyset();
110   void openCurrentKeysetDialog();
111
112   void updateKeysetSelection(
113     unsigned int targetID);
114
115   PIRMacroPack *getUserPack();
116   PIRMacroPack *getMultitapPack();
117
118   bool hasMacroButton(
119     unsigned int buttonID);
120
121   QString getMacroButtonText(
122     unsigned int buttonID);
123
124   void executeMacroButton(
125     unsigned int buttonID);
126
127   void updateUserButtons(); // Should this be a slot?
128
129   void storeMacros();
130
131   void setMacroKbdFocus(
132     int index);
133
134   void setMacroBtnFocus(
135     int index);
136
137   void switchToTab(
138     int tabNumber);
139
140   void handleKeypress(
141     char key);
142
143 //  void handleKeyRelease(
144 //    char Key);
145
146   void gotoPreviousTabs();
147
148   void gotoNextTabs();
149
150 signals:
151   void buttonPressed(
152     unsigned int keysetID,
153     PIRKeyName name);
154
155   void buttonReleased();
156
157 public slots:
158   void receivedExternalWarning(
159     const char *warning);
160
161   void selectPrevFavKeyset();
162   void selectNextFavKeyset();
163
164   void keysetSelectionChanged(
165     QListWidgetItem *item);
166
167 private slots:
168   void on_actionSelectKeyset_triggered();
169   void on_actionBrowse_Device_List_triggered();
170   void on_actionPreferences_triggered();
171   void on_actionAbout_triggered();
172   void on_actionDocumentation_triggered();
173
174   // Internal actions:
175   void finalCleanup();
176
177 private:
178 //  void keyPressEvent(
179 //    QKeyEvent *event);
180
181 //  void keyReleaseEvent(
182 //    QKeyEvent *event);
183
184   void populateFavorites();
185
186   Ui::MainWindow *ui;
187
188 //  PIRTabWidget *myTabWidget;
189
190   PIRSelectKeysetForm *selectKeysetForm;
191   PIRSelectDeviceForm *selectDeviceForm;
192   PIRPreferencesForm *preferencesForm;
193   PIRDocumentationForm *documentationForm;
194   PIRAboutForm *aboutForm;
195   PIRFavoritesDialog *favoritesDialog;
196
197   PIRKeysetManager *myKeysets;
198   PIRPanelManager *myPanels;
199   PIRMacroManager *myMacros;
200
201   unsigned int currentKeyset;
202
203   PIRModprobe modprobeObj;
204 };
205
206
207 #endif // MAINWINDOW_H