Search for Power Button 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
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   void startRepeating(
49     PIRKeyName name);
50
51   void 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
91 signals:
92   void buttonPressed(
93     unsigned int keysetID,
94     PIRKeyName name);
95
96   void buttonReleased();
97
98 public slots:
99   void receivedExternalWarning(
100     const char *warning);
101
102   void selectPrevFavKeyset();
103   void selectNextFavKeyset();
104
105   void keysetSelectionChanged(
106     QListWidgetItem *item);
107
108 private slots:
109   void on_actionSelectKeyset_triggered();
110   void on_actionBrowse_Device_List_triggered();
111   void on_actionPreferences_triggered();
112   void on_actionAbout_triggered();
113   void on_actionDocumentation_triggered();
114
115   // Internal actions:
116   void finalCleanup();
117
118 private:
119   void populateFavorites();
120
121   Ui::MainWindow *ui;
122
123   PIRSelectKeysetForm *selectKeysetForm;
124   PIRSelectDeviceForm *selectDeviceForm;
125   PIRPreferencesForm *preferencesForm;
126   PIRDocumentationForm *documentationForm;
127   PIRAboutForm *aboutForm;
128   PIRFavoritesDialog *favoritesDialog;
129
130   PIRKeysetManager *myKeysets;
131   PIRPanelManager *myPanels;
132
133   unsigned int currentKeyset;
134
135   PIRModprobe modprobeObj;
136 };
137
138
139 #endif // MAINWINDOW_H