Added address resolution, and moved everything up one directory.
authorMax Waterman <davidmaxwaterman+maemogit@fastmail.co.uk>
Sun, 28 Feb 2010 10:33:24 +0000 (12:33 +0200)
committerMax Waterman <davidmaxwaterman+maemogit@fastmail.co.uk>
Sun, 28 Feb 2010 12:52:24 +0000 (14:52 +0200)
Added test for Location class.

36 files changed:
zouba/.gitignore [new file with mode: 0644]
zouba/location.cpp [new file with mode: 0644]
zouba/location.h [new file with mode: 0644]
zouba/location_p.cpp [new file with mode: 0644]
zouba/location_p.h [new file with mode: 0644]
zouba/main.cpp [new file with mode: 0644]
zouba/output.xml [new file with mode: 0644]
zouba/qt/location.h [deleted file]
zouba/qt/main.cpp [deleted file]
zouba/qt/output.xml [deleted file]
zouba/qt/qt.pro [deleted file]
zouba/qt/route.cpp [deleted file]
zouba/qt/route.h [deleted file]
zouba/qt/route_p.cpp [deleted file]
zouba/qt/route_p.h [deleted file]
zouba/qt/routedata.h [deleted file]
zouba/qt/tests/ut_route/ut_route.cpp [deleted file]
zouba/qt/tests/ut_route/ut_route.h [deleted file]
zouba/qt/tests/ut_route/ut_route.pro [deleted file]
zouba/qt/zouba.ui [deleted file]
zouba/route.cpp [new file with mode: 0644]
zouba/route.h [new file with mode: 0644]
zouba/route_p.cpp [new file with mode: 0644]
zouba/route_p.h [new file with mode: 0644]
zouba/routedata.h [new file with mode: 0644]
zouba/tests/ut_location/ut_location.cpp [new file with mode: 0644]
zouba/tests/ut_location/ut_location.h [new file with mode: 0644]
zouba/tests/ut_location/ut_location.pro [new file with mode: 0644]
zouba/tests/ut_route/ut_route.cpp [new file with mode: 0644]
zouba/tests/ut_route/ut_route.h [new file with mode: 0644]
zouba/tests/ut_route/ut_route.pro [new file with mode: 0644]
zouba/uicontroller.cpp [new file with mode: 0644]
zouba/uicontroller.h [new file with mode: 0644]
zouba/ytv.h [new file with mode: 0644]
zouba/zouba.pro [new file with mode: 0644]
zouba/zouba.ui [new file with mode: 0644]

diff --git a/zouba/.gitignore b/zouba/.gitignore
new file mode 100644 (file)
index 0000000..57c2b15
--- /dev/null
@@ -0,0 +1,7 @@
+Makefile
+moc_location.cpp
+moc_location_p.cpp
+moc_route.cpp
+moc_route_p.cpp
+moc_uicontroller.cpp
+ui_zouba.h
diff --git a/zouba/location.cpp b/zouba/location.cpp
new file mode 100644 (file)
index 0000000..6ebab31
--- /dev/null
@@ -0,0 +1,95 @@
+#include "location.h"
+
+#include "location_p.h"
+
+#include "ytv.h"
+
+#include <QString>
+#include <QObject>
+#include <QNetworkAccessManager>
+#include <QUrl>
+#include <QNetworkRequest>
+#include <QNetworkReply>
+#include <QXmlStreamReader>
+#include <QDebug>
+#include <QXmlStreamAttributes>
+#include <QStringRef>
+
+Location::Location( QString x, QString y ) :
+  q( new LocationPrivate( x, y ) ),
+  manager( new QNetworkAccessManager(this) )
+{
+  connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
+}
+
+Location::Location( const Location &from ) :
+  QObject( 0 ),
+  q( new LocationPrivate() ),
+  manager( new QNetworkAccessManager(this) )
+{
+  q->setX( from.x() );
+  q->setY( from.y() );
+  q->setValid( from.isValid() );
+  connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
+}
+
+Location::Location() :
+  q( new LocationPrivate() ),
+  manager( new QNetworkAccessManager(this) )
+{
+  connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
+}
+
+Location::~Location()
+{
+  delete q;
+  q=0;
+  delete manager;
+  manager=0;
+}
+
+Location &Location::operator=( const Location &from )
+{
+  q->setX( from.x() );
+  q->setY( from.y() );
+  q->setValid( from.isValid() );
+  manager = new QNetworkAccessManager(this);
+  connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
+  
+  return *this;
+}
+
+void Location::resolveAddress( QString address )
+{
+  QUrl fullUrl( ytv );
+
+  fullUrl.addEncodedQueryItem( "key", address.toAscii() );
+  fullUrl.addQueryItem( "user", username );
+  fullUrl.addQueryItem( "pass", password );
+
+  manager->get( QNetworkRequest( fullUrl ) );
+}
+
+void Location::replyFinished( QNetworkReply * reply )
+{
+  q->parseReply( reply->readAll() );
+
+  if ( q->isValid() ) {
+    emit( becomeValid() );
+  }
+}
+
+QString Location::x() const
+{
+  return q->x();
+}
+
+QString Location::y() const
+{
+  return q->y();
+}
+
+bool Location::isValid() const
+{
+  return q->isValid();
+}
diff --git a/zouba/location.h b/zouba/location.h
new file mode 100644 (file)
index 0000000..f04ad98
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef LOCATION_H
+#define LOCATION_H
+
+#include "location_p.h"
+
+#include <QString>
+#include <QObject>
+#include <QNetworkAccessManager>
+#include <QNetworkReply>
+
+class Location : public QObject
+{
+    Q_OBJECT
+
+public:
+  Location( QString x, QString y );
+  Location( const Location &from );
+  Location &operator=( const Location &from );
+  Location();
+
+  ~Location();
+
+  void resolveAddress( QString address );
+
+  QString x() const;
+
+  QString y() const;
+
+  bool isValid() const;
+
+Q_SIGNALS:
+  void becomeValid();
+
+private Q_SLOTS:
+  void replyFinished( QNetworkReply * reply );
+
+private:
+  LocationPrivate *q;
+  QNetworkAccessManager *manager;
+};
+
+#endif // LOCATION_H
diff --git a/zouba/location_p.cpp b/zouba/location_p.cpp
new file mode 100644 (file)
index 0000000..318630d
--- /dev/null
@@ -0,0 +1,74 @@
+#include "location_p.h"
+
+#include <QXmlStreamReader>
+#include <QByteArray>
+#include <QDebug>
+
+LocationPrivate::LocationPrivate( QString x, QString y ) :
+  m_x(x),
+  m_y(y),
+  m_valid(true)
+{
+}
+
+LocationPrivate::LocationPrivate() :
+  m_x(0),
+  m_y(0),
+  m_valid(false)
+{
+}
+
+void LocationPrivate::parseReply( const QByteArray &reply )
+{
+  QXmlStreamReader xml( reply );
+
+  while ( !xml.atEnd() ) {
+    xml.readNext();
+    if ( xml.isStartElement() && xml.name() == "LOC" ) {
+      QXmlStreamAttributes attributes( xml.attributes() );
+      QStringRef xAttribute( attributes.value("x") );
+      QStringRef yAttribute( attributes.value("y") );
+      QString newX( xAttribute.toString() );
+      QString newY( yAttribute.toString() );
+
+      m_x = newX;
+      m_y = newY;
+    }
+  }
+
+  if ( xml.hasError() ) {
+    qDebug() << "xml error";
+  } else {
+    m_valid = true;
+  }
+}
+
+void LocationPrivate::setX( QString x )
+{
+  m_x = x;
+}
+
+QString LocationPrivate::x() const
+{
+  return m_x;
+}
+
+void LocationPrivate::setY( QString y )
+{
+  m_y = y;
+}
+
+QString LocationPrivate::y() const
+{
+  return m_y;
+}
+
+void LocationPrivate::setValid( bool valid )
+{
+  m_valid = valid;
+}
+
+bool LocationPrivate::isValid() const
+{
+  return m_valid;
+}
diff --git a/zouba/location_p.h b/zouba/location_p.h
new file mode 100644 (file)
index 0000000..c8d108d
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef LOCATION_P_H
+#define LOCATION_P_H
+
+#include <QObject>
+#include <QString>
+#include <QByteArray>
+
+class LocationPrivate : public QObject
+{
+    Q_OBJECT
+
+public:
+  LocationPrivate( QString x, QString y );
+
+  LocationPrivate();
+
+  void setX( QString x );
+  QString x() const;
+
+  void setY( QString y );
+  QString y() const;
+
+  void setValid( bool valid );
+  bool isValid() const;
+
+  void parseReply( const QByteArray &reply );
+
+private:
+  QString m_x;
+  QString m_y;
+  bool    m_valid;
+};
+
+#endif // LOCATION_P_H
+
diff --git a/zouba/main.cpp b/zouba/main.cpp
new file mode 100644 (file)
index 0000000..65190f9
--- /dev/null
@@ -0,0 +1,50 @@
+#include "routedata.h"
+#include "route.h"
+#include "ui_zouba.h"
+#include "uicontroller.h"
+#include "location.h"
+
+#include <QDebug>
+#include <QObject>
+
+namespace {
+  Location home( "2549183", "6672570" );
+  Location work( "2551042", "6672829" );
+  QString homeKey( "taivaanvuohentie%207%2Chelsinki" );
+  QString workKey( "it%E4merenkatu%2011%2Chelsinki" );
+}
+
+int main(int argc, char *argv[] )
+{
+  QApplication app(argc, argv);
+  QMainWindow *widget = new QMainWindow;
+  Ui::MainWindow ui;
+  ui.setupUi(widget);
+
+  UiController *uiController = new UiController( &ui );
+
+  Route *route = new Route();
+
+  QObject::connect(
+      route, SIGNAL( routeReady( RouteData ) ),
+      uiController, SLOT( displayRoute( RouteData ) )
+      );
+
+  Location *from = new Location();
+  Location *to   = new Location();
+
+  QObject::connect(
+      from, SIGNAL( becomeValid() ),
+      route, SLOT( setFromLocation() )
+      );
+  QObject::connect(
+      to, SIGNAL( becomeValid() ),
+      route, SLOT( setToLocation() )
+      );
+
+  from->resolveAddress( homeKey );
+  to->resolveAddress( workKey );
+
+  widget->show();
+  return app.exec();
+}
diff --git a/zouba/output.xml b/zouba/output.xml
new file mode 100644 (file)
index 0000000..1557ded
--- /dev/null
@@ -0,0 +1,330 @@
+"<?xml version="1.0" encoding="ISO-8859-1" ?>
+<MTRXML version="1.0">
+       <ROUTE from="start" to="dest">
+               <LENGTH time="14.411" dist="2510.063"/>
+               <POINT uid="start" x="2551042.0" y="6672829.0">
+                       <ARRIVAL date="20100207" time="1815"/>
+                       <DEPARTURE date="20100207" time="1815"/>
+               </POINT>
+               <WALK>
+                       <LENGTH time="4.475" dist="357.069"/>
+                       <POINT uid="start" x="2551042.0" y="6672829.0">
+                               <ARRIVAL date="20100207" time="1815"/>
+                               <DEPARTURE date="20100207" time="1815"/>
+                       </POINT>
+                       <MAPLOC x="2551034.9" y="6672875.6" type="7">
+                               <ARRIVAL date="20100207" time="1816"/>
+                               <DEPARTURE date="20100207" time="1816"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550977.7" y="6672869.1" type="15">
+                               <ARRIVAL date="20100207" time="1817"/>
+                               <DEPARTURE date="20100207" time="1817"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550949.3" y="6672867.5" type="7">
+                               <ARRIVAL date="20100207" time="1817"/>
+                               <DEPARTURE date="20100207" time="1817"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550817.2" y="6672859.3" type="7">
+                               <ARRIVAL date="20100207" time="1819"/>
+                               <DEPARTURE date="20100207" time="1819"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550808.5" y="6672889.3" type="11">
+                               <ARRIVAL date="20100207" time="1820"/>
+                               <DEPARTURE date="20100207" time="1820"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <STOP code="6:1201129" x="2550765.0" y="6672886.0" id="745">
+                               <ARRIVAL date="20100207" time="1820"/>
+                               <DEPARTURE date="20100207" time="1820"/>
+                               <NAME lang="1" val="Länsiväylä"/>
+                               <NAME lang="2" val="Västerleden"/>
+                       </STOP>
+               </WALK>
+               <LINE id="200" code="1065A 2" type="1" mobility="3">
+                       <LENGTH time="5.000" dist="1760.931"/>
+                       <STOP code="6:1201129" x="2550765.0" y="6672886.0" id="745" ord="30">
+                               <ARRIVAL date="20100207" time="1820"/>
+                               <DEPARTURE date="20100207" time="1820"/>
+                               <NAME lang="1" val="Länsiväylä"/>
+                               <NAME lang="2" val="Västerleden"/>
+                       </STOP>
+                       <STOP code="6:1201131" x="2550385.0" y="6672760.0" id="747">
+                               <ARRIVAL date="20100207" time="1821"/>
+                               <DEPARTURE date="20100207" time="1821"/>
+                               <NAME lang="1" val="Salmisaari"/>
+                               <NAME lang="2" val="Sundholmen"/>
+                       </STOP>
+                       <STOP code="6:1310101" x="2549608.0" y="6672522.0" id="1356">
+                               <ARRIVAL date="20100207" time="1824"/>
+                               <DEPARTURE date="20100207" time="1824"/>
+                               <NAME lang="1" val="Lauttasaaren silta"/>
+                               <NAME lang="2" val="Drumsö bro"/>
+                       </STOP>
+                       <STOP code="6:1310103" x="2549247.0" y="6672446.0" id="1358" ord="33">
+                               <ARRIVAL date="20100207" time="1825"/>
+                               <DEPARTURE date="20100207" time="1825"/>
+                               <NAME lang="1" val="Koillisväylä"/>
+                               <NAME lang="2" val="Nordostpassagen"/>
+                       </STOP>
+               </LINE>
+               <WALK>
+                       <LENGTH time="4.936" dist="392.062"/>
+                       <STOP code="6:1310103" x="2549247.0" y="6672446.0" id="1358">
+                               <ARRIVAL date="20100207" time="1825"/>
+                               <DEPARTURE date="20100207" time="1825"/>
+                               <NAME lang="1" val="Koillisväylä"/>
+                               <NAME lang="2" val="Nordostpassagen"/>
+                       </STOP>
+                       <MAPLOC x="2549200.4" y="6672433.4" type="0">
+                               <ARRIVAL date="20100207" time="1825"/>
+                               <DEPARTURE date="20100207" time="1825"/>
+                               <NAME lang="1" val="Taivaanvuohenkuja"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549151.2" y="6672527.3" type="0">
+                               <ARRIVAL date="20100207" time="1827"/>
+                               <DEPARTURE date="20100207" time="1827"/>
+                               <NAME lang="1" val="Taivaanvuohentie"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549105.4" y="6672573.6" type="0">
+                               <ARRIVAL date="20100207" time="1828"/>
+                               <DEPARTURE date="20100207" time="1828"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549115.4" y="6672595.1" type="0">
+                               <ARRIVAL date="20100207" time="1828"/>
+                               <DEPARTURE date="20100207" time="1828"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549162.6" y="6672633.1" type="0">
+                               <ARRIVAL date="20100207" time="1829"/>
+                               <DEPARTURE date="20100207" time="1829"/>
+                       </MAPLOC>
+                       <POINT uid="dest" x="2549183.0" y="6672570.0">
+                               <ARRIVAL date="20100207" time="1829"/>
+                               <DEPARTURE date="20100207" time="1829"/>
+                       </POINT>
+               </WALK>
+               <POINT uid="dest" x="2549183.0" y="6672570.0">
+                       <ARRIVAL date="20100207" time="1829"/>
+                       <DEPARTURE date="20100207" time="1829"/>
+               </POINT>
+       </ROUTE>
+       <ROUTE from="start" to="dest">
+               <LENGTH time="13.411" dist="2501.497"/>
+               <POINT uid="start" x="2551042.0" y="6672829.0">
+                       <ARRIVAL date="20100207" time="1821"/>
+                       <DEPARTURE date="20100207" time="1821"/>
+               </POINT>
+               <WALK>
+                       <LENGTH time="4.475" dist="357.069"/>
+                       <POINT uid="start" x="2551042.0" y="6672829.0">
+                               <ARRIVAL date="20100207" time="1821"/>
+                               <DEPARTURE date="20100207" time="1821"/>
+                       </POINT>
+                       <MAPLOC x="2551034.9" y="6672875.6" type="7">
+                               <ARRIVAL date="20100207" time="1822"/>
+                               <DEPARTURE date="20100207" time="1822"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550977.7" y="6672869.1" type="15">
+                               <ARRIVAL date="20100207" time="1823"/>
+                               <DEPARTURE date="20100207" time="1823"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550949.3" y="6672867.5" type="7">
+                               <ARRIVAL date="20100207" time="1823"/>
+                               <DEPARTURE date="20100207" time="1823"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550817.2" y="6672859.3" type="7">
+                               <ARRIVAL date="20100207" time="1825"/>
+                               <DEPARTURE date="20100207" time="1825"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550808.5" y="6672889.3" type="11">
+                               <ARRIVAL date="20100207" time="1826"/>
+                               <DEPARTURE date="20100207" time="1826"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <STOP code="6:1201227" x="2550765.0" y="6672886.0" id="755">
+                               <ARRIVAL date="20100207" time="1826"/>
+                               <DEPARTURE date="20100207" time="1826"/>
+                               <NAME lang="1" val="Länsiväylä"/>
+                               <NAME lang="2" val="Västerleden"/>
+                       </STOP>
+               </WALK>
+               <LINE id="579" code="2102T 1" type="5" mobility="3">
+                       <LENGTH time="4.000" dist="1751.582"/>
+                       <STOP code="6:1201227" x="2550765.0" y="6672886.0" id="755" ord="3">
+                               <ARRIVAL date="20100207" time="1826"/>
+                               <DEPARTURE date="20100207" time="1826"/>
+                               <NAME lang="1" val="Länsiväylä"/>
+                               <NAME lang="2" val="Västerleden"/>
+                       </STOP>
+                       <STOP code="6:1201231" x="2550387.0" y="6672761.0" id="759">
+                               <ARRIVAL date="20100207" time="1827"/>
+                               <DEPARTURE date="20100207" time="1827"/>
+                               <NAME lang="1" val="Salmisaari"/>
+                               <NAME lang="2" val="Sundholmen"/>
+                       </STOP>
+                       <STOP code="6:1310201" x="2549630.0" y="6672524.0" id="1402">
+                               <ARRIVAL date="20100207" time="1829"/>
+                               <DEPARTURE date="20100207" time="1829"/>
+                               <NAME lang="1" val="Lauttasaaren silta"/>
+                               <NAME lang="2" val="Drumsö bro"/>
+                       </STOP>
+                       <STOP code="6:1310203" x="2549248.0" y="6672446.0" id="1404" ord="6">
+                               <ARRIVAL date="20100207" time="1830"/>
+                               <DEPARTURE date="20100207" time="1830"/>
+                               <NAME lang="1" val="Koillisväylä"/>
+                               <NAME lang="2" val="Nordostpassagen"/>
+                       </STOP>
+               </LINE>
+               <WALK>
+                       <LENGTH time="4.936" dist="392.846"/>
+                       <STOP code="6:1310203" x="2549248.0" y="6672446.0" id="1404">
+                               <ARRIVAL date="20100207" time="1830"/>
+                               <DEPARTURE date="20100207" time="1830"/>
+                               <NAME lang="1" val="Koillisväylä"/>
+                               <NAME lang="2" val="Nordostpassagen"/>
+                       </STOP>
+                       <MAPLOC x="2549200.4" y="6672433.4" type="0">
+                               <ARRIVAL date="20100207" time="1830"/>
+                               <DEPARTURE date="20100207" time="1830"/>
+                               <NAME lang="1" val="Taivaanvuohenkuja"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549151.2" y="6672527.3" type="0">
+                               <ARRIVAL date="20100207" time="1832"/>
+                               <DEPARTURE date="20100207" time="1832"/>
+                               <NAME lang="1" val="Taivaanvuohentie"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549105.4" y="6672573.6" type="0">
+                               <ARRIVAL date="20100207" time="1833"/>
+                               <DEPARTURE date="20100207" time="1833"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549115.4" y="6672595.1" type="0">
+                               <ARRIVAL date="20100207" time="1833"/>
+                               <DEPARTURE date="20100207" time="1833"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549162.6" y="6672633.1" type="0">
+                               <ARRIVAL date="20100207" time="1834"/>
+                               <DEPARTURE date="20100207" time="1834"/>
+                       </MAPLOC>
+                       <POINT uid="dest" x="2549183.0" y="6672570.0">
+                               <ARRIVAL date="20100207" time="1834"/>
+                               <DEPARTURE date="20100207" time="1834"/>
+                       </POINT>
+               </WALK>
+               <POINT uid="dest" x="2549183.0" y="6672570.0">
+                       <ARRIVAL date="20100207" time="1834"/>
+                       <DEPARTURE date="20100207" time="1834"/>
+               </POINT>
+       </ROUTE>
+       <ROUTE from="start" to="dest">
+               <LENGTH time="13.411" dist="2501.497"/>
+               <POINT uid="start" x="2551042.0" y="6672829.0">
+                       <ARRIVAL date="20100207" time="1829"/>
+                       <DEPARTURE date="20100207" time="1829"/>
+               </POINT>
+               <WALK>
+                       <LENGTH time="4.475" dist="357.069"/>
+                       <POINT uid="start" x="2551042.0" y="6672829.0">
+                               <ARRIVAL date="20100207" time="1829"/>
+                               <DEPARTURE date="20100207" time="1829"/>
+                       </POINT>
+                       <MAPLOC x="2551034.9" y="6672875.6" type="7">
+                               <ARRIVAL date="20100207" time="1830"/>
+                               <DEPARTURE date="20100207" time="1830"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550977.7" y="6672869.1" type="15">
+                               <ARRIVAL date="20100207" time="1831"/>
+                               <DEPARTURE date="20100207" time="1831"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550949.3" y="6672867.5" type="7">
+                               <ARRIVAL date="20100207" time="1831"/>
+                               <DEPARTURE date="20100207" time="1831"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550817.2" y="6672859.3" type="7">
+                               <ARRIVAL date="20100207" time="1833"/>
+                               <DEPARTURE date="20100207" time="1833"/>
+                       </MAPLOC>
+                       <MAPLOC x="2550808.5" y="6672889.3" type="11">
+                               <ARRIVAL date="20100207" time="1834"/>
+                               <DEPARTURE date="20100207" time="1834"/>
+                               <NAME lang="1" val="Porkkalankatu"/>
+                       </MAPLOC>
+                       <STOP code="6:1201227" x="2550765.0" y="6672886.0" id="755">
+                               <ARRIVAL date="20100207" time="1834"/>
+                               <DEPARTURE date="20100207" time="1834"/>
+                               <NAME lang="1" val="Länsiväylä"/>
+                               <NAME lang="2" val="Västerleden"/>
+                       </STOP>
+               </WALK>
+               <LINE id="603" code="2110T 1" type="5" mobility="3">
+                       <LENGTH time="4.000" dist="1751.582"/>
+                       <STOP code="6:1201227" x="2550765.0" y="6672886.0" id="755" ord="3">
+                               <ARRIVAL date="20100207" time="1834"/>
+                               <DEPARTURE date="20100207" time="1834"/>
+                               <NAME lang="1" val="Länsiväylä"/>
+                               <NAME lang="2" val="Västerleden"/>
+                       </STOP>
+                       <STOP code="6:1201231" x="2550387.0" y="6672761.0" id="759">
+                               <ARRIVAL date="20100207" time="1835"/>
+                               <DEPARTURE date="20100207" time="1835"/>
+                               <NAME lang="1" val="Salmisaari"/>
+                               <NAME lang="2" val="Sundholmen"/>
+                       </STOP>
+                       <STOP code="6:1310201" x="2549630.0" y="6672524.0" id="1402">
+                               <ARRIVAL date="20100207" time="1837"/>
+                               <DEPARTURE date="20100207" time="1837"/>
+                               <NAME lang="1" val="Lauttasaaren silta"/>
+                               <NAME lang="2" val="Drumsö bro"/>
+                       </STOP>
+                       <STOP code="6:1310203" x="2549248.0" y="6672446.0" id="1404" ord="6">
+                               <ARRIVAL date="20100207" time="1838"/>
+                               <DEPARTURE date="20100207" time="1838"/>
+                               <NAME lang="1" val="Koillisväylä"/>
+                               <NAME lang="2" val="Nordostpassagen"/>
+                       </STOP>
+               </LINE>
+               <WALK>
+                       <LENGTH time="4.936" dist="392.846"/>
+                       <STOP code="6:1310203" x="2549248.0" y="6672446.0" id="1404">
+                               <ARRIVAL date="20100207" time="1838"/>
+                               <DEPARTURE date="20100207" time="1838"/>
+                               <NAME lang="1" val="Koillisväylä"/>
+                               <NAME lang="2" val="Nordostpassagen"/>
+                       </STOP>
+                       <MAPLOC x="2549200.4" y="6672433.4" type="0">
+                               <ARRIVAL date="20100207" time="1838"/>
+                               <DEPARTURE date="20100207" time="1838"/>
+                               <NAME lang="1" val="Taivaanvuohenkuja"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549151.2" y="6672527.3" type="0">
+                               <ARRIVAL date="20100207" time="1840"/>
+                               <DEPARTURE date="20100207" time="1840"/>
+                               <NAME lang="1" val="Taivaanvuohentie"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549105.4" y="6672573.6" type="0">
+                               <ARRIVAL date="20100207" time="1841"/>
+                               <DEPARTURE date="20100207" time="1841"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549115.4" y="6672595.1" type="0">
+                               <ARRIVAL date="20100207" time="1841"/>
+                               <DEPARTURE date="20100207" time="1841"/>
+                       </MAPLOC>
+                       <MAPLOC x="2549162.6" y="6672633.1" type="0">
+                               <ARRIVAL date="20100207" time="1842"/>
+                               <DEPARTURE date="20100207" time="1842"/>
+                       </MAPLOC>
+                       <POINT uid="dest" x="2549183.0" y="6672570.0">
+                               <ARRIVAL date="20100207" time="1842"/>
+                               <DEPARTURE date="20100207" time="1842"/>
+                       </POINT>
+               </WALK>
+               <POINT uid="dest" x="2549183.0" y="6672570.0">
+                       <ARRIVAL date="20100207" time="1842"/>
+                       <DEPARTURE date="20100207" time="1842"/>
+               </POINT>
+       </ROUTE>
+</MTRXML>" 
diff --git a/zouba/qt/location.h b/zouba/qt/location.h
deleted file mode 100644 (file)
index 2f4c440..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef LOCATION_H
-#define LOCATION_H
-
-class Location
-{
-public:
-  Location( QString x, QString y ) :
-    x(x),
-    y(y)
-  {
-  };
-
-  Location( QString address )
-  {
-    Q_UNUSED( address );
-  };
-
-  QString x;
-  QString y;
-};
-#endif // LOCATION_H
diff --git a/zouba/qt/main.cpp b/zouba/qt/main.cpp
deleted file mode 100644 (file)
index ab38693..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "route.h"
-#include "ui_zouba.h"
-
-#include "location.h"
-
-#include <QDebug>
-
-namespace {
-  Location home( "2549183", "6672570" );
-  Location work( "2551042", "6672829" );
-}
-
-int main(int argc, char *argv[] )
-{
-  QApplication app(argc, argv);
-  QMainWindow *widget = new QMainWindow;
-  Ui::MainWindow ui;
-  ui.setupUi(widget);
-
-  Route route( &ui );
-
-  route.setFromLocation( work );
-  route.setToLocation( home );
-
-  route.get();
-
-  ui.TimeDisplay->setText( "HELLO" );
-
-  widget->show();
-  return app.exec();
-}
diff --git a/zouba/qt/output.xml b/zouba/qt/output.xml
deleted file mode 100644 (file)
index 1557ded..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-"<?xml version="1.0" encoding="ISO-8859-1" ?>
-<MTRXML version="1.0">
-       <ROUTE from="start" to="dest">
-               <LENGTH time="14.411" dist="2510.063"/>
-               <POINT uid="start" x="2551042.0" y="6672829.0">
-                       <ARRIVAL date="20100207" time="1815"/>
-                       <DEPARTURE date="20100207" time="1815"/>
-               </POINT>
-               <WALK>
-                       <LENGTH time="4.475" dist="357.069"/>
-                       <POINT uid="start" x="2551042.0" y="6672829.0">
-                               <ARRIVAL date="20100207" time="1815"/>
-                               <DEPARTURE date="20100207" time="1815"/>
-                       </POINT>
-                       <MAPLOC x="2551034.9" y="6672875.6" type="7">
-                               <ARRIVAL date="20100207" time="1816"/>
-                               <DEPARTURE date="20100207" time="1816"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550977.7" y="6672869.1" type="15">
-                               <ARRIVAL date="20100207" time="1817"/>
-                               <DEPARTURE date="20100207" time="1817"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550949.3" y="6672867.5" type="7">
-                               <ARRIVAL date="20100207" time="1817"/>
-                               <DEPARTURE date="20100207" time="1817"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550817.2" y="6672859.3" type="7">
-                               <ARRIVAL date="20100207" time="1819"/>
-                               <DEPARTURE date="20100207" time="1819"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550808.5" y="6672889.3" type="11">
-                               <ARRIVAL date="20100207" time="1820"/>
-                               <DEPARTURE date="20100207" time="1820"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <STOP code="6:1201129" x="2550765.0" y="6672886.0" id="745">
-                               <ARRIVAL date="20100207" time="1820"/>
-                               <DEPARTURE date="20100207" time="1820"/>
-                               <NAME lang="1" val="Länsiväylä"/>
-                               <NAME lang="2" val="Västerleden"/>
-                       </STOP>
-               </WALK>
-               <LINE id="200" code="1065A 2" type="1" mobility="3">
-                       <LENGTH time="5.000" dist="1760.931"/>
-                       <STOP code="6:1201129" x="2550765.0" y="6672886.0" id="745" ord="30">
-                               <ARRIVAL date="20100207" time="1820"/>
-                               <DEPARTURE date="20100207" time="1820"/>
-                               <NAME lang="1" val="Länsiväylä"/>
-                               <NAME lang="2" val="Västerleden"/>
-                       </STOP>
-                       <STOP code="6:1201131" x="2550385.0" y="6672760.0" id="747">
-                               <ARRIVAL date="20100207" time="1821"/>
-                               <DEPARTURE date="20100207" time="1821"/>
-                               <NAME lang="1" val="Salmisaari"/>
-                               <NAME lang="2" val="Sundholmen"/>
-                       </STOP>
-                       <STOP code="6:1310101" x="2549608.0" y="6672522.0" id="1356">
-                               <ARRIVAL date="20100207" time="1824"/>
-                               <DEPARTURE date="20100207" time="1824"/>
-                               <NAME lang="1" val="Lauttasaaren silta"/>
-                               <NAME lang="2" val="Drumsö bro"/>
-                       </STOP>
-                       <STOP code="6:1310103" x="2549247.0" y="6672446.0" id="1358" ord="33">
-                               <ARRIVAL date="20100207" time="1825"/>
-                               <DEPARTURE date="20100207" time="1825"/>
-                               <NAME lang="1" val="Koillisväylä"/>
-                               <NAME lang="2" val="Nordostpassagen"/>
-                       </STOP>
-               </LINE>
-               <WALK>
-                       <LENGTH time="4.936" dist="392.062"/>
-                       <STOP code="6:1310103" x="2549247.0" y="6672446.0" id="1358">
-                               <ARRIVAL date="20100207" time="1825"/>
-                               <DEPARTURE date="20100207" time="1825"/>
-                               <NAME lang="1" val="Koillisväylä"/>
-                               <NAME lang="2" val="Nordostpassagen"/>
-                       </STOP>
-                       <MAPLOC x="2549200.4" y="6672433.4" type="0">
-                               <ARRIVAL date="20100207" time="1825"/>
-                               <DEPARTURE date="20100207" time="1825"/>
-                               <NAME lang="1" val="Taivaanvuohenkuja"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549151.2" y="6672527.3" type="0">
-                               <ARRIVAL date="20100207" time="1827"/>
-                               <DEPARTURE date="20100207" time="1827"/>
-                               <NAME lang="1" val="Taivaanvuohentie"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549105.4" y="6672573.6" type="0">
-                               <ARRIVAL date="20100207" time="1828"/>
-                               <DEPARTURE date="20100207" time="1828"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549115.4" y="6672595.1" type="0">
-                               <ARRIVAL date="20100207" time="1828"/>
-                               <DEPARTURE date="20100207" time="1828"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549162.6" y="6672633.1" type="0">
-                               <ARRIVAL date="20100207" time="1829"/>
-                               <DEPARTURE date="20100207" time="1829"/>
-                       </MAPLOC>
-                       <POINT uid="dest" x="2549183.0" y="6672570.0">
-                               <ARRIVAL date="20100207" time="1829"/>
-                               <DEPARTURE date="20100207" time="1829"/>
-                       </POINT>
-               </WALK>
-               <POINT uid="dest" x="2549183.0" y="6672570.0">
-                       <ARRIVAL date="20100207" time="1829"/>
-                       <DEPARTURE date="20100207" time="1829"/>
-               </POINT>
-       </ROUTE>
-       <ROUTE from="start" to="dest">
-               <LENGTH time="13.411" dist="2501.497"/>
-               <POINT uid="start" x="2551042.0" y="6672829.0">
-                       <ARRIVAL date="20100207" time="1821"/>
-                       <DEPARTURE date="20100207" time="1821"/>
-               </POINT>
-               <WALK>
-                       <LENGTH time="4.475" dist="357.069"/>
-                       <POINT uid="start" x="2551042.0" y="6672829.0">
-                               <ARRIVAL date="20100207" time="1821"/>
-                               <DEPARTURE date="20100207" time="1821"/>
-                       </POINT>
-                       <MAPLOC x="2551034.9" y="6672875.6" type="7">
-                               <ARRIVAL date="20100207" time="1822"/>
-                               <DEPARTURE date="20100207" time="1822"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550977.7" y="6672869.1" type="15">
-                               <ARRIVAL date="20100207" time="1823"/>
-                               <DEPARTURE date="20100207" time="1823"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550949.3" y="6672867.5" type="7">
-                               <ARRIVAL date="20100207" time="1823"/>
-                               <DEPARTURE date="20100207" time="1823"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550817.2" y="6672859.3" type="7">
-                               <ARRIVAL date="20100207" time="1825"/>
-                               <DEPARTURE date="20100207" time="1825"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550808.5" y="6672889.3" type="11">
-                               <ARRIVAL date="20100207" time="1826"/>
-                               <DEPARTURE date="20100207" time="1826"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <STOP code="6:1201227" x="2550765.0" y="6672886.0" id="755">
-                               <ARRIVAL date="20100207" time="1826"/>
-                               <DEPARTURE date="20100207" time="1826"/>
-                               <NAME lang="1" val="Länsiväylä"/>
-                               <NAME lang="2" val="Västerleden"/>
-                       </STOP>
-               </WALK>
-               <LINE id="579" code="2102T 1" type="5" mobility="3">
-                       <LENGTH time="4.000" dist="1751.582"/>
-                       <STOP code="6:1201227" x="2550765.0" y="6672886.0" id="755" ord="3">
-                               <ARRIVAL date="20100207" time="1826"/>
-                               <DEPARTURE date="20100207" time="1826"/>
-                               <NAME lang="1" val="Länsiväylä"/>
-                               <NAME lang="2" val="Västerleden"/>
-                       </STOP>
-                       <STOP code="6:1201231" x="2550387.0" y="6672761.0" id="759">
-                               <ARRIVAL date="20100207" time="1827"/>
-                               <DEPARTURE date="20100207" time="1827"/>
-                               <NAME lang="1" val="Salmisaari"/>
-                               <NAME lang="2" val="Sundholmen"/>
-                       </STOP>
-                       <STOP code="6:1310201" x="2549630.0" y="6672524.0" id="1402">
-                               <ARRIVAL date="20100207" time="1829"/>
-                               <DEPARTURE date="20100207" time="1829"/>
-                               <NAME lang="1" val="Lauttasaaren silta"/>
-                               <NAME lang="2" val="Drumsö bro"/>
-                       </STOP>
-                       <STOP code="6:1310203" x="2549248.0" y="6672446.0" id="1404" ord="6">
-                               <ARRIVAL date="20100207" time="1830"/>
-                               <DEPARTURE date="20100207" time="1830"/>
-                               <NAME lang="1" val="Koillisväylä"/>
-                               <NAME lang="2" val="Nordostpassagen"/>
-                       </STOP>
-               </LINE>
-               <WALK>
-                       <LENGTH time="4.936" dist="392.846"/>
-                       <STOP code="6:1310203" x="2549248.0" y="6672446.0" id="1404">
-                               <ARRIVAL date="20100207" time="1830"/>
-                               <DEPARTURE date="20100207" time="1830"/>
-                               <NAME lang="1" val="Koillisväylä"/>
-                               <NAME lang="2" val="Nordostpassagen"/>
-                       </STOP>
-                       <MAPLOC x="2549200.4" y="6672433.4" type="0">
-                               <ARRIVAL date="20100207" time="1830"/>
-                               <DEPARTURE date="20100207" time="1830"/>
-                               <NAME lang="1" val="Taivaanvuohenkuja"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549151.2" y="6672527.3" type="0">
-                               <ARRIVAL date="20100207" time="1832"/>
-                               <DEPARTURE date="20100207" time="1832"/>
-                               <NAME lang="1" val="Taivaanvuohentie"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549105.4" y="6672573.6" type="0">
-                               <ARRIVAL date="20100207" time="1833"/>
-                               <DEPARTURE date="20100207" time="1833"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549115.4" y="6672595.1" type="0">
-                               <ARRIVAL date="20100207" time="1833"/>
-                               <DEPARTURE date="20100207" time="1833"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549162.6" y="6672633.1" type="0">
-                               <ARRIVAL date="20100207" time="1834"/>
-                               <DEPARTURE date="20100207" time="1834"/>
-                       </MAPLOC>
-                       <POINT uid="dest" x="2549183.0" y="6672570.0">
-                               <ARRIVAL date="20100207" time="1834"/>
-                               <DEPARTURE date="20100207" time="1834"/>
-                       </POINT>
-               </WALK>
-               <POINT uid="dest" x="2549183.0" y="6672570.0">
-                       <ARRIVAL date="20100207" time="1834"/>
-                       <DEPARTURE date="20100207" time="1834"/>
-               </POINT>
-       </ROUTE>
-       <ROUTE from="start" to="dest">
-               <LENGTH time="13.411" dist="2501.497"/>
-               <POINT uid="start" x="2551042.0" y="6672829.0">
-                       <ARRIVAL date="20100207" time="1829"/>
-                       <DEPARTURE date="20100207" time="1829"/>
-               </POINT>
-               <WALK>
-                       <LENGTH time="4.475" dist="357.069"/>
-                       <POINT uid="start" x="2551042.0" y="6672829.0">
-                               <ARRIVAL date="20100207" time="1829"/>
-                               <DEPARTURE date="20100207" time="1829"/>
-                       </POINT>
-                       <MAPLOC x="2551034.9" y="6672875.6" type="7">
-                               <ARRIVAL date="20100207" time="1830"/>
-                               <DEPARTURE date="20100207" time="1830"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550977.7" y="6672869.1" type="15">
-                               <ARRIVAL date="20100207" time="1831"/>
-                               <DEPARTURE date="20100207" time="1831"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550949.3" y="6672867.5" type="7">
-                               <ARRIVAL date="20100207" time="1831"/>
-                               <DEPARTURE date="20100207" time="1831"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550817.2" y="6672859.3" type="7">
-                               <ARRIVAL date="20100207" time="1833"/>
-                               <DEPARTURE date="20100207" time="1833"/>
-                       </MAPLOC>
-                       <MAPLOC x="2550808.5" y="6672889.3" type="11">
-                               <ARRIVAL date="20100207" time="1834"/>
-                               <DEPARTURE date="20100207" time="1834"/>
-                               <NAME lang="1" val="Porkkalankatu"/>
-                       </MAPLOC>
-                       <STOP code="6:1201227" x="2550765.0" y="6672886.0" id="755">
-                               <ARRIVAL date="20100207" time="1834"/>
-                               <DEPARTURE date="20100207" time="1834"/>
-                               <NAME lang="1" val="Länsiväylä"/>
-                               <NAME lang="2" val="Västerleden"/>
-                       </STOP>
-               </WALK>
-               <LINE id="603" code="2110T 1" type="5" mobility="3">
-                       <LENGTH time="4.000" dist="1751.582"/>
-                       <STOP code="6:1201227" x="2550765.0" y="6672886.0" id="755" ord="3">
-                               <ARRIVAL date="20100207" time="1834"/>
-                               <DEPARTURE date="20100207" time="1834"/>
-                               <NAME lang="1" val="Länsiväylä"/>
-                               <NAME lang="2" val="Västerleden"/>
-                       </STOP>
-                       <STOP code="6:1201231" x="2550387.0" y="6672761.0" id="759">
-                               <ARRIVAL date="20100207" time="1835"/>
-                               <DEPARTURE date="20100207" time="1835"/>
-                               <NAME lang="1" val="Salmisaari"/>
-                               <NAME lang="2" val="Sundholmen"/>
-                       </STOP>
-                       <STOP code="6:1310201" x="2549630.0" y="6672524.0" id="1402">
-                               <ARRIVAL date="20100207" time="1837"/>
-                               <DEPARTURE date="20100207" time="1837"/>
-                               <NAME lang="1" val="Lauttasaaren silta"/>
-                               <NAME lang="2" val="Drumsö bro"/>
-                       </STOP>
-                       <STOP code="6:1310203" x="2549248.0" y="6672446.0" id="1404" ord="6">
-                               <ARRIVAL date="20100207" time="1838"/>
-                               <DEPARTURE date="20100207" time="1838"/>
-                               <NAME lang="1" val="Koillisväylä"/>
-                               <NAME lang="2" val="Nordostpassagen"/>
-                       </STOP>
-               </LINE>
-               <WALK>
-                       <LENGTH time="4.936" dist="392.846"/>
-                       <STOP code="6:1310203" x="2549248.0" y="6672446.0" id="1404">
-                               <ARRIVAL date="20100207" time="1838"/>
-                               <DEPARTURE date="20100207" time="1838"/>
-                               <NAME lang="1" val="Koillisväylä"/>
-                               <NAME lang="2" val="Nordostpassagen"/>
-                       </STOP>
-                       <MAPLOC x="2549200.4" y="6672433.4" type="0">
-                               <ARRIVAL date="20100207" time="1838"/>
-                               <DEPARTURE date="20100207" time="1838"/>
-                               <NAME lang="1" val="Taivaanvuohenkuja"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549151.2" y="6672527.3" type="0">
-                               <ARRIVAL date="20100207" time="1840"/>
-                               <DEPARTURE date="20100207" time="1840"/>
-                               <NAME lang="1" val="Taivaanvuohentie"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549105.4" y="6672573.6" type="0">
-                               <ARRIVAL date="20100207" time="1841"/>
-                               <DEPARTURE date="20100207" time="1841"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549115.4" y="6672595.1" type="0">
-                               <ARRIVAL date="20100207" time="1841"/>
-                               <DEPARTURE date="20100207" time="1841"/>
-                       </MAPLOC>
-                       <MAPLOC x="2549162.6" y="6672633.1" type="0">
-                               <ARRIVAL date="20100207" time="1842"/>
-                               <DEPARTURE date="20100207" time="1842"/>
-                       </MAPLOC>
-                       <POINT uid="dest" x="2549183.0" y="6672570.0">
-                               <ARRIVAL date="20100207" time="1842"/>
-                               <DEPARTURE date="20100207" time="1842"/>
-                       </POINT>
-               </WALK>
-               <POINT uid="dest" x="2549183.0" y="6672570.0">
-                       <ARRIVAL date="20100207" time="1842"/>
-                       <DEPARTURE date="20100207" time="1842"/>
-               </POINT>
-       </ROUTE>
-</MTRXML>" 
diff --git a/zouba/qt/qt.pro b/zouba/qt/qt.pro
deleted file mode 100644 (file)
index 66a76ac..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-CONFIG += \
-  qt \
-
-QT += \
-  network \
-
-TEMPLATE = app
-FORMS    = zouba.ui
-
-SOURCES  = \
-  main.cpp \
-  route.cpp \
-  route_p.cpp \
-
-HEADERS += \
-  route.h \
-  route_p.h \
-
diff --git a/zouba/qt/route.cpp b/zouba/qt/route.cpp
deleted file mode 100644 (file)
index 2b150f0..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "route_p.h"
-#include "route.h"
-
-#include "routedata.h"
-#include "location.h"
-
-#include "ui_zouba.h"
-
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QUrl>
-#include <QObject>
-#include <QDebug>
-#include <QStringList>
-#include <QString>
-#include <QXmlStreamReader>
-
-namespace {
-  QUrl ytv( "http://api.reittiopas.fi/public-ytv/fi/api/" );
-  QString username( "zouba" );
-  QString password( "caf9r3ee" );
-
-  QString homeKey( "taivaanvuohentie%207%2Chelsinki" );
-  QString workKey( "it%E4merenkatu%2011%2Chelsinki" );
-
-}
-  
-Route::Route( Ui::MainWindow *ui ) :
-  q( new RoutePrivate( this ) ),
-  manager( new QNetworkAccessManager(this) ),
-  ui( ui )
-{
-  connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
-}
-
-Route::~Route()
-{
-  delete manager;
-  manager = 0;
-}
-
-void Route::get()
-{
-  QUrl fullUrl( ytv );
-
-  QStringList a;
-  a << q->fromLocation().x << q->fromLocation().y;
-  QStringList b;
-  b << q->toLocation().x << q->toLocation().y;
-
-  fullUrl.addQueryItem( "a", a.join(",") );
-  fullUrl.addQueryItem( "b", b.join(",") );
-  fullUrl.addQueryItem( "user", username );
-  fullUrl.addQueryItem( "pass", password );
-
-  manager->get( QNetworkRequest( fullUrl ) );
-}
-
-void Route::replyFinished( QNetworkReply * reply )
-{
-  RouteData routeData = q->parseReply( reply->readAll() );
-
-  ui->BusNoDisplay->setText( routeData.lineCode );
-  ui->TimeDisplay->setText( routeData.arrivalTime );
-}
-
-void Route::setFromLocation( Location fromLocation )
-{
-  q->setFromLocation( fromLocation );
-}
-
-Location Route::fromLocation()
-{
-  return q->fromLocation();
-}
-
-void Route::setToLocation( Location toLocation )
-{
-  q->setToLocation( toLocation );
-}
-
-Location Route::toLocation()
-{
-  return q->toLocation();
-}
-
diff --git a/zouba/qt/route.h b/zouba/qt/route.h
deleted file mode 100644 (file)
index 4e8bbf6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef ROUTE_H
-#define ROUTE_H
-
-#include "ui_zouba.h"
-
-#include "location.h"
-
-#include <QObject>
-#include <QNetworkReply>
-#include <QNetworkAccessManager>
-
-class RoutePrivate;
-
-class Route: public QObject
-{
-  Q_OBJECT
-
-public:
-  Route( Ui::MainWindow *ui );
-  ~Route();
-
-  Q_PROPERTY(Location fromLocation READ fromLocation WRITE setFromLocation);
-  Q_PROPERTY(Location toLocation READ toLocation WRITE setFromLocation);
-
-  /*!
-    * \brief Gets the route data from the server
-    */
-  void get();
-
-  /*!
-    * \brief Sets the from location
-    * \param fromLocation The from location
-    */
-  void setFromLocation( Location fromLocation );
-
-  /*!
-    \brief Get the from location
-    \return The from location
-    */
-  Location fromLocation();
-
-  /*!
-    * \brief Sets the to location
-    * \param toLocation The to location
-    */
-  void setToLocation( Location toLocation );
-
-  /*!
-    \brief Get the to location
-    \return The to location
-    */
-  Location toLocation();
-
-public Q_SLOTS:
-  void replyFinished(QNetworkReply*);
-
-private:
-  RoutePrivate *q;
-  QNetworkAccessManager *manager;
-  Ui::MainWindow *ui;
-};
-#endif // ROUTE_H
diff --git a/zouba/qt/route_p.cpp b/zouba/qt/route_p.cpp
deleted file mode 100644 (file)
index df3c2d1..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "route_p.h"
-#include "location.h"
-
-#include <QXmlStreamReader>
-#include <QDebug>
-
-RoutePrivate::RoutePrivate( QObject *parent ) :
-    m_fromLocation(0,0),
-    m_toLocation(0,0)
-{
-  Q_UNUSED( parent )
-}
-
-RoutePrivate::~RoutePrivate()
-{
-}
-
-RouteData RoutePrivate::parseReply( const QByteArray &reply )
-{
-  RouteData retVal;
-
-  QXmlStreamReader xml( reply );
-
-  bool inLine = false;
-  bool inStop = false;
-  while ( !xml.atEnd() ) {
-    xml.readNext();
-    if ( xml.isStartElement() && xml.name() == "LINE" ) {
-      QString lineCode( xml.attributes().value("code").toString() );
-
-      retVal.lineCode = parseJORECode( lineCode );
-
-      inLine = true;
-    } else
-    if ( inLine && xml.name() == "STOP" ) {
-      inStop = true;
-    } else
-    if ( inLine && inStop && xml.name() == "ARRIVAL" ) {
-      QString arrivalTime( xml.attributes().value("time").toString() );
-
-      retVal.arrivalTime = arrivalTime;
-
-      inLine = false;
-    } else
-    if ( xml.isEndElement() && xml.name() == "STOP" ) {
-      inStop = false;
-    } else
-    if ( xml.isEndElement() && xml.name() == "LINE" ) {
-      inLine = false;
-    }
-  }
-
-  if ( xml.hasError() ) {
-    qDebug() << "xml error";
-  }
-
-  return retVal;
-}
-
-void RoutePrivate::setFromLocation( Location fromLocation )
-{
-  m_fromLocation = fromLocation;
-}
-
-Location RoutePrivate::fromLocation()
-{
-  return m_fromLocation;
-}
-
-void RoutePrivate::setToLocation( Location toLocation )
-{
-  m_toLocation = toLocation;
-}
-
-QString RoutePrivate::parseJORECode( const QString &joreCode ) const
-{
-    QString areaTransportTypeCode( joreCode.mid(0,1) );
-    QString lineCode( joreCode.mid(1,3) );
-    QString letterVariant( joreCode.mid(4,1) );
-    QString letterNumberVariant( joreCode.mid(5,1) );
-    QString direction( joreCode.mid(6,1) );
-
-    lineCode.setNum( lineCode.toInt() );
-    
-    return lineCode+letterVariant;
-}
-
-Location RoutePrivate::toLocation()
-{
-  return m_toLocation;
-}
diff --git a/zouba/qt/route_p.h b/zouba/qt/route_p.h
deleted file mode 100644 (file)
index 520b89d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef ROUTE_P_H
-#define ROUTE_P_H
-
-#include "routedata.h"
-
-#include "location.h"
-
-#include <QObject>
-
-class RoutePrivate: public QObject
-{
-  Q_OBJECT
-
-public:
-  RoutePrivate( QObject *parent=0 );
-  ~RoutePrivate();
-
-  Q_PROPERTY(Location fromLocation READ fromLocation WRITE setFromLocation);
-  Q_PROPERTY(Location toLocation READ toLocation WRITE setFromLocation);
-
-  RouteData parseReply( const QByteArray &reply );
-
-  void setFromLocation( Location fromLocation );
-
-  Location fromLocation();
-
-  void setToLocation( Location toLocation );
-
-  Location toLocation();
-
-private:
-  Location m_fromLocation;
-  Location m_toLocation;
-
-  QString parseJORECode( const QString &joreCode ) const;
-};
-#endif // ROUTE_P_H
diff --git a/zouba/qt/routedata.h b/zouba/qt/routedata.h
deleted file mode 100644 (file)
index a2abd31..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef ROUTEDATA_H
-#define ROUTEDATA_H
-
-#include <QString>
-
-struct RouteData
-{
-  QString lineCode;
-  QString arrivalTime;
-};
-
-#endif // ROUTEDATA_H
diff --git a/zouba/qt/tests/ut_route/ut_route.cpp b/zouba/qt/tests/ut_route/ut_route.cpp
deleted file mode 100644 (file)
index 6df0194..0000000
+++ /dev/null
@@ -1,385 +0,0 @@
-#include <QObject>
-#include <QtDebug>
-#include <QByteArray>
-#include "ut_route.h"
-
-QByteArray sampleInput(
-"\
-<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\
-<MTRXML version=\"1.0\">\
-       <ROUTE from=\"start\" to=\"dest\">\
-               <LENGTH time=\"14.411\" dist=\"2510.063\"/>\
-               <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
-                       <ARRIVAL date=\"20100207\" time=\"1815\"/>\
-                       <DEPARTURE date=\"20100207\" time=\"1815\"/>\
-               </POINT>\
-               <WALK>\
-                       <LENGTH time=\"4.475\" dist=\"357.069\"/>\
-                       <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1815\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1815\"/>\
-                       </POINT>\
-                       <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1816\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1816\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
-                               <ARRIVAL date=\"20100207\" time=\"1817\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1817\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1817\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1817\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1819\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1819\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
-                               <ARRIVAL date=\"20100207\" time=\"1820\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1820\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <STOP code=\"6:1201129\" x=\"2550765.0\" y=\"6672886.0\" id=\"745\">\
-                               <ARRIVAL date=\"20100207\" time=\"1820\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1820\"/>\
-                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
-                               <NAME lang=\"2\" val=\"Västerleden\"/>\
-                       </STOP>\
-               </WALK>\
-               <LINE id=\"200\" code=\"1065A 2\" type=\"1\" mobility=\"3\">\
-                       <LENGTH time=\"5.000\" dist=\"1760.931\"/>\
-                       <STOP code=\"6:1201129\" x=\"2550765.0\" y=\"6672886.0\" id=\"745\" ord=\"30\">\
-                               <ARRIVAL date=\"20100207\" time=\"1820\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1820\"/>\
-                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
-                               <NAME lang=\"2\" val=\"Västerleden\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1201131\" x=\"2550385.0\" y=\"6672760.0\" id=\"747\">\
-                               <ARRIVAL date=\"20100207\" time=\"1821\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1821\"/>\
-                               <NAME lang=\"1\" val=\"Salmisaari\"/>\
-                               <NAME lang=\"2\" val=\"Sundholmen\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1310101\" x=\"2549608.0\" y=\"6672522.0\" id=\"1356\">\
-                               <ARRIVAL date=\"20100207\" time=\"1824\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1824\"/>\
-                               <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
-                               <NAME lang=\"2\" val=\"Drumsö bro\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1310103\" x=\"2549247.0\" y=\"6672446.0\" id=\"1358\" ord=\"33\">\
-                               <ARRIVAL date=\"20100207\" time=\"1825\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1825\"/>\
-                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
-                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
-                       </STOP>\
-               </LINE>\
-               <WALK>\
-                       <LENGTH time=\"4.936\" dist=\"392.062\"/>\
-                       <STOP code=\"6:1310103\" x=\"2549247.0\" y=\"6672446.0\" id=\"1358\">\
-                               <ARRIVAL date=\"20100207\" time=\"1825\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1825\"/>\
-                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
-                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
-                       </STOP>\
-                       <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1825\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1825\"/>\
-                               <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1827\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1827\"/>\
-                               <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1828\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1828\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1828\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1828\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1829\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1829\"/>\
-                       </MAPLOC>\
-                       <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1829\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1829\"/>\
-                       </POINT>\
-               </WALK>\
-               <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
-                       <ARRIVAL date=\"20100207\" time=\"1829\"/>\
-                       <DEPARTURE date=\"20100207\" time=\"1829\"/>\
-               </POINT>\
-       </ROUTE>\
-       <ROUTE from=\"start\" to=\"dest\">\
-               <LENGTH time=\"13.411\" dist=\"2501.497\"/>\
-               <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
-                       <ARRIVAL date=\"20100207\" time=\"1821\"/>\
-                       <DEPARTURE date=\"20100207\" time=\"1821\"/>\
-               </POINT>\
-               <WALK>\
-                       <LENGTH time=\"4.475\" dist=\"357.069\"/>\
-                       <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1821\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1821\"/>\
-                       </POINT>\
-                       <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1822\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1822\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
-                               <ARRIVAL date=\"20100207\" time=\"1823\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1823\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1823\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1823\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1825\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1825\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
-                               <ARRIVAL date=\"20100207\" time=\"1826\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1826\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\">\
-                               <ARRIVAL date=\"20100207\" time=\"1826\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1826\"/>\
-                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
-                               <NAME lang=\"2\" val=\"Västerleden\"/>\
-                       </STOP>\
-               </WALK>\
-               <LINE id=\"579\" code=\"2102T 1\" type=\"5\" mobility=\"3\">\
-                       <LENGTH time=\"4.000\" dist=\"1751.582\"/>\
-                       <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\" ord=\"3\">\
-                               <ARRIVAL date=\"20100207\" time=\"1826\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1826\"/>\
-                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
-                               <NAME lang=\"2\" val=\"Västerleden\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1201231\" x=\"2550387.0\" y=\"6672761.0\" id=\"759\">\
-                               <ARRIVAL date=\"20100207\" time=\"1827\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1827\"/>\
-                               <NAME lang=\"1\" val=\"Salmisaari\"/>\
-                               <NAME lang=\"2\" val=\"Sundholmen\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1310201\" x=\"2549630.0\" y=\"6672524.0\" id=\"1402\">\
-                               <ARRIVAL date=\"20100207\" time=\"1829\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1829\"/>\
-                               <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
-                               <NAME lang=\"2\" val=\"Drumsö bro\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\" ord=\"6\">\
-                               <ARRIVAL date=\"20100207\" time=\"1830\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1830\"/>\
-                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
-                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
-                       </STOP>\
-               </LINE>\
-               <WALK>\
-                       <LENGTH time=\"4.936\" dist=\"392.846\"/>\
-                       <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\">\
-                               <ARRIVAL date=\"20100207\" time=\"1830\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1830\"/>\
-                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
-                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
-                       </STOP>\
-                       <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1830\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1830\"/>\
-                               <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1832\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1832\"/>\
-                               <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1833\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1833\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1833\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1833\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
-                       </MAPLOC>\
-                       <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
-                       </POINT>\
-               </WALK>\
-               <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
-                       <ARRIVAL date=\"20100207\" time=\"1834\"/>\
-                       <DEPARTURE date=\"20100207\" time=\"1834\"/>\
-               </POINT>\
-       </ROUTE>\
-       <ROUTE from=\"start\" to=\"dest\">\
-               <LENGTH time=\"13.411\" dist=\"2501.497\"/>\
-               <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
-                       <ARRIVAL date=\"20100207\" time=\"1829\"/>\
-                       <DEPARTURE date=\"20100207\" time=\"1829\"/>\
-               </POINT>\
-               <WALK>\
-                       <LENGTH time=\"4.475\" dist=\"357.069\"/>\
-                       <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1829\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1829\"/>\
-                       </POINT>\
-                       <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1830\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1830\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
-                               <ARRIVAL date=\"20100207\" time=\"1831\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1831\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1831\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1831\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
-                               <ARRIVAL date=\"20100207\" time=\"1833\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1833\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
-                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
-                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
-                       </MAPLOC>\
-                       <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\">\
-                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
-                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
-                               <NAME lang=\"2\" val=\"Västerleden\"/>\
-                       </STOP>\
-               </WALK>\
-               <LINE id=\"603\" code=\"2110T 1\" type=\"5\" mobility=\"3\">\
-                       <LENGTH time=\"4.000\" dist=\"1751.582\"/>\
-                       <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\" ord=\"3\">\
-                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
-                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
-                               <NAME lang=\"2\" val=\"Västerleden\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1201231\" x=\"2550387.0\" y=\"6672761.0\" id=\"759\">\
-                               <ARRIVAL date=\"20100207\" time=\"1835\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1835\"/>\
-                               <NAME lang=\"1\" val=\"Salmisaari\"/>\
-                               <NAME lang=\"2\" val=\"Sundholmen\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1310201\" x=\"2549630.0\" y=\"6672524.0\" id=\"1402\">\
-                               <ARRIVAL date=\"20100207\" time=\"1837\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1837\"/>\
-                               <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
-                               <NAME lang=\"2\" val=\"Drumsö bro\"/>\
-                       </STOP>\
-                       <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\" ord=\"6\">\
-                               <ARRIVAL date=\"20100207\" time=\"1838\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1838\"/>\
-                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
-                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
-                       </STOP>\
-               </LINE>\
-               <WALK>\
-                       <LENGTH time=\"4.936\" dist=\"392.846\"/>\
-                       <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\">\
-                               <ARRIVAL date=\"20100207\" time=\"1838\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1838\"/>\
-                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
-                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
-                       </STOP>\
-                       <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1838\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1838\"/>\
-                               <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1840\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1840\"/>\
-                               <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1841\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1841\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1841\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1841\"/>\
-                       </MAPLOC>\
-                       <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1842\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1842\"/>\
-                       </MAPLOC>\
-                       <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
-                               <ARRIVAL date=\"20100207\" time=\"1842\"/>\
-                               <DEPARTURE date=\"20100207\" time=\"1842\"/>\
-                       </POINT>\
-               </WALK>\
-               <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
-                       <ARRIVAL date=\"20100207\" time=\"1842\"/>\
-                       <DEPARTURE date=\"20100207\" time=\"1842\"/>\
-               </POINT>\
-       </ROUTE>\
-</MTRXML>\
-"
-
-);
-
-void Ut_Route::init()
-{
-    m_subject = new RoutePrivate();
-}
-
-void Ut_Route::cleanup()
-{
-    delete m_subject;
-    m_subject = 0;
-}
-
-void Ut_Route::initTestCase()
-{
-}
-
-void Ut_Route::cleanupTestCase()
-{
-}
-
-void Ut_Route::testParseReply()
-{
-  RouteData routeData = m_subject->parseReply( sampleInput );
-
-  QCOMPARE( routeData.lineCode, QString( "110T" ) );
-  QCOMPARE( routeData.arrivalTime, QString( "1834" ) );
-}
-
-void Ut_Route::testSetFromLocation()
-{
-  Location work( "2551042", "6672829" );
-  m_subject->setFromLocation( work );
-  QCOMPARE( work.x, m_subject->fromLocation().x );
-  QCOMPARE( work.y, m_subject->fromLocation().y );
-}
-
-void Ut_Route::testSetToLocation()
-{
-  Location work( "2551042", "6672829" );
-  m_subject->setToLocation( work );
-  QCOMPARE( work.x, m_subject->toLocation().x );
-  QCOMPARE( work.y, m_subject->toLocation().y );
-}
-
-QTEST_MAIN(Ut_Route)
diff --git a/zouba/qt/tests/ut_route/ut_route.h b/zouba/qt/tests/ut_route/ut_route.h
deleted file mode 100644 (file)
index 54f3c3f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef UT_HTTPCLIENT_H
-#define UT_HTTPCLIENT_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-#include <route_p.h>
-
-Q_DECLARE_METATYPE(RoutePrivate*);
-
-class Ut_Route : public QObject
-{
-    Q_OBJECT
-
-public:
-
-private slots:
-    void init();
-    void cleanup();
-    void initTestCase();
-    void cleanupTestCase();
-    void testParseReply();
-    void testSetFromLocation();
-    void testSetToLocation();
-
-private:
-    RoutePrivate *m_subject;
-};
-#endif // UT_HTTPCLIENT_H
diff --git a/zouba/qt/tests/ut_route/ut_route.pro b/zouba/qt/tests/ut_route/ut_route.pro
deleted file mode 100644 (file)
index 820f8fb..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-CONFIG += \
-  qt \
-  debug \
-
-QT += \
-  testlib \
-
-INCLUDEPATH += \
-  ../.. \
-
-TEMPLATE = app
-
-SOURCES  = \
-  ut_route.cpp \
-  ../../route_p.cpp \
-
-HEADERS += \
-  ut_route.h \
-  ../../route_p.h \
-
diff --git a/zouba/qt/zouba.ui b/zouba/qt/zouba.ui
deleted file mode 100644 (file)
index 6eaa8b6..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>640</width>
-    <height>480</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>ZuoBa</string>
-  </property>
-  <widget class="QWidget" name="centralwidget">
-   <widget class="QWidget" name="verticalLayoutWidget">
-    <property name="geometry">
-     <rect>
-      <x>0</x>
-      <y>0</y>
-      <width>230</width>
-      <height>82</height>
-     </rect>
-    </property>
-    <layout class="QVBoxLayout" name="verticalLayout">
-     <item>
-      <layout class="QFormLayout" name="formLayout">
-       <property name="fieldGrowthPolicy">
-        <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
-       </property>
-       <item row="1" column="0">
-        <widget class="QLabel" name="TimeLabel">
-         <property name="text">
-          <string>Time</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QLabel" name="TimeDisplay">
-         <property name="text">
-          <string>TimeDisplay</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="0">
-        <widget class="QLabel" name="BusNoLabel">
-         <property name="text">
-          <string>BusNo</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="1">
-        <widget class="QLabel" name="BusNoDisplay">
-         <property name="text">
-          <string>BusNoDisplay</string>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0" colspan="2">
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QPushButton" name="pushButton_2">
-           <property name="text">
-            <string>Work</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="pushButton">
-           <property name="text">
-            <string>Home</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </item>
-    </layout>
-   </widget>
-  </widget>
-  <widget class="QMenuBar" name="menubar">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>640</width>
-     <height>25</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QStatusBar" name="statusbar"/>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/zouba/route.cpp b/zouba/route.cpp
new file mode 100644 (file)
index 0000000..331ae54
--- /dev/null
@@ -0,0 +1,94 @@
+#include "route_p.h"
+#include "route.h"
+
+#include "routedata.h"
+#include "location.h"
+
+#include <QNetworkAccessManager>
+#include <QNetworkReply>
+#include <QUrl>
+#include <QObject>
+#include <QDebug>
+#include <QStringList>
+#include <QString>
+#include <QXmlStreamReader>
+
+#include "ytv.h"
+
+Route::Route() :
+  q( new RoutePrivate( this ) ),
+  manager( new QNetworkAccessManager(this) )
+{
+  connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
+}
+
+Route::~Route()
+{
+  delete manager;
+  manager = 0;
+}
+
+void Route::getRoute()
+{
+  QUrl fullUrl( ytv );
+
+  QStringList a;
+  a << q->fromLocation().x() << q->fromLocation().y();
+  QStringList b;
+  b << q->toLocation().x() << q->toLocation().y();
+
+  fullUrl.addQueryItem( "a", a.join(",") );
+  fullUrl.addQueryItem( "b", b.join(",") );
+  fullUrl.addQueryItem( "user", username );
+  fullUrl.addQueryItem( "pass", password );
+
+  manager->get( QNetworkRequest( fullUrl ) );
+}
+
+void Route::replyFinished( QNetworkReply * reply )
+{
+  RouteData routeData = q->parseReply( reply->readAll() );
+
+  emit( routeReady( routeData ) );
+}
+
+void Route::setFromLocation( const Location &location )
+{
+  if ( location.isValid() ) {
+    q->setFromLocation( location );
+  } else {
+    Location *locationPtr = qobject_cast<Location*>(sender());
+    if ( locationPtr ) {
+      q->setFromLocation( *locationPtr );
+      if ( q->toValid() ) {
+        getRoute();
+      }
+    }
+  }
+}
+
+const Location &Route::fromLocation()
+{
+  return q->fromLocation();
+}
+
+void Route::setToLocation( const Location &location )
+{
+  if ( location.isValid() ) {
+    q->setToLocation( location );
+  } else {
+    Location *locationPtr = qobject_cast<Location*>(sender());
+    if ( locationPtr ) {
+      q->setToLocation( *locationPtr );
+      if ( q->fromValid() ) {
+        getRoute();
+      }
+    }
+  }
+}
+
+const Location &Route::toLocation()
+{
+  return q->toLocation();
+}
+
diff --git a/zouba/route.h b/zouba/route.h
new file mode 100644 (file)
index 0000000..badebda
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef ROUTE_H
+#define ROUTE_H
+
+#include "routedata.h"
+#include "location.h"
+
+#include <QObject>
+#include <QNetworkReply>
+#include <QNetworkAccessManager>
+
+class RoutePrivate;
+
+class Route: public QObject
+{
+  Q_OBJECT
+
+public:
+  Route();
+  ~Route();
+
+  Q_PROPERTY(Location fromLocation READ fromLocation WRITE setFromLocation);
+  Q_PROPERTY(Location toLocation READ toLocation WRITE setToLocation);
+
+  /*!
+    * \brief Gets the route data from the server
+    */
+  void getRoute();
+
+  /*!
+    \brief Get the from location
+    \return The from location
+    */
+  const Location &fromLocation();
+
+  /*!
+    \brief Get the to location
+    \return The to location
+    */
+  const Location &toLocation();
+
+public Q_SLOTS:
+
+  /*!
+    * \brief Sets the from location
+    * \param fromLocation The from location
+    */
+  void setFromLocation( const Location &location=Location() );
+
+  /*!
+    * \brief Sets the to location
+    * \param toLocation The to location
+    */
+  void setToLocation( const Location &location=Location() );
+
+Q_SIGNALS:
+  void routeReady( RouteData );
+
+private Q_SLOTS:
+  void replyFinished( QNetworkReply* );
+
+private:
+  RoutePrivate *q;
+  QNetworkAccessManager *manager;
+};
+#endif // ROUTE_H
diff --git a/zouba/route_p.cpp b/zouba/route_p.cpp
new file mode 100644 (file)
index 0000000..f2cb747
--- /dev/null
@@ -0,0 +1,105 @@
+#include "route_p.h"
+#include "location.h"
+
+#include <QXmlStreamReader>
+#include <QDebug>
+
+RoutePrivate::RoutePrivate( QObject *parent ) :
+    m_fromValid(false),
+    m_toValid(false),
+    m_fromLocation(0,0),
+    m_toLocation(0,0)
+{
+  Q_UNUSED( parent )
+}
+
+RoutePrivate::~RoutePrivate()
+{
+}
+
+RouteData RoutePrivate::parseReply( const QByteArray &reply )
+{
+  RouteData retVal;
+
+  QXmlStreamReader xml( reply );
+
+  bool inLine = false;
+  bool inStop = false;
+  while ( !xml.atEnd() ) {
+    xml.readNext();
+    if ( xml.isStartElement() && xml.name() == "LINE" ) {
+      QString lineCode( xml.attributes().value("code").toString() );
+
+      retVal.lineCode = parseJORECode( lineCode );
+
+      inLine = true;
+    } else
+    if ( inLine && xml.name() == "STOP" ) {
+      inStop = true;
+    } else
+    if ( inLine && inStop && xml.name() == "ARRIVAL" ) {
+      QString arrivalTime( xml.attributes().value("time").toString() );
+
+      retVal.arrivalTime = arrivalTime;
+
+      inLine = false;
+    } else
+    if ( xml.isEndElement() && xml.name() == "STOP" ) {
+      inStop = false;
+    } else
+    if ( xml.isEndElement() && xml.name() == "LINE" ) {
+      inLine = false;
+    }
+  }
+
+  if ( xml.hasError() ) {
+    qDebug() << "xml error";
+  }
+
+  return retVal;
+}
+
+void RoutePrivate::setFromLocation( const Location &location )
+{
+  m_fromLocation = location;
+  m_fromValid = true;
+}
+
+const Location &RoutePrivate::fromLocation()
+{
+  return m_fromLocation;
+}
+
+void RoutePrivate::setToLocation( const Location &toLocation )
+{
+  m_toLocation = toLocation;
+  m_toValid = true;
+}
+
+QString RoutePrivate::parseJORECode( const QString &joreCode ) const
+{
+    QString areaTransportTypeCode( joreCode.mid(0,1) );
+    QString lineCode( joreCode.mid(1,3) );
+    QString letterVariant( joreCode.mid(4,1) );
+    QString letterNumberVariant( joreCode.mid(5,1) );
+    QString direction( joreCode.mid(6,1) );
+
+    lineCode.setNum( lineCode.toInt() );
+    
+    return lineCode+letterVariant;
+}
+
+const Location &RoutePrivate::toLocation()
+{
+  return m_toLocation;
+}
+
+bool RoutePrivate::fromValid()
+{
+  return m_fromValid;
+}
+
+bool RoutePrivate::toValid()
+{
+  return m_toValid;
+}
diff --git a/zouba/route_p.h b/zouba/route_p.h
new file mode 100644 (file)
index 0000000..836a4a7
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef ROUTE_P_H
+#define ROUTE_P_H
+
+#include "routedata.h"
+
+#include "location.h"
+
+#include <QObject>
+
+class RoutePrivate: public QObject
+{
+  Q_OBJECT
+
+public:
+  RoutePrivate( QObject *parent=0 );
+  ~RoutePrivate();
+
+  Q_PROPERTY(Location fromLocation READ fromLocation WRITE setFromLocation);
+  Q_PROPERTY(Location toLocation READ toLocation WRITE setFromLocation);
+
+  RouteData parseReply( const QByteArray &reply );
+
+  void setFromLocation( const Location &fromLocation );
+
+  const Location &fromLocation();
+
+  void setToLocation( const Location &toLocation );
+
+  const Location &toLocation();
+
+  bool toValid();
+  bool fromValid();
+
+private:
+  bool     m_fromValid;
+  bool     m_toValid;
+  Location m_fromLocation;
+  Location m_toLocation;
+
+  QString parseJORECode( const QString &joreCode ) const;
+};
+#endif // ROUTE_P_H
diff --git a/zouba/routedata.h b/zouba/routedata.h
new file mode 100644 (file)
index 0000000..a2abd31
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef ROUTEDATA_H
+#define ROUTEDATA_H
+
+#include <QString>
+
+struct RouteData
+{
+  QString lineCode;
+  QString arrivalTime;
+};
+
+#endif // ROUTEDATA_H
diff --git a/zouba/tests/ut_location/ut_location.cpp b/zouba/tests/ut_location/ut_location.cpp
new file mode 100644 (file)
index 0000000..85228b2
--- /dev/null
@@ -0,0 +1,54 @@
+#include <QObject>
+#include <QtDebug>
+#include <QByteArray>
+#include "ut_location.h"
+
+QByteArray sampleInput(
+"\
+<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?><MTRXML version=\"1.0\">\
+<GEOCODE key=\"taivaanvuohentie 7,helsinki\">\
+<LOC name1=\"Taivaanvuohentie\" number=\"7\" city=\"Helsinki\" code=\"\" address=\"\" type=\"900\" category=\"street\" x=\"2549183\" y=\"6672570\" lon=\"24.88256\" lat=\"60.16183\" />\
+</GEOCODE>\
+</MTRXML>\
+"
+
+);
+
+void Ut_Location::init()
+{
+    m_subject = new LocationPrivate();
+}
+
+void Ut_Location::cleanup()
+{
+    delete m_subject;
+    m_subject = 0;
+}
+
+void Ut_Location::initTestCase()
+{
+}
+
+void Ut_Location::cleanupTestCase()
+{
+}
+
+void Ut_Location::testParseReply()
+{
+  m_subject->parseReply( sampleInput );
+
+  QCOMPARE( m_subject->x(), QString( "2549183" ) );
+  QCOMPARE( m_subject->y(), QString( "6672570" ) );
+}
+
+void Ut_Location::testSet()
+{
+  QString x( "2549183" );
+  QString y( "6672570" );
+  m_subject->setX( x );
+  m_subject->setY( y );
+  QCOMPARE( x, m_subject->x() );
+  QCOMPARE( y, m_subject->y() );
+}
+
+QTEST_MAIN(Ut_Location)
diff --git a/zouba/tests/ut_location/ut_location.h b/zouba/tests/ut_location/ut_location.h
new file mode 100644 (file)
index 0000000..1b44ace
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef UT_LOCATION_H
+#define UT_LOCATION_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+#include <location_p.h>
+
+Q_DECLARE_METATYPE(LocationPrivate*);
+
+class Ut_Location : public QObject
+{
+    Q_OBJECT
+
+public:
+
+private slots:
+    void init();
+    void cleanup();
+    void initTestCase();
+    void cleanupTestCase();
+    void testParseReply();
+    void testSet();
+
+private:
+    LocationPrivate *m_subject;
+};
+#endif // UT_LOCATION_H
diff --git a/zouba/tests/ut_location/ut_location.pro b/zouba/tests/ut_location/ut_location.pro
new file mode 100644 (file)
index 0000000..8d8ba3c
--- /dev/null
@@ -0,0 +1,20 @@
+CONFIG += \
+  qt \
+  debug \
+
+QT += \
+  testlib \
+
+INCLUDEPATH += \
+  ../.. \
+
+TEMPLATE = app
+
+SOURCES  = \
+  ut_location.cpp \
+  ../../location_p.cpp \
+
+HEADERS += \
+  ut_location.h \
+  ../../location_p.h \
+
diff --git a/zouba/tests/ut_route/ut_route.cpp b/zouba/tests/ut_route/ut_route.cpp
new file mode 100644 (file)
index 0000000..294c1c0
--- /dev/null
@@ -0,0 +1,385 @@
+#include <QObject>
+#include <QtDebug>
+#include <QByteArray>
+#include "ut_route.h"
+
+QByteArray sampleInput(
+"\
+<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\
+<MTRXML version=\"1.0\">\
+       <ROUTE from=\"start\" to=\"dest\">\
+               <LENGTH time=\"14.411\" dist=\"2510.063\"/>\
+               <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+                       <ARRIVAL date=\"20100207\" time=\"1815\"/>\
+                       <DEPARTURE date=\"20100207\" time=\"1815\"/>\
+               </POINT>\
+               <WALK>\
+                       <LENGTH time=\"4.475\" dist=\"357.069\"/>\
+                       <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1815\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1815\"/>\
+                       </POINT>\
+                       <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1816\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1816\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
+                               <ARRIVAL date=\"20100207\" time=\"1817\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1817\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1817\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1817\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1819\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1819\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
+                               <ARRIVAL date=\"20100207\" time=\"1820\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1820\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <STOP code=\"6:1201129\" x=\"2550765.0\" y=\"6672886.0\" id=\"745\">\
+                               <ARRIVAL date=\"20100207\" time=\"1820\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1820\"/>\
+                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+                               <NAME lang=\"2\" val=\"Västerleden\"/>\
+                       </STOP>\
+               </WALK>\
+               <LINE id=\"200\" code=\"1065A 2\" type=\"1\" mobility=\"3\">\
+                       <LENGTH time=\"5.000\" dist=\"1760.931\"/>\
+                       <STOP code=\"6:1201129\" x=\"2550765.0\" y=\"6672886.0\" id=\"745\" ord=\"30\">\
+                               <ARRIVAL date=\"20100207\" time=\"1820\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1820\"/>\
+                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+                               <NAME lang=\"2\" val=\"Västerleden\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1201131\" x=\"2550385.0\" y=\"6672760.0\" id=\"747\">\
+                               <ARRIVAL date=\"20100207\" time=\"1821\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1821\"/>\
+                               <NAME lang=\"1\" val=\"Salmisaari\"/>\
+                               <NAME lang=\"2\" val=\"Sundholmen\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1310101\" x=\"2549608.0\" y=\"6672522.0\" id=\"1356\">\
+                               <ARRIVAL date=\"20100207\" time=\"1824\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1824\"/>\
+                               <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
+                               <NAME lang=\"2\" val=\"Drumsö bro\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1310103\" x=\"2549247.0\" y=\"6672446.0\" id=\"1358\" ord=\"33\">\
+                               <ARRIVAL date=\"20100207\" time=\"1825\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1825\"/>\
+                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+                       </STOP>\
+               </LINE>\
+               <WALK>\
+                       <LENGTH time=\"4.936\" dist=\"392.062\"/>\
+                       <STOP code=\"6:1310103\" x=\"2549247.0\" y=\"6672446.0\" id=\"1358\">\
+                               <ARRIVAL date=\"20100207\" time=\"1825\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1825\"/>\
+                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+                       </STOP>\
+                       <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1825\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1825\"/>\
+                               <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1827\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1827\"/>\
+                               <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1828\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1828\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1828\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1828\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+                       </MAPLOC>\
+                       <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+                       </POINT>\
+               </WALK>\
+               <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+                       <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+                       <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+               </POINT>\
+       </ROUTE>\
+       <ROUTE from=\"start\" to=\"dest\">\
+               <LENGTH time=\"13.411\" dist=\"2501.497\"/>\
+               <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+                       <ARRIVAL date=\"20100207\" time=\"1821\"/>\
+                       <DEPARTURE date=\"20100207\" time=\"1821\"/>\
+               </POINT>\
+               <WALK>\
+                       <LENGTH time=\"4.475\" dist=\"357.069\"/>\
+                       <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1821\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1821\"/>\
+                       </POINT>\
+                       <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1822\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1822\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
+                               <ARRIVAL date=\"20100207\" time=\"1823\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1823\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1823\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1823\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1825\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1825\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
+                               <ARRIVAL date=\"20100207\" time=\"1826\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1826\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\">\
+                               <ARRIVAL date=\"20100207\" time=\"1826\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1826\"/>\
+                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+                               <NAME lang=\"2\" val=\"Västerleden\"/>\
+                       </STOP>\
+               </WALK>\
+               <LINE id=\"579\" code=\"2102T 1\" type=\"5\" mobility=\"3\">\
+                       <LENGTH time=\"4.000\" dist=\"1751.582\"/>\
+                       <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\" ord=\"3\">\
+                               <ARRIVAL date=\"20100207\" time=\"1826\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1826\"/>\
+                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+                               <NAME lang=\"2\" val=\"Västerleden\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1201231\" x=\"2550387.0\" y=\"6672761.0\" id=\"759\">\
+                               <ARRIVAL date=\"20100207\" time=\"1827\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1827\"/>\
+                               <NAME lang=\"1\" val=\"Salmisaari\"/>\
+                               <NAME lang=\"2\" val=\"Sundholmen\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1310201\" x=\"2549630.0\" y=\"6672524.0\" id=\"1402\">\
+                               <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+                               <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
+                               <NAME lang=\"2\" val=\"Drumsö bro\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\" ord=\"6\">\
+                               <ARRIVAL date=\"20100207\" time=\"1830\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1830\"/>\
+                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+                       </STOP>\
+               </LINE>\
+               <WALK>\
+                       <LENGTH time=\"4.936\" dist=\"392.846\"/>\
+                       <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\">\
+                               <ARRIVAL date=\"20100207\" time=\"1830\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1830\"/>\
+                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+                       </STOP>\
+                       <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1830\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1830\"/>\
+                               <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1832\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1832\"/>\
+                               <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1833\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1833\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1833\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1833\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+                       </MAPLOC>\
+                       <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+                       </POINT>\
+               </WALK>\
+               <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+                       <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+                       <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+               </POINT>\
+       </ROUTE>\
+       <ROUTE from=\"start\" to=\"dest\">\
+               <LENGTH time=\"13.411\" dist=\"2501.497\"/>\
+               <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+                       <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+                       <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+               </POINT>\
+               <WALK>\
+                       <LENGTH time=\"4.475\" dist=\"357.069\"/>\
+                       <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+                       </POINT>\
+                       <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1830\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1830\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
+                               <ARRIVAL date=\"20100207\" time=\"1831\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1831\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1831\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1831\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
+                               <ARRIVAL date=\"20100207\" time=\"1833\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1833\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
+                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+                               <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+                       </MAPLOC>\
+                       <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\">\
+                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+                               <NAME lang=\"2\" val=\"Västerleden\"/>\
+                       </STOP>\
+               </WALK>\
+               <LINE id=\"603\" code=\"2110T 1\" type=\"5\" mobility=\"3\">\
+                       <LENGTH time=\"4.000\" dist=\"1751.582\"/>\
+                       <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\" ord=\"3\">\
+                               <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+                               <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+                               <NAME lang=\"2\" val=\"Västerleden\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1201231\" x=\"2550387.0\" y=\"6672761.0\" id=\"759\">\
+                               <ARRIVAL date=\"20100207\" time=\"1835\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1835\"/>\
+                               <NAME lang=\"1\" val=\"Salmisaari\"/>\
+                               <NAME lang=\"2\" val=\"Sundholmen\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1310201\" x=\"2549630.0\" y=\"6672524.0\" id=\"1402\">\
+                               <ARRIVAL date=\"20100207\" time=\"1837\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1837\"/>\
+                               <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
+                               <NAME lang=\"2\" val=\"Drumsö bro\"/>\
+                       </STOP>\
+                       <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\" ord=\"6\">\
+                               <ARRIVAL date=\"20100207\" time=\"1838\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1838\"/>\
+                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+                       </STOP>\
+               </LINE>\
+               <WALK>\
+                       <LENGTH time=\"4.936\" dist=\"392.846\"/>\
+                       <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\">\
+                               <ARRIVAL date=\"20100207\" time=\"1838\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1838\"/>\
+                               <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+                               <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+                       </STOP>\
+                       <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1838\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1838\"/>\
+                               <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1840\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1840\"/>\
+                               <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1841\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1841\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1841\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1841\"/>\
+                       </MAPLOC>\
+                       <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1842\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1842\"/>\
+                       </MAPLOC>\
+                       <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+                               <ARRIVAL date=\"20100207\" time=\"1842\"/>\
+                               <DEPARTURE date=\"20100207\" time=\"1842\"/>\
+                       </POINT>\
+               </WALK>\
+               <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+                       <ARRIVAL date=\"20100207\" time=\"1842\"/>\
+                       <DEPARTURE date=\"20100207\" time=\"1842\"/>\
+               </POINT>\
+       </ROUTE>\
+</MTRXML>\
+"
+
+);
+
+void Ut_Route::init()
+{
+    m_subject = new RoutePrivate();
+}
+
+void Ut_Route::cleanup()
+{
+    delete m_subject;
+    m_subject = 0;
+}
+
+void Ut_Route::initTestCase()
+{
+}
+
+void Ut_Route::cleanupTestCase()
+{
+}
+
+void Ut_Route::testParseReply()
+{
+  RouteData routeData = m_subject->parseReply( sampleInput );
+
+  QCOMPARE( routeData.lineCode, QString( "110T" ) );
+  QCOMPARE( routeData.arrivalTime, QString( "1834" ) );
+}
+
+void Ut_Route::testSetFromLocation()
+{
+  Location work( "2551042", "6672829" );
+  m_subject->setFromLocation( work );
+  QCOMPARE( work.x(), m_subject->fromLocation().x() );
+  QCOMPARE( work.y(), m_subject->fromLocation().y() );
+}
+
+void Ut_Route::testSetToLocation()
+{
+  Location work( "2551042", "6672829" );
+  m_subject->setToLocation( work );
+  QCOMPARE( work.x(), m_subject->toLocation().x() );
+  QCOMPARE( work.y(), m_subject->toLocation().y() );
+}
+
+QTEST_MAIN(Ut_Route)
diff --git a/zouba/tests/ut_route/ut_route.h b/zouba/tests/ut_route/ut_route.h
new file mode 100644 (file)
index 0000000..8571d3b
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef UT_ROUTE_H
+#define UT_ROUTE_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+#include <route_p.h>
+
+Q_DECLARE_METATYPE(RoutePrivate*);
+
+class Ut_Route : public QObject
+{
+    Q_OBJECT
+
+public:
+
+private slots:
+    void init();
+    void cleanup();
+    void initTestCase();
+    void cleanupTestCase();
+    void testParseReply();
+    void testSetFromLocation();
+    void testSetToLocation();
+
+private:
+    RoutePrivate *m_subject;
+};
+#endif // UT_ROUTE_H
diff --git a/zouba/tests/ut_route/ut_route.pro b/zouba/tests/ut_route/ut_route.pro
new file mode 100644 (file)
index 0000000..4b697df
--- /dev/null
@@ -0,0 +1,25 @@
+CONFIG += \
+  qt \
+  debug \
+
+QT += \
+  testlib \
+  network \
+
+INCLUDEPATH += \
+  ../.. \
+
+TEMPLATE = app
+
+SOURCES  = \
+  ut_route.cpp \
+  ../../route_p.cpp \
+  ../../location.cpp \
+  ../../location_p.cpp \
+
+HEADERS += \
+  ut_route.h \
+  ../../route_p.h \
+  ../../location.h \
+  ../../location_p.h \
+
diff --git a/zouba/uicontroller.cpp b/zouba/uicontroller.cpp
new file mode 100644 (file)
index 0000000..f389d66
--- /dev/null
@@ -0,0 +1,18 @@
+#include "uicontroller.h"
+#include "route.h"
+#include "ui_zouba.h"
+
+UiController::UiController( Ui::MainWindow *ui ) :
+  ui(ui)
+{
+}
+
+UiController::~UiController()
+{
+}
+
+void UiController::displayRoute( const RouteData &routeData )
+{
+  ui->BusNoDisplay->setText( routeData.lineCode );
+  ui->TimeDisplay->setText( routeData.arrivalTime );
+}
diff --git a/zouba/uicontroller.h b/zouba/uicontroller.h
new file mode 100644 (file)
index 0000000..0ea3010
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef UICONTROLLER_H
+#define UICONTROLLER_H
+
+#include "ui_zouba.h"
+#include "routedata.h"
+
+#include <QObject>
+
+class UiController : public QObject
+{
+  Q_OBJECT
+
+public:
+  UiController( Ui::MainWindow *ui );
+  ~UiController();
+
+public Q_SLOTS:
+  void displayRoute( const RouteData &routeData );
+
+private:
+  Ui::MainWindow *ui;
+};
+#endif // UICONTROLLER_H
+
diff --git a/zouba/ytv.h b/zouba/ytv.h
new file mode 100644 (file)
index 0000000..658262f
--- /dev/null
@@ -0,0 +1,13 @@
+
+#include <QUrl>
+#include <QString>
+
+namespace {
+  QUrl ytv( "http://api.reittiopas.fi/public-ytv/fi/api/" );
+  QString username( "zouba" );
+  QString password( "caf9r3ee" );
+
+  QString homeKey( "taivaanvuohentie%207%2Chelsinki" );
+  QString workKey( "it%E4merenkatu%2011%2Chelsinki" );
+}
+
diff --git a/zouba/zouba.pro b/zouba/zouba.pro
new file mode 100644 (file)
index 0000000..4c32159
--- /dev/null
@@ -0,0 +1,25 @@
+CONFIG += \
+  qt \
+  debug \
+
+QT += \
+  network \
+
+TEMPLATE = app
+FORMS    = zouba.ui
+
+SOURCES  = \
+  main.cpp \
+  route.cpp \
+  route_p.cpp \
+  uicontroller.cpp \
+  location.cpp \
+  location_p.cpp \
+
+HEADERS += \
+  route.h \
+  route_p.h \
+  uicontroller.h \
+  location.h \
+  location_p.h \
+
diff --git a/zouba/zouba.ui b/zouba/zouba.ui
new file mode 100644 (file)
index 0000000..6eaa8b6
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>640</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>ZuoBa</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QWidget" name="verticalLayoutWidget">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>0</y>
+      <width>230</width>
+      <height>82</height>
+     </rect>
+    </property>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <layout class="QFormLayout" name="formLayout">
+       <property name="fieldGrowthPolicy">
+        <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+       </property>
+       <item row="1" column="0">
+        <widget class="QLabel" name="TimeLabel">
+         <property name="text">
+          <string>Time</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QLabel" name="TimeDisplay">
+         <property name="text">
+          <string>TimeDisplay</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0">
+        <widget class="QLabel" name="BusNoLabel">
+         <property name="text">
+          <string>BusNo</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QLabel" name="BusNoDisplay">
+         <property name="text">
+          <string>BusNoDisplay</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="0" colspan="2">
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QPushButton" name="pushButton_2">
+           <property name="text">
+            <string>Work</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButton">
+           <property name="text">
+            <string>Home</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>640</width>
+     <height>25</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>