-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.h
44 lines (36 loc) · 927 Bytes
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QtWebSockets/QWebSocket>
#include <QNetworkAccessManager>
#include <QTimer>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void onConnected();
void onDisconnect();
void onError(QAbstractSocket::SocketError socketError);
void onTextMessageReceived(QString message);
void httpFinished(QNetworkReply*);
void sendPing();
void openConnection();
void onNotifyClick();
private:
enum states {FREE, OCCUPIED, WAITING, OFFLINE};
states state;
void setState(states s);
QSystemTrayIcon *trayIcon;
QAction *notifyAction;
QWebSocket webSocket;
QNetworkAccessManager netManager;
QTimer pingTimer, reconnectTimer;
};
#endif // MAINWINDOW_H