ef6f19ab82a84ba5dc053dd928a166fce3d58bc4
[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
73   unsigned int getCurrentKeyset()
74   {
75     return currentKeyset;
76   }
77
78   void insertCornerButtons();
79   void disableUpdates();
80   void enableUpdates();
81   void clearTabs();
82   void addTab(
83     QWidget *page,
84     QString label);
85   void setupTabs(PIRTabBarName name);
86
87 signals:
88   void buttonPressed(
89     unsigned int keysetID,
90     PIRKeyName name);
91
92   void buttonReleased();
93
94 public slots:
95   void receivedExternalWarning(
96     const char *warning);
97
98   void selectPrevFavKeyset();
99   void selectNextFavKeyset();
100
101   void keysetSelectionChanged(
102     QListWidgetItem *item);
103
104 private slots:
105   void on_actionSelectKeyset_triggered();
106   void on_actionSelect_Device_By_Name_triggered();
107   void on_actionPreferences_triggered();
108   void on_actionAbout_triggered();
109   void on_actionDocumentation_triggered();
110
111   // Internal actions:
112   void finalCleanup();
113
114 private:
115   void populateFavorites();
116
117   Ui::MainWindow *ui;
118
119   PIRSelectKeysetForm *selectKeysetForm;
120   PIRSelectDeviceForm *selectDeviceForm;
121   PIRPreferencesForm *preferencesForm;
122   PIRDocumentationForm *documentationForm;
123   PIRAboutForm *aboutForm;
124   PIRFavoritesDialog *favoritesDialog;
125
126   PIRKeysetManager *myKeysets;
127   PIRPanelManager *myPanels;
128
129   unsigned int currentKeyset;
130
131   PIRModprobe modprobeObj;
132 };
133
134
135 #endif // MAINWINDOW_H