Widget wich displays light.
[yandex-traffic] / mainwidget.hpp
index eac62a9..4e29b66 100644 (file)
@@ -3,35 +3,25 @@
 
 #include <QtGui>
 
-#include <settings.hpp>
-#include <regions.hpp>
+#include "settings.hpp"
+#include "regions.hpp"
+#include "light.hpp"
 
 
-class MainWidget : public QLabel
+class MainWidget : public QWidget
 {
     Q_OBJECT
 private:
     RegionsTable _regions;
     Settings _settings;
 
-public:
-    MainWidget ()
-        : QLabel ()
-    {
-        const RegionInfo *ri;
-
-        setAlignment(Qt::AlignCenter);
-        setAttribute(Qt::WA_TranslucentBackground);
+    // Widgets
+    TrafficLight *_light;
+    QLabel *_label;
 
-        ri = _regions.lookup (_settings.regions ()[0]);
-
-        setText (_settings.regions ().join (", ") + ", " + QString (ri ? ri->name () : ""));
-    }
-
-    QSize sizeHint() const
-    {
-        return 2 * QLabel::sizeHint();
-    }
+public:
+    MainWidget ();
+    QSize sizeHint () const;
 
 protected:
     void paintEvent(QPaintEvent *event)
@@ -39,10 +29,10 @@ protected:
         QPainter p(this);
         p.setBrush(QColor(0, 0, 0, 128));
         p.setPen(Qt::NoPen);
-        p.drawRoundedRect(rect(), 25, 25);
+        p.drawRoundedRect(rect(), 10, 10);
         p.end();
 
-        QLabel::paintEvent(event);
+        QWidget::paintEvent(event);
     }
 };