Check for device state on update.
[yandex-traffic] / mainwidget.hpp
index 4e29b66..00df461 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <QtGui>
 
+#include "traffic.hpp"
 #include "settings.hpp"
 #include "regions.hpp"
 #include "light.hpp"
@@ -12,28 +13,34 @@ class MainWidget : public QWidget
 {
     Q_OBJECT
 private:
-    RegionsTable _regions;
-    Settings _settings;
+    Traffic* _traffic;
+    RegionsTable* _regions;
+    Settings* _settings;
 
     // Widgets
-    TrafficLight *_light;
-    QLabel *_label;
+    TrafficLight* _light;
+    QLabel* _label;
+
+    // Other stuff
+    QTimer *_timer;
 
 public:
     MainWidget ();
-    QSize sizeHint () const;
+    virtual ~MainWidget ();
+
+public slots:
+    void settingsDialog ();
+    void updateData ();
 
 protected:
-    void paintEvent(QPaintEvent *event)
-    {
-        QPainter p(this);
-        p.setBrush(QColor(0, 0, 0, 128));
-        p.setPen(Qt::NoPen);
-        p.drawRoundedRect(rect(), 10, 10);
-        p.end();
-
-        QWidget::paintEvent(event);
-    }
+    void paintEvent (QPaintEvent *event);
+    void mousePressEvent (QMouseEvent *event);
+
+    void updateSize ();
+    void applySettings ();
+
+protected slots:
+    void trafficUpdated ();
 };
 
 #endif /* __MAINWIDGET_H__ */