Merge branch 'getmehome'
authorAki Koskinen <maemo@akikoskinen.info>
Wed, 3 Mar 2010 20:12:43 +0000 (22:12 +0200)
committerAki Koskinen <maemo@akikoskinen.info>
Wed, 3 Mar 2010 20:12:43 +0000 (22:12 +0200)
29 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/httpclient.cpp [deleted file]
zouba/qt/httpclient.h [deleted file]
zouba/qt/main.cpp [deleted file]
zouba/qt/output.xml [deleted file]
zouba/qt/qt.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..2ffa63f
--- /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().toPercentEncoding() );
+  fullUrl.addQueryItem( "user", username );
+  fullUrl.addQueryItem( "pass", password );
+
+  manager->get( QNetworkRequest( fullUrl ) );
+}
+
+void Location::replyFinished( QNetworkReply * reply )
+{
+  q->parseReply( reply->readAll() );
+
+  if ( 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..018d578
--- /dev/null
@@ -0,0 +1,43 @@
+#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();
+
+  QString x() const;
+
+  QString y() const;
+
+  bool isValid() const;
+
+public Q_SLOTS:
+  void resolveAddress( QString address );
+
+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..8eac5e0
--- /dev/null
@@ -0,0 +1,75 @@
+#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";
+    m_valid = false;
+  } 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..277faf1
--- /dev/null
@@ -0,0 +1,65 @@
+#include "routedata.h"
+#include "route.h"
+#include "ui_zouba.h"
+#include "uicontroller.h"
+#include "location.h"
+
+#include "ytv.h"
+
+#include <QDebug>
+#include <QObject>
+
+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() )
+      );
+
+  ui.homeaddress->setText( home );
+  ui.workaddress->setText( work );
+
+  from->resolveAddress( home );
+  to->resolveAddress( work );
+
+  QObject::connect(
+      uiController, SIGNAL( homeAddressChanged( QString ) ),
+      from, SLOT( resolveAddress( QString ) )
+    );
+
+  QObject::connect(
+      uiController, SIGNAL( workAddressChanged( QString ) ),
+      to, SLOT( resolveAddress( QString ) )
+    );
+
+  /* toggle doesn't work yet because 'from' is connected to 'homeAddressChanged'
+  QObject::connect(
+      uiController, SIGNAL( directionChanged() ),
+      route, SLOT( toggleDirection() )
+    );
+    */
+
+  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/httpclient.cpp b/zouba/qt/httpclient.cpp
deleted file mode 100644 (file)
index 8a66c95..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-#include "httpclient.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" );
-
-  QString workX( "2551042" );
-  QString workY( "6672829" );
-  QString homeX( "2549183" );
-  QString homeY( "6672570" );
-}
-  
-HttpClient::HttpClient( Ui::MainWindow *ui ) :
-  manager( new QNetworkAccessManager(this) ),
-  ui( ui )
-{
-  connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
-}
-
-HttpClient::~HttpClient()
-{
-  delete manager;
-  manager = 0;
-}
-
-void HttpClient::get()
-{
-  QUrl fullUrl( ytv );
-
-  QStringList a;
-  a << workX << workY;
-  QStringList b;
-  b << homeX << homeY;
-
-  fullUrl.addQueryItem( "a", a.join(",") );
-  fullUrl.addQueryItem( "b", b.join(",") );
-  fullUrl.addQueryItem( "user", username );
-  fullUrl.addQueryItem( "pass", password );
-
-  manager->get( QNetworkRequest( fullUrl ) );
-}
-
-void HttpClient::replyFinished( QNetworkReply * reply )
-{
-  QXmlStreamReader xml( reply->readAll() );
-
-  bool inLine = false;
-  bool inStop = false;
-  while ( !xml.atEnd() ) {
-    xml.readNext();
-    //qDebug() << xml.name();
-    if ( xml.isStartElement() && xml.name() == "LINE" ) {
-      QString lineCode( xml.attributes().value("code").toString() );
-
-      qDebug() << "line code" << lineCode;
-      ui->BusNoDisplay->setText( 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() );
-
-      qDebug() << "arrival time" << arrivalTime;
-      ui->TimeDisplay->setText( 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";
-  }
-}
diff --git a/zouba/qt/httpclient.h b/zouba/qt/httpclient.h
deleted file mode 100644 (file)
index 28aa9bf..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef HTTPCLIENT_H
-#define HTTPCLIENT_H
-
-#include "ui_zouba.h"
-
-#include <QObject>
-#include <QNetworkReply>
-#include <QNetworkAccessManager>
-
-class HttpClient: public QObject
-{
-  Q_OBJECT
-
-public:
-  HttpClient( Ui::MainWindow *ui );
-  ~HttpClient();
-
-  void get();
-
-public Q_SLOTS:
-  void replyFinished(QNetworkReply*);
-
-private:
-  QNetworkAccessManager *manager;
-  Ui::MainWindow *ui;
-};
-#endif // HTTPCLIENT_H
diff --git a/zouba/qt/main.cpp b/zouba/qt/main.cpp
deleted file mode 100644 (file)
index 8d3f976..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "httpclient.h"
-#include "ui_zouba.h"
-
-#include <QDebug>
-
-int main(int argc, char *argv[] )
-{
-  QApplication app(argc, argv);
-  QMainWindow *widget = new QMainWindow;
-  Ui::MainWindow ui;
-  ui.setupUi(widget);
-
-  HttpClient httpClient( &ui );
-
-  httpClient.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 48c03b7..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-CONFIG += \
-  qt \
-
-QT += \
-  network \
-
-TEMPLATE = app
-FORMS    = zouba.ui
-
-SOURCES  = \
-  main.cpp \
-  httpclient.cpp \
-
-HEADERS += \
-  httpclient.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..5356702
--- /dev/null
@@ -0,0 +1,102 @@
+#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();
+}
+
+void Route::toggleDirection()
+{
+  Location oldFromLocation = fromLocation();
+  setFromLocation( toLocation() );
+  setToLocation( oldFromLocation );
+
+  getRoute();
+}
diff --git a/zouba/route.h b/zouba/route.h
new file mode 100644 (file)
index 0000000..139b67f
--- /dev/null
@@ -0,0 +1,70 @@
+#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() );
+
+  /*!
+    * \brief Toggles the route direction.
+    */
+  void toggleDirection();
+
+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..0c07b8e
--- /dev/null
@@ -0,0 +1,22 @@
+CONFIG += \
+  qt \
+  debug \
+
+QT += \
+  testlib \
+
+INCLUDEPATH += \
+  ../.. \
+
+DEPENDPATH += $$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..3b6a4d7
--- /dev/null
@@ -0,0 +1,27 @@
+CONFIG += \
+  qt \
+  debug \
+
+QT += \
+  testlib \
+  network \
+
+INCLUDEPATH += \
+  ../.. \
+
+DEPENDPATH += $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..3a0fd65
--- /dev/null
@@ -0,0 +1,48 @@
+#include "uicontroller.h"
+#include "route.h"
+#include "ui_zouba.h"
+
+UiController::UiController( Ui::MainWindow *ui ) :
+  ui(ui),
+  route( HomeToWork )
+{
+  connect( ui->sethomeaddress, SIGNAL( pressed() ), this, SLOT( setHomeAddress() ) );
+  connect( ui->setworkaddress, SIGNAL( pressed() ), this, SLOT( setWorkAddress() ) );
+  connect( ui->route, SIGNAL( pressed() ), this, SLOT( toggleRoute() ) );
+}
+
+UiController::~UiController()
+{
+}
+
+void UiController::setHomeAddress()
+{
+  emit homeAddressChanged( ui->homeaddress->text() );
+}
+
+void UiController::setWorkAddress()
+{
+  emit workAddressChanged( ui->workaddress->text() );
+}
+
+void UiController::toggleRoute()
+{
+  if ( route == HomeToWork ) {
+    route = WorkToHome;
+    ui->route->setText( "Home<-Work" );
+  } else {
+    route = HomeToWork;
+    ui->route->setText( "Home->Work" );
+  }
+
+  ui->busnodisplay->setText( "working" );
+  ui->timedisplay->setText( "working" );
+
+  emit directionChanged();
+}
+
+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..392962d
--- /dev/null
@@ -0,0 +1,40 @@
+#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 );
+
+Q_SIGNALS:
+  void homeAddressChanged( QString );
+  void workAddressChanged( QString );
+  void directionChanged();
+
+private Q_SLOTS:
+  void setHomeAddress();
+  void setWorkAddress();
+  void toggleRoute();
+
+private:
+  Ui::MainWindow *ui;
+  enum Direction {
+    WorkToHome,
+    HomeToWork
+  };
+
+  Direction route;
+};
+#endif // UICONTROLLER_H
+
diff --git a/zouba/ytv.h b/zouba/ytv.h
new file mode 100644 (file)
index 0000000..16915f0
--- /dev/null
@@ -0,0 +1,13 @@
+
+#include <QUrl>
+#include <QString>
+
+namespace {
+  const QString ytv( "http://api.reittiopas.fi/public-ytv/fi/api/" );
+  const QString username( "zouba" );
+  const QString password( "caf9r3ee" );
+
+  const QString home( QByteArray::fromPercentEncoding( "Taivaanvuohentie%207%2CHelsinki" ) );
+  const QString work( QByteArray::fromPercentEncoding( "It%E4merenkatu%2011%2CHelsinki" ) );
+}
+
diff --git a/zouba/zouba.pro b/zouba/zouba.pro
new file mode 100644 (file)
index 0000000..5f5f9f2
--- /dev/null
@@ -0,0 +1,17 @@
+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 \
+    ytv.h
diff --git a/zouba/zouba.ui b/zouba/zouba.ui
new file mode 100644 (file)
index 0000000..f878bc5
--- /dev/null
@@ -0,0 +1,132 @@
+<?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>386</width>
+    <height>265</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>ZuoBa</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QPushButton" name="sethomeaddress">
+    <property name="geometry">
+     <rect>
+      <x>220</x>
+      <y>120</y>
+      <width>151</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Set Home</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="setworkaddress">
+    <property name="geometry">
+     <rect>
+      <x>220</x>
+      <y>190</y>
+      <width>151</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Set Work</string>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="homeaddress">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>110</y>
+      <width>201</width>
+      <height>61</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="workaddress">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>180</y>
+      <width>201</width>
+      <height>61</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLabel" name="busnolabel">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>80</y>
+      <width>151</width>
+      <height>21</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>BusNo</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="busnodisplay">
+    <property name="geometry">
+     <rect>
+      <x>170</x>
+      <y>80</y>
+      <width>187</width>
+      <height>18</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>BusNoDisplay</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="timedisplay">
+    <property name="geometry">
+     <rect>
+      <x>170</x>
+      <y>50</y>
+      <width>187</width>
+      <height>18</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>TimeDisplay</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="timelabel">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>50</y>
+      <width>141</width>
+      <height>21</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Time</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="route">
+    <property name="geometry">
+     <rect>
+      <x>80</x>
+      <y>0</y>
+      <width>224</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Home-&gt;Work</string>
+    </property>
+   </widget>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>