ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mainwindow.h
Go to the documentation of this file.
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3 
4 #include <QCloseEvent>
5 #include <QMainWindow>
6 #include <QMenu>
7 #include <QSystemTrayIcon>
8 #include <QTimer>
9 #include "kbwidget.h"
10 #include "settingswidget.h"
11 
12 #ifdef USE_LIBAPPINDICATOR
13 #define signals_BACKUP signals
14 #undef signals
15 extern "C" {
16  #include <libappindicator/app-indicator.h>
17  #include <gtk/gtk.h>
18 }
19 #define signals signals_BACKUP
20 #undef signals_BACKUP
21 #endif // USE_LIBAPPINDICATOR
22 
23 namespace Ui {
24 class MainWindow;
25 }
26 
27 class MainWindow : public QMainWindow
28 {
29  Q_OBJECT
30 
31 public:
32  explicit MainWindow(QWidget *parent = 0);
33  ~MainWindow();
34 
36 
37  void toggleTrayIcon(bool visible);
38 
39 private:
41  QList<KbWidget*> kbWidgets;
42 
43  QAction* restoreAction;
44  QAction* closeAction;
45 
46 #ifdef USE_LIBAPPINDICATOR
47  bool unityDesktop;
48  AppIndicator* indicator;
49  GtkWidget* indicatorMenu;
50  GtkWidget* indicatorMenuQuitItem;
51  GtkWidget* indicatorMenuRestoreItem;
52 #endif // USE_LIBAPPINDICATOR
53  QMenu* trayIconMenu;
54  QSystemTrayIcon* trayIcon;
55 
56  void closeEvent(QCloseEvent *event);
57 
58 public slots:
59  void showWindow();
60  void stateChange(Qt::ApplicationState state);
61  void quitApp();
62 
63 private slots:
64  void addDevice(Kb* device);
65  void removeDevice(Kb* device);
66  void updateVersion();
67  void checkFwUpdates();
68 
69  void timerTick();
70  void iconClicked(QSystemTrayIcon::ActivationReason reason);
71  void cleanup();
72  void showFwUpdateNotification(QWidget* widget, float version);
73 
74 private:
76 };
77 
78 #endif // MAINWINDOW_H
void stateChange(Qt::ApplicationState state)
Definition: mainwindow.cpp:314
Ui::MainWindow * ui
Definition: mainwindow.h:75
void showFwUpdateNotification(QWidget *widget, float version)
Definition: mainwindow.cpp:230
void cleanup()
Definition: mainwindow.cpp:333
void checkFwUpdates()
Definition: mainwindow.cpp:210
void quitApp()
Definition: mainwindow.cpp:329
void showWindow()
Definition: mainwindow.cpp:308
void closeEvent(QCloseEvent *event)
Definition: mainwindow.cpp:247
void toggleTrayIcon(bool visible)
Definition: mainwindow.cpp:150
void removeDevice(Kb *device)
Definition: mainwindow.cpp:177
QMenu * trayIconMenu
Definition: mainwindow.h:53
QAction * restoreAction
Definition: mainwindow.h:43
void updateVersion()
Definition: mainwindow.cpp:191
MainWindow(QWidget *parent=0)
Definition: mainwindow.cpp:49
Definition: kb.h:11
QSystemTrayIcon * trayIcon
Definition: mainwindow.h:54
static MainWindow * mainWindow
Definition: mainwindow.h:35
void iconClicked(QSystemTrayIcon::ActivationReason reason)
Definition: mainwindow.cpp:295
QAction * closeAction
Definition: mainwindow.h:44
SettingsWidget * settingsWidget
Definition: mainwindow.h:40
void timerTick()
Definition: mainwindow.cpp:261
QList< KbWidget * > kbWidgets
Definition: mainwindow.h:41
void addDevice(Kb *device)
Definition: mainwindow.cpp:159