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