Bugfixes and Keysets
[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
14 class PIRSelectKeysetForm;
15 class PIRSelectDeviceForm;
16 class PIRPreferencesForm;
17 class PIRDocumentationForm;
18 class PIRAboutForm;
19 class PIRFavoritesDialog;
20 class PIRKeysetWidgetItem;
21
22 class PIRKeysetManager;
23 class PIRPanelManager;
24
25 namespace Ui {
26     class MainWindow;
27 }
28
29 class MainWindow : public QMainWindow
30 {
31   Q_OBJECT
32
33 public:
34   enum ScreenOrientation {
35     ScreenOrientationLockPortrait,
36     ScreenOrientationLockLandscape,
37     ScreenOrientationAuto
38   };
39
40   explicit MainWindow(QWidget *parent = 0);
41   virtual ~MainWindow();
42
43   // Note that this will only have an effect on Symbian and Fremantle.
44   void setOrientation(ScreenOrientation orientation);
45
46   void showExpanded();
47
48   bool startRepeating(
49     PIRKeyName name);
50
51   bool startRepeating(
52     PIRKeyName name,
53     unsigned int keysetID);
54
55   void stopRepeating();
56
57   // Favorites panel actions:
58   void addToFavorites(
59     PIRKeysetWidgetItem *kwi);
60
61   void removeFromFavorites(
62     unsigned int keysetID);
63
64   void enableButtons();
65
66   // Preferences actions:
67   void useMainPanel();
68   void useAltMainPanel();
69
70   QString getCurrentMake();
71   QString getCurrentName();
72   QString getCurrentFullName();
73
74   unsigned int getCurrentKeyset()
75   {
76     return currentKeyset;
77   }
78
79   void insertCornerButtons();
80   void disableUpdates();
81   void enableUpdates();
82   void clearTabs();
83   void addTab(
84     QWidget *page,
85     QString label);
86   void setupTabs(PIRTabBarName name);
87
88   bool selectNextKeyset();
89   bool selectPrevKeyset();
90   bool selectFirstKeyset();
91   void openCurrentKeysetDialog();
92
93   void updateKeysetSelection(
94     unsigned int targetID);
95
96 signals:
97   void buttonPressed(
98     unsigned int keysetID,
99     PIRKeyName name);
100
101   void buttonReleased();
102
103 public slots:
104   void receivedExternalWarning(
105     const char *warning);
106
107   void selectPrevFavKeyset();
108   void selectNextFavKeyset();
109
110   void keysetSelectionChanged(
111     QListWidgetItem *item);
112
113 private slots:
114   void on_actionSelectKeyset_triggered();
115   void on_actionBrowse_Device_List_triggered();
116   void on_actionPreferences_triggered();
117   void on_actionAbout_triggered();
118   void on_actionDocumentation_triggered();
119
120   // Internal actions:
121   void finalCleanup();
122
123 private:
124   void populateFavorites();
125
126   Ui::MainWindow *ui;
127
128   PIRSelectKeysetForm *selectKeysetForm;
129   PIRSelectDeviceForm *selectDeviceForm;
130   PIRPreferencesForm *preferencesForm;
131   PIRDocumentationForm *documentationForm;
132   PIRAboutForm *aboutForm;
133   PIRFavoritesDialog *favoritesDialog;
134
135   PIRKeysetManager *myKeysets;
136   PIRPanelManager *myPanels;
137
138   unsigned int currentKeyset;
139
140   PIRModprobe modprobeObj;
141 };
142
143
144 #endif // MAINWINDOW_H