Class that watches for device state (locked or not).
[yandex-traffic] / tests / state / mainwindow.hpp
1 #ifndef __MAINWINDOW_H__
2 #define __MAINWINDOW_H__
3
4 #include <QtGui>
5
6 #include "devstate.hpp"
7
8 class MainWindow : public QPushButton
9 {
10     Q_OBJECT
11
12 protected slots:
13     void clicked ()
14     {
15         printf ("Clicked, request state\n");
16         DeviceState::instance ()->requestState ();
17     }
18
19     void lockChanged (bool state)
20     {
21         printf (state ? "device locked\n" : "device unlocked\n");
22     }
23
24 public:
25     MainWindow ()
26         : QPushButton ()
27     {
28         setText ("Push me to get state");
29         connect (this, SIGNAL (clicked ()), this, SLOT (clicked ()));
30         connect (DeviceState::instance (), SIGNAL (lockChanged (bool)), this, SLOT (lockChanged (bool)));
31     }
32 };
33
34 #endif // __MAINWINDOW_H__