#include <QtGui>
-#include <settings.hpp>
-#include <regions.hpp>
+#include "traffic.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;
+ Traffic* _traffic;
+ RegionsTable* _regions;
+ Settings* _settings;
+
+ // Widgets
+ TrafficLight* _light;
+ QLabel* _label;
public:
- MainWidget ()
- : QLabel ()
- {
- const RegionInfo *ri;
+ MainWidget ();
+ virtual ~MainWidget ();
- setAlignment(Qt::AlignCenter);
-#ifdef Q_WS_MAEMO_5
- setAttribute(Qt::WA_TranslucentBackground);
-#endif
- ri = _regions.lookup (_settings.regions ()[0]);
+public slots:
+ void settingsDialog ();
- setText (_settings.regions ().join (", ") + ", " + QString (ri ? ri->name () : ""));
- }
+protected:
+ void paintEvent (QPaintEvent *event);
+ void timerEvent (QTimerEvent *event);
- QSize sizeHint() const
- {
- return QLabel::sizeHint() + QSize (20, 0);
- }
+ void updateData ();
+ void updateSize ();
-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();
-
- QLabel::paintEvent(event);
- }
+protected slots:
+ void trafficUpdated ();
};
#endif /* __MAINWIDGET_H__ */