From d78260124b2bded856e35f1e9196debb9dd8d237 Mon Sep 17 00:00:00 2001 From: Max Lapan Date: Mon, 8 Mar 2010 20:11:25 +0300 Subject: [PATCH] Traffic information classes. Mostly stubs. --- tests/tests.pro | 2 +- tests/traffic/main.cpp | 12 +++++++++ tests/traffic/mainwindow.hpp | 31 ++++++++++++++++++++++++ tests/traffic/traffic.pro | 6 +++++ traffic.cpp | 17 +++++++++++++ traffic.hpp | 55 ++++++++++++++++++++++++++++++++++++++++++ yandex-traffic-core.pri | 4 +-- 7 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 tests/traffic/main.cpp create mode 100644 tests/traffic/mainwindow.hpp create mode 100644 tests/traffic/traffic.pro create mode 100644 traffic.cpp create mode 100644 traffic.hpp diff --git a/tests/tests.pro b/tests/tests.pro index cfcadce..8fdd3e6 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = regions +SUBDIRS = regions traffic diff --git a/tests/traffic/main.cpp b/tests/traffic/main.cpp new file mode 100644 index 0000000..6329ff9 --- /dev/null +++ b/tests/traffic/main.cpp @@ -0,0 +1,12 @@ +#include +#include "mainwindow.hpp" + +int main(int argc, char *argv[]) +{ + QApplication app (argc, argv); + MainWindow w; + + w.show (); + + return app.exec (); +} diff --git a/tests/traffic/mainwindow.hpp b/tests/traffic/mainwindow.hpp new file mode 100644 index 0000000..9568a02 --- /dev/null +++ b/tests/traffic/mainwindow.hpp @@ -0,0 +1,31 @@ +#ifndef __MAINWINDOW_H__ +#define __MAINWINDOW_H__ + +#include +#include + + +class MainWindow : public QPushButton +{ + Q_OBJECT + +private: + Traffic _traffic; + +protected slots: + void fetchTraffic () + { + printf ("Clicked\n"); + } + +public: + MainWindow () + : QPushButton () + { + connect (this, SIGNAL (clicked ()), this, SLOT (fetchTraffic ())); + setText ("Push me"); + } +}; + + +#endif // __MAINWINDOW_H__ diff --git a/tests/traffic/traffic.pro b/tests/traffic/traffic.pro new file mode 100644 index 0000000..a1aa5f0 --- /dev/null +++ b/tests/traffic/traffic.pro @@ -0,0 +1,6 @@ +TEMPLATE = app + +HEADERS += mainwindow.hpp +SOURCES += main.cpp + +include (../../yandex-traffic-core.pri) diff --git a/traffic.cpp b/traffic.cpp new file mode 100644 index 0000000..2abfeed --- /dev/null +++ b/traffic.cpp @@ -0,0 +1,17 @@ +#include +#include "traffic.hpp" + + +TrafficInfo::TrafficInfo () +{ +} + + +ExtendedTrafficInfo::ExtendedTrafficInfo () +{ +} + + +Traffic::Traffic () +{ +} diff --git a/traffic.hpp b/traffic.hpp new file mode 100644 index 0000000..5671b9e --- /dev/null +++ b/traffic.hpp @@ -0,0 +1,55 @@ +#ifndef __TRAFFIC_H__ +#define __TRAFFIC_H__ + +#include + + +// Base data of traffic information +class TrafficInfo +{ +private: + float _len1, _len2, _len; + QDateTime _ts; + QString _isotime; + QString _localtime; + +public: + TrafficInfo (); +}; + + +class ExtendedTrafficInfo : public TrafficInfo +{ +public: + enum light_color { + Red, + Yellow, + Green + }; + +private: + float _level_raw; + quint8 _level; + light_color _color; + quint8 _tend; + QString _hint; + +public: + ExtendedTrafficInfo (); +}; + + +class Traffic +{ +private: + QDateTime _ts; + + QMap _info; + QMap _ext_info; + +public: + Traffic (); +}; + + +#endif // __TRAFFIC_H__ diff --git a/yandex-traffic-core.pri b/yandex-traffic-core.pri index 0ff6630..4e6ebec 100644 --- a/yandex-traffic-core.pri +++ b/yandex-traffic-core.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/regions.hpp $$PWD/settings.hpp -SOURCES += $$PWD/regions.cpp $$PWD/settings.cpp +HEADERS += $$PWD/regions.hpp $$PWD/settings.hpp $$PWD/traffic.hpp +SOURCES += $$PWD/regions.cpp $$PWD/settings.cpp $$PWD/traffic.cpp INCLUDEPATH += $$PWD \ No newline at end of file -- 1.7.9.5