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