Merge branch 'nikosmaster' old-master
authorNiko Böckerman <niko.bockerman@gmail.com>
Sun, 30 Jan 2011 00:02:36 +0000 (02:02 +0200)
committerNiko Böckerman <niko.bockerman@gmail.com>
Sun, 30 Jan 2011 00:02:36 +0000 (02:02 +0200)
17 files changed:
zouba/src/addressdialog.cpp [deleted file]
zouba/src/addressdialog.h [deleted file]
zouba/src/gpscontroller.cpp [deleted file]
zouba/src/gpscontroller.h [deleted file]
zouba/src/locationbutton.cpp [deleted file]
zouba/src/locationbutton.h [deleted file]
zouba/src/locationsdisplay.cpp [deleted file]
zouba/src/locationsdisplay.h [deleted file]
zouba/src/route.cpp [deleted file]
zouba/src/route.h [deleted file]
zouba/src/route_p.cpp [deleted file]
zouba/src/route_p.h [deleted file]
zouba/src/routedata.h [deleted file]
zouba/src/ui.cpp [deleted file]
zouba/src/ui.h [deleted file]
zouba/src/uicontroller.cpp [deleted file]
zouba/src/uicontroller.h [deleted file]

diff --git a/zouba/src/addressdialog.cpp b/zouba/src/addressdialog.cpp
deleted file mode 100644 (file)
index 662ec99..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-#include "addressdialog.h"\r
-#include "logic/location.h"\r
-#include "logic/ytv.h"\r
-#include "logic/locations.h"\r
-\r
-#include <QWidget>\r
-#include <QDialog>\r
-#include <QHBoxLayout>\r
-#include <QVBoxLayout>\r
-#include <QFormLayout>\r
-#include <QLineEdit>\r
-#include <QPushButton>\r
-#include <QXmlStreamReader>\r
-#include <QListWidget>\r
-#include <QDebug>\r
-#ifdef Q_WS_MAEMO_5\r
-#include <QMaemo5InformationBox>\r
-#endif\r
-\r
-AddressDialog::AddressDialog(QWidget *parent, const Location *location) :\r
-    QDialog(parent), m_reply(0), m_current(0)\r
-{\r
-    QHBoxLayout *layout = new QHBoxLayout();\r
-    this->setLayout(layout);\r
-    QFormLayout *editLayout = new QFormLayout();\r
-    layout->addLayout(editLayout);\r
-    QVBoxLayout *buttonLayout = new QVBoxLayout();\r
-    layout->addLayout(buttonLayout);\r
-\r
-    this->m_label = new QLineEdit();\r
-    this->m_address = new QLineEdit();\r
-    connect(this->m_address, SIGNAL(textEdited(const QString&)), this, SLOT(typedInAddress()));\r
-\r
-    editLayout->addRow("Name", this->m_label);\r
-    editLayout->addRow("Address", this->m_address);\r
-\r
-    this->m_addButton = new QPushButton("Add", this);\r
-    buttonLayout->addWidget(this->m_addButton);\r
-    connect(this->m_addButton, SIGNAL(clicked()), this, SLOT(addLocation()));\r
-    QPushButton *searchButton = new QPushButton("Search", this);\r
-    buttonLayout->addWidget(searchButton);\r
-    connect(searchButton, SIGNAL(clicked()), this, SLOT(searchAddress()));\r
-\r
-    // Set dialog as edit dialog if given location is not null.\r
-    if (location)\r
-    {\r
-        this->m_label->setText(location->label());\r
-        this->m_label->setEnabled(false);\r
-        this->m_address->setText(location->address());\r
-        //this->m_current = location;\r
-        this->m_addButton->setText("Edit");\r
-    }\r
-    \r
-    // Always set add button to disabled when creating new layout.\r
-    this->m_addButton->setEnabled(false);\r
-}\r
-\r
-void AddressDialog::searchAddress()\r
-{\r
-    emit(busy(true));\r
-    this->m_reply = Ytv::searchAddress(m_address->text());\r
-    connect(m_reply, SIGNAL(finished()), this, SLOT(searchFinished()));\r
-}\r
-\r
-void AddressDialog::searchFinished()\r
-{\r
-    qDebug() << "Parsing following xml:";\r
-    QXmlStreamReader xml(this->m_reply->readAll());\r
-    //Remove the reply. Hopefully also removes the connection.\r
-    //delete this->m_reply;\r
-    this->m_reply->deleteLater();\r
-    \r
-    bool responseHasError = false;\r
-    this->m_places = QList<Location*>();\r
-    this->m_roadNames = QList<Location*>();\r
-    this->m_stops = QList<Location*>();\r
-\r
-    while (!xml.atEnd())\r
-    {\r
-        qDebug() << "Reading next element";\r
-        xml.readNext();\r
-\r
-        if (xml.isStartElement())\r
-        {\r
-            QString xmlName(xml.name().toString());\r
-\r
-            if (xmlName == "LOC")\r
-            {\r
-                QXmlStreamAttributes attributes(xml.attributes());\r
-                QStringRef xAttribute( attributes.value("x") );\r
-                QStringRef yAttribute( attributes.value("y") );\r
-                QString newX( xAttribute.toString() );\r
-                QString newY( yAttribute.toString() );\r
-                QString category(attributes.value("category").toString());\r
-                QString name(attributes.value("name1").toString());\r
-                QString number(attributes.value("number").toString());\r
-                if (!number.isEmpty())\r
-                {\r
-                    name.append(" ");\r
-                    name.append(number);\r
-                }\r
-                name.append(", ");\r
-                name.append(attributes.value("city").toString());\r
-\r
-                if (category == "poi")\r
-                {\r
-                    m_places.append(new Location(newX, newY, name));\r
-                }\r
-                else if (category == "street")\r
-                {\r
-                    m_roadNames.append(new Location(newX, newY, name));\r
-                }\r
-                else if (category == "stop")\r
-                {\r
-                    m_stops.append(new Location(newX, newY, name));\r
-                }\r
-                else\r
-                {\r
-                    QString errorMessage("Unknown category: ");\r
-                    errorMessage.append(category);\r
-                    qDebug() << errorMessage;\r
-#ifdef Q_WS_MAEMO_5\r
-                    QMaemo5InformationBox::information(this, errorMessage);\r
-#endif\r
-                }\r
-            }\r
-\r
-            if (xmlName == "ERROR") {\r
-                responseHasError = true;\r
-            }\r
-\r
-        }\r
-    }\r
-\r
-    emit(busy(false));\r
-\r
-    qDebug() << xml.errorString();\r
-    if ( xml.hasError() || responseHasError ) {\r
-#ifdef Q_WS_MAEMO_5\r
-        QMaemo5InformationBox::information(this, "Invalid response received from Ytv.");\r
-#endif\r
-        qDebug() << "Invalid response received from Ytv";\r
-    } else {\r
-        // Case where no addresses are found.\r
-        if (m_places.size() + m_roadNames.size() + m_stops.size() == 0)\r
-        {\r
-#ifdef Q_WS_MAEMO_5\r
-            QMaemo5InformationBox::information(this, "No addresses were found with the given address.");\r
-#endif\r
-        }\r
-        // Case where addresses are found.\r
-        else        {\r
-            qDebug() << "Starting selection dialog";\r
-            AddressDialogSelection *selection = new AddressDialogSelection(this->m_places, this->m_roadNames, this->m_stops, this);\r
-            connect(selection, SIGNAL(locationSelected(Location*)), this, SLOT(locationSelected(Location*)));\r
-            selection->show();\r
-        }\r
-    }\r
-    //delete m_reply;\r
-    qDebug() << "Exiting xml parsing.";\r
-}\r
-\r
-void AddressDialog::typedInAddress()\r
-{\r
-    qDebug() << "Typed in address field signal detected.";\r
-    if (this->m_current != 0)\r
-    {\r
-        qDebug() << "Setting add button disabled and deleting current location.";\r
-        this->m_addButton->setEnabled(false);\r
-        delete this->m_current;\r
-        this->m_current = 0;\r
-    }\r
-}\r
-\r
-void AddressDialog::addLocation()\r
-{\r
-    this->m_current->setAddress(this->m_current->label());\r
-    this->m_current->setLabel(this->m_label->text());\r
-    Locations::GetInstance()->addEditLocation(this->m_current);\r
-    this->close();\r
-}\r
-\r
-void AddressDialog::locationSelected(Location* location)\r
-{\r
-    qDebug() << "Location selected and signal received. Setting add button enabled and correct text.";\r
-    if (location == 0)\r
-        qDebug() << "Null pointer received.";\r
-    this->m_current = location;\r
-    this->m_address->setText(this->m_current->label());\r
-    this->m_addButton->setEnabled(true);\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
-void populateList(QListWidget *widget, const QList<Location*>& list);\r
-\r
-AddressDialogSelection::AddressDialogSelection(const QList<Location*> &places, const QList<Location*> &roads, const QList<Location*> &stops, QWidget *parent) :\r
-        QDialog(parent),\r
-        m_places(places),\r
-        m_roads(roads),\r
-        m_stops(stops)\r
-{\r
-    QVBoxLayout *layout = new QVBoxLayout();\r
-    this->setLayout(layout);\r
-    QListWidget *list = new QListWidget(this);\r
-    layout->addWidget(list);\r
-    connect(list, SIGNAL(itemClicked(QListWidgetItem*)),\r
-            this, SLOT(itemSelected(QListWidgetItem*)));\r
-    if (this->m_places.size() > 0)\r
-    {\r
-        QListWidgetItem *item = new QListWidgetItem("Places", list);\r
-        item->setFlags(item->flags() & (~Qt::ItemIsEnabled));\r
-        populateList(list, m_places);\r
-    }\r
-\r
-    if (m_roads.size() > 0)\r
-    {\r
-        QListWidgetItem *item = new QListWidgetItem("Street names", list);\r
-        item->setFlags(item->flags() & (~Qt::ItemIsEnabled));\r
-        populateList(list, m_roads);\r
-    }\r
-\r
-    if (m_stops.size() > 0)\r
-    {\r
-        QListWidgetItem *item = new QListWidgetItem("Stops", list);\r
-        item->setFlags(item->flags() & (~Qt::ItemIsEnabled));\r
-        populateList(list, m_stops);\r
-    }\r
-\r
-}\r
-\r
-void populateList(QListWidget *widget, const QList<Location*>& list)\r
-{\r
-    QList<Location*>::const_iterator it, ite;\r
-    for (it = list.constBegin(), ite = list.constEnd(); it != ite; ++it)\r
-    {\r
-        new QListWidgetItem((*it)->label(), widget);\r
-    }\r
-}\r
-\r
-\r
-Location* foundFromList(const QString address, const QList<Location*>& list);\r
-\r
-void AddressDialogSelection::itemSelected(QListWidgetItem *item)\r
-{\r
-    qDebug() << "Item selected";\r
-    QString address = item->text();\r
-    Location *location = 0;\r
-    location = foundFromList(address, this->m_places);\r
-    if (!location)\r
-        location = foundFromList(address, this->m_roads);\r
-    if (!location)\r
-        location = foundFromList(address, this->m_stops);\r
-    if (location)\r
-    {\r
-        qDebug() << "Found location pointer: " << location;\r
-        emit(locationSelected(location));\r
-        this->close();\r
-    }\r
-}\r
-\r
-Location* foundFromList(const QString address, const QList<Location*>& list)\r
-{\r
-    Location* ret = 0;\r
-    QList<Location*>::const_iterator it, ite;\r
-    for (it = list.constBegin(), ite = list.constEnd(); it != ite && !ret; ++it)\r
-    {\r
-        if (address == (*it)->label())\r
-        {\r
-            qDebug() << "Found item from list: " << *it;\r
-            ret = new Location(**it);\r
-            qDebug() << "After assignment: " << ret;\r
-        }\r
-    }\r
-    return ret;\r
-}\r
diff --git a/zouba/src/addressdialog.h b/zouba/src/addressdialog.h
deleted file mode 100644 (file)
index dfe6a01..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef ADDRESSDIALOG_H
-#define ADDRESSDIALOG_H
-
-#include <QDialog>
-#include <QList>
-
-class Location;
-class QString;
-class QWidget;
-class QLineEdit;
-class QNetworkReply;
-class QListWidget;
-class QListWidgetItem;
-
-/* TODO: Layout
- * - Name and andress text input fields in a form layout on the left
- *   - Name text input field not enabled if editing an existing location
- * - Buttons on the right
- *   - Add button
- *     - Enabled if search once and no typing has been done to address
- *   - Search
- *     - Searches for the address in the address text input field
- */
-class AddressDialog : public QDialog
-{
-    Q_OBJECT
-public:
-    explicit AddressDialog(QWidget *parent = 0, const Location *location = 0);
-
-signals:
-    void busy(bool busy);
-
-public slots:
-    void searchFinished();
-    void locationSelected(Location* location);
-
-private slots:
-    void searchAddress();
-    void addLocation();
-    void typedInAddress();
-
-private:
-    QLineEdit *m_label;
-    QLineEdit *m_address;
-    QPushButton *m_addButton;
-
-    QNetworkReply *m_reply;
-
-    QList<Location*> m_places;
-    QList<Location*> m_roadNames;
-    QList<Location*> m_stops;
-    
-    Location* m_current;
-};
-
-
-
-/* TODO: Layout
- * - One list of found locations
- * - Clicking one selects the location
- * - If the clicked one is disabled, nothing happens (clicked signal might not be enabled so this needs to implemented only if selecting a heading line emits clicked signal
- * - When selected emits locationSelected(Location *location) signal with the selected locations copy.
- * - When selected calls close
- */
-class AddressDialogSelection : public QDialog
-{
-    Q_OBJECT
-public:
-    explicit AddressDialogSelection(const QList<Location*> &places, const QList<Location*> &roads, const QList<Location*> &stops, QWidget *parent = 0);
-
-signals:
-    void locationSelected(Location* location);
-    
-private slots:
-    void itemSelected(QListWidgetItem *item);
-
-private:
-  const QList<Location*>& m_places;
-  const QList<Location*>& m_roads;
-  const QList<Location*>& m_stops;
-};
-
-#endif // ADDRESSDIALOGNEW_H
diff --git a/zouba/src/gpscontroller.cpp b/zouba/src/gpscontroller.cpp
deleted file mode 100644 (file)
index f84cfc8..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "gpscontroller.h"
-#include "logic/locations.h"
-
-#include <QObject>
-#include <QGeoPositionInfo>
-#include <QGeoPositionInfoSource>
-#include <QDebug>
-
-GpsController::GpsController(bool started) :
-        m_gps(QGeoPositionInfoSource::createDefaultSource(this)),
-        m_started(started)
-{   
-    m_gps->setUpdateInterval(20000);
-    connect(m_gps, SIGNAL(positionUpdated(QGeoPositionInfo)),
-            this, SLOT(updateLocation(QGeoPositionInfo)));
-    connect(m_gps, SIGNAL(updateTimeout()),
-            this, SLOT(timeoutRequested()));
-    if (m_started) m_gps->startUpdates();
-}
-
-GpsController::~GpsController()
-{
-    delete m_gps;
-}
-
-void GpsController::useGPS( bool use)
-{
-    if (use) m_gps->startUpdates();
-    else m_gps->stopUpdates();
-}
-
-bool GpsController::isStarted() const
-{
-    return m_started;
-}
-
-QGeoPositionInfoSource *GpsController::gps() const
-{
-    return m_gps;
-}
-
-void GpsController::updateLocation( QGeoPositionInfo positionInfo )
-{
-    qDebug() << "GPS location update received";
-    Locations *locations = Locations::GetInstance();
-
-    //DEBUG
-    /*if (locations == 0)
-        qDebug() << "Null locations received from getInstance";
-    else
-        qDebug() << "Locations is not null";
-    Location* gpsLoc = locations->getGpsLocation();
-    if (gpsLoc == 0)
-        qDebug() << "Null gpsLocation received from locations";
-    else
-        qDebug() << "GPS location is not null.";*/
-    //DEBUG ENDED
-
-    locations->getGpsLocation()->setLocation(positionInfo);
-    //emit(gpsLocationChanged(m_location));
-}
-
-void GpsController::timeoutRequested()
-{
-    qDebug() << "GPS sent timeout requested.";
-}
diff --git a/zouba/src/gpscontroller.h b/zouba/src/gpscontroller.h
deleted file mode 100644 (file)
index 1f9e1d0..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef GPSCONTROLLER_H
-#define GPSCONTROLLER_H
-
-#include "logic/location.h"
-
-#include <QObject>
-#include <QGeoPositionInfo>
-#include <QGeoPositionInfoSource>
-
-QTM_USE_NAMESPACE;
-
-class Location;
-
-class GpsController : public QObject
-{
-    Q_OBJECT
-
-public:
-    GpsController(bool started = true);
-
-    ~GpsController();
-
-    QGeoPositionInfoSource *gps() const;
-    bool                    isStarted() const;
-
-public Q_SLOTS:
-    void useGPS( bool );
-
-Q_SIGNALS:
-    void gpsLocationChanged( Location *newLocation );
-
-private Q_SLOTS:
-    void updateLocation( QGeoPositionInfo positionInfo );
-    void timeoutRequested();
-
-private:
-    QGeoPositionInfoSource *m_gps;
-    bool                    m_started;
-};
-
-#endif // GPSCONTROLLER_H
diff --git a/zouba/src/locationbutton.cpp b/zouba/src/locationbutton.cpp
deleted file mode 100644 (file)
index 528dc64..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*#include "locationbutton.h"
-
-locationButton::locationButton(Locations& locations, QObject *parent) :
-        m_locations(locations), QValueButton(parent)
-{
-    QStandardItemModel model(0,1);
-
-}
-
-
-locationButton::Location* getSelected()
-{
-    //return this.
-}
-
-void locationButton::updateLocations() {
-
-}
-
-*/
diff --git a/zouba/src/locationbutton.h b/zouba/src/locationbutton.h
deleted file mode 100644 (file)
index 3db2393..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*#ifndef LOCATIONBUTTON_H
-#define LOCATIONBUTTON_H
-
-#include <QMaemo5ValueButton>
-
-class locationButton : public QValueButton
-{
-    Q_OBJECT
-    //Locations& m_locations;
-    //QStandartItemModel
-
-public:
-    //explicit locationButton(Locations& locations, QObject *parent = 0);
-
-    //Location* getSelected();
-
-signals:
-
-public slots:
-    void updateLocations();
-
-};
-
-#endif // LOCATIONBUTTON_H
-*/
diff --git a/zouba/src/locationsdisplay.cpp b/zouba/src/locationsdisplay.cpp
deleted file mode 100644 (file)
index 9a4b1fd..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <QListWidget>
-#include <QHash>
-#include <QDebug>
-#include <QListWidgetItem>
-#include <QPoint>
-#include <QMenu>
-#include <QMenuBar>
-#include <QAction>
-#include <QWidget>
-#ifdef Q_WS_MAEMO_5
-#include <QMaemo5EditBar>
-#endif
-
-#include "locationsdisplay.h"
-#include "locations.h"
-#include "addressdialog.h"
-
-const QString invalidPostText = " - Invalid address";
-const QString editText = "Edit list";
-const QString newLocText = "Add new location";
-const QString removeText = "Remove";
-const QString doneText = "Done";
-const QString moveUpText = "Move up";
-const QString moveDownText = "Move down";
-
-QString getLocName(const QListWidgetItem *item);
-Location* getSelectedLocation(QList<QListWidgetItem*> list);
-
-LocationsDisplay::LocationsDisplay(QWidget *parent) :
-        QMainWindow(parent)
-{
-#ifdef Q_WS_MAEMO_5
-    this->setAttribute(Qt::WA_Maemo5StackedWindow);
-    //this->setWindowFlags(this->windowFlags() | Qt::Window);
-#endif
-
-    QMenuBar *menu = this->menuBar();
-    QAction *editListAction = new QAction(editText, menu);
-    menu->addAction(editListAction);
-    connect(editListAction, SIGNAL(triggered()), this, SLOT(showEditOptions()));
-
-    this->m_centralWidget = new QWidget(this);
-    this->setCentralWidget(this->m_centralWidget);
-
-    QVBoxLayout *layout = new QVBoxLayout(this->m_centralWidget);
-    this->m_centralWidget->setLayout(layout);
-
-    this->m_topWidget = new QWidget(this->m_centralWidget);
-    layout->addWidget(this->m_topWidget);
-    QVBoxLayout *topLayout = new QVBoxLayout(this->m_topWidget);
-    this->m_topWidget->setLayout(topLayout);
-    this->m_addButton = new QPushButton(newLocText, this->m_topWidget);
-    connect(this->m_addButton, SIGNAL(clicked()), this, SLOT(addAddress()));
-    topLayout->addWidget(this->m_addButton);
-
-    this->m_list = new QListWidget(this->m_centralWidget);
-    connect(this->m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(editLocation(QListWidgetItem*)));
-    //this->m_list->setContextMenuPolicy(Qt::CustomContextMenu);
-    //connect(this->m_list, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(const QPoint&)));
-    layout->addWidget(this->m_list);
-
-    this->populateLocations();
-
-    this->m_bottomWidget = new QWidget(this->m_centralWidget);
-    layout->addWidget(this->m_bottomWidget);
-    QHBoxLayout *bottomLayout = new QHBoxLayout(this->m_bottomWidget);
-    this->m_bottomWidget->setLayout(bottomLayout);
-    QPushButton *removeButton = new QPushButton(removeText, this->m_bottomWidget);
-    connect(removeButton, SIGNAL(clicked()), this, SLOT(remove()));
-    bottomLayout->addWidget(removeButton);
-    QPushButton *moveUpButton = new QPushButton(moveUpText, this->m_bottomWidget);
-    connect(moveUpButton, SIGNAL(clicked()), this, SLOT(moveUp()));
-    bottomLayout->addWidget(moveUpButton);
-    QPushButton *moveDownButton = new QPushButton(moveDownText, this->m_bottomWidget);
-    connect(moveDownButton, SIGNAL(clicked()), this, SLOT(moveDown()));
-    bottomLayout->addWidget(moveDownButton);
-
-    QPushButton *doneButton = new QPushButton(doneText, this->m_bottomWidget);
-    connect(doneButton, SIGNAL(clicked()), this, SLOT(closeEditOptions()));
-    bottomLayout->addWidget(doneButton);
-    this->m_bottomWidget->hide();
-
-    Locations *locations = Locations::GetInstance();
-    connect(locations, SIGNAL(locationsChanged()), this, SLOT(populateLocations()));
-}
-
-void LocationsDisplay::populateLocations()
-{
-    m_list->clear();
-    qDebug() << "Populating locations";
-    Locations *locations = Locations::GetInstance();
-
-    for (int index = 1; index <= locations->size(); ++index)
-    {
-        qDebug() << "Adding location: " << locations->getLocation(index)->label();
-        Location* loc = locations->getLocation(index);
-        QString dispName = loc->label();
-        if (!loc->isValid())
-            dispName.append(invalidPostText);
-        new QListWidgetItem(dispName, m_list);
-    }
-    qDebug() << "Locations populated";
-}
-
-void LocationsDisplay::addAddress()
-{
-    AddressDialog *dialog = new AddressDialog(this);
-    dialog->show();
-}
-
-void LocationsDisplay::editLocation(QListWidgetItem *item)
-{
-    if (!item) return;
-
-    Locations *locations = Locations::GetInstance();
-    QString findText = getLocName(item);
-    Location *loc = locations->getLocation(findText);
-    if (!loc)
-        qDebug() << "No location with label " << findText << " was found from locations.";
-    else
-    {
-        AddressDialog *dialog = new AddressDialog(this, loc);
-        dialog->show();
-    }
-}
-
-QString getLocNameold(const QListWidgetItem *item)
-{
-    if (!item) return 0;
-    QString retText = item->text();
-    if (retText.contains(" - Invalid address", Qt::CaseSensitive))
-        retText.chop(18);
-    return retText;
-}
-
-/*void LocationsDisplay::contextMenu(const QPoint &point)
-{
-    qDebug() << "ContextMenu requested";
-    this->m_point = point;
-    QMenu *menu = new QMenu(this->m_list);
-    menu->addAction("Delete", this, SLOT(remove()));
-    menu->exec(this->mapToGlobal(point));
-}*/
-
-void LocationsDisplay::remove()
-{
-    qDebug() << "Remove called";
-    Location* loc = getSelectedLocation(this->m_list->selectedItems());
-    if (!loc)
-        qDebug() << "No location with selected label was found from locations.";
-    else
-    {
-        Locations *locations = Locations::GetInstance();
-        locations->removeLocation(loc);
-    }
-}
-
-Location* getSelectedLocationold(QList<QListWidgetItem*> list)
-{
-    if (list.size() == 0)
-    {
-        qDebug() << "No item is selected";
-        return 0;
-    }
-    QListWidgetItem *item = list.at(0);
-    QString name = getLocName(item);
-    qDebug() << "Selected item is" << name;
-    Locations *locations = Locations::GetInstance();
-    return locations->getLocation(name);
-}
-
-void LocationsDisplay::moveUp()
-{
-    qDebug() << "Move up called";
-    Location* loc = getSelectedLocation(this->m_list->selectedItems());
-    if (!loc)
-        qDebug() << "No location with selected label was found from locations.";
-    else
-    {
-        Locations *locations = Locations::GetInstance();
-        locations->lowerLocationIndex(loc->label());
-    }
-}
-
-void LocationsDisplay::moveDown()
-{
-    qDebug() << "Move down called";
-    Location* loc = getSelectedLocation(this->m_list->selectedItems());
-    if (!loc)
-        qDebug() << "No location with selected label was found from locations.";
-    else
-    {
-        Locations *locations = Locations::GetInstance();
-        locations->increaseLocationIndex(loc->label());
-    }
-}
-
-void LocationsDisplay::showEditOptions()
-{
-    disconnect(this->m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(editLocation(QListWidgetItem*)));
-    this->m_topWidget->hide();
-    this->m_bottomWidget->show();
-}
-
-void LocationsDisplay::closeEditOptions()
-{
-    connect(this->m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(editLocation(QListWidgetItem*)));
-    this->m_topWidget->show();
-    this->m_bottomWidget->hide();
-}
diff --git a/zouba/src/locationsdisplay.h b/zouba/src/locationsdisplay.h
deleted file mode 100644 (file)
index 445de8f..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef LOCATIONSDISPLAY_H
-#define LOCATIONSDISPLAY_H
-
-#include <QMainWindow>
-#ifdef Q_WS_MAEMO_5
-#include <QMaemo5EditBar>
-#endif
-
-class QVBoxLayout;
-class QWidget;
-class QListView;
-class QListWidget;
-class QPoint;
-class QListWidgetItem;
-class QPushButton;
-class LocationsEditBar;
-
-
-/* TODO: Redesign locations list:
- * - Add button to top
- * - List all locations below that
- * - Short press selects to edit
- * - Long press shows options:
- *   - Delete
- *   - Move up
- *   - Move down
- */
-class LocationsDisplay : public QMainWindow
-{
-    Q_OBJECT
-public:
-    explicit LocationsDisplay(QWidget *parent = 0);
-
-signals:
-
-public slots:
-    void populateLocations();
-
-private slots:
-    void addAddress();
-    void editLocation(QListWidgetItem*);
-    //void contextMenu(const QPoint&);
-    void remove();
-    void moveUp();
-    void moveDown();
-    void showEditOptions();
-    void closeEditOptions();
-
-private:
-    QPushButton *m_addButton;
-    QListWidget *m_list;
-    QPoint m_point;
-    QWidget *m_centralWidget;
-    QWidget *m_topWidget;
-    QWidget *m_bottomWidget;
-};
-
-#endif // LOCATIONSDISPLAY_H
diff --git a/zouba/src/route.cpp b/zouba/src/route.cpp
deleted file mode 100644 (file)
index 46d7096..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-#include "route_p.h"
-#include "route.h"
-
-#include "routedata.h"
-#include "logic/location.h"
-
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QUrl>
-#include <QObject>
-#include <QDebug>
-#include <QStringList>
-#include <QString>
-#include <QXmlStreamReader>
-#include <QWidget>
-
-#include "logic/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()
-{
-  qDebug() << "getting route from Ytv";
-
-  QUrl fullUrl( Ytv::Url );
-
-  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( "show", QString::number(Ytv::ShowFiveResults) );
-  fullUrl.addQueryItem( "walkspeed", QString::number(Ytv::WalkSpeedFast) );
-  fullUrl.addQueryItem( "optimize", QString::number(Ytv::OptimizeDefault) );
-  fullUrl.addQueryItem( "user", Ytv::Username );
-  fullUrl.addQueryItem( "pass", Ytv::Password );
-
-  manager->get( QNetworkRequest( fullUrl ) );
-  qDebug() << "getting url" << fullUrl.toEncoded();
-  qDebug() << "waiting for reply from Ytv";
-  emit( busy( true ) );
-}
-
-void Route::replyFinished( QNetworkReply * reply )
-{
-  qDebug() << "have reply from Ytv";
-  QList<RouteData> routeData = q->parseReply( reply->readAll() );
-
-  emit( routeReady( routeData ) );
-  emit( busy( false ) );
-}
-
-void Route::setFromLocation( Location *location )
-{
-  qDebug() << "setting new From location (" << location->label() << ")";
-  this->setLocation(location, true);
-}
-
-void Route::searchRoute()
-{
-    if (q->fromValid() && q->toValid())
-    {
-        qDebug() << "From and To addresses are valid.";
-        getRoute();
-    }
-}
-
-Location *Route::fromLocation() const
-{
-  return q->fromLocation();
-}
-
-void Route::setLocation(Location *location, bool from)
-{
-  if (location != 0)
-  {
-    if (location->isValid())
-    {
-      qDebug() << "Location is valid";
-      if (from) q->setFromLocation( location );
-      else q->setToLocation(location);
-    } else {
-      qDebug() << "Location is not valid. Try again or fix address";
-      qDebug() << "Location = " << location;
-      //location->resolveAddress(location->address());
-    }
-  } else {
-    qDebug() << "ERROR:Null location pointer given.";
-  }
-}
-
-void Route::setToLocation( Location *location )
-{
-  qDebug() << "setting new To location (" << location->label() << ")";
-  this->setLocation(location, false);
-}
-
-Location *Route::toLocation() const
-{
-  return q->toLocation();
-}
diff --git a/zouba/src/route.h b/zouba/src/route.h
deleted file mode 100644 (file)
index 9703e3e..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef ROUTE_H
-#define ROUTE_H
-
-#include "routedata.h"
-#include "logic/location.h"
-
-#include <QObject>
-#include <QNetworkReply>
-#include <QNetworkAccessManager>
-
-class RoutePrivate;
-
-class Route: public QObject
-{
-  Q_OBJECT
-
-public:
-  Route();
-  ~Route();
-
-  /*!
-    * \brief Gets the route data from the server
-    */
-  void getRoute();
-
-  /*!
-    \brief Get the from location
-    \return The from location
-    */
-  Location *fromLocation() const;
-
-  /*!
-    \brief Get the to location
-    \return The to location
-    */
-  Location *toLocation() const;
-
-public Q_SLOTS:
-
-  /*!
-    * \brief Sets the from location
-    * \param fromLocation The from location
-    */
-  void setFromLocation( Location *location=0 );
-
-  /*!
-    * \brief Sets the to location
-    * \param toLocation The to location
-    */
-  void setToLocation( Location *location=0 );
-
-  void searchRoute();
-
-Q_SIGNALS:
-  void routeReady( QList<RouteData> );
-  void busy( bool busy );
-
-private Q_SLOTS:
-  void replyFinished( QNetworkReply* );
-
-private:
-  void setLocation(Location*, bool from);
-private:
-  RoutePrivate *q;
-  QNetworkAccessManager *manager;
-};
-#endif // ROUTE_H
diff --git a/zouba/src/route_p.cpp b/zouba/src/route_p.cpp
deleted file mode 100644 (file)
index a0cbe12..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-#include "route_p.h"
-#include "logic/location.h"
-
-#include <QXmlStreamReader>
-#include <QDebug>
-#include <QList>
-#include <QFile>
-#include <QStringList>
-#ifdef Q_WS_MAEMO_5
-#include <QMaemo5InformationBox>
-#endif
-
-RoutePrivate::RoutePrivate( QObject *parent ) :
-    m_fromValid(false),
-    m_toValid(false),
-    m_fromLocation(0),
-    m_toLocation(0)
-{
-  Q_UNUSED( parent )
-}
-
-RoutePrivate::~RoutePrivate()
-{
-}
-
-QList<RouteData> RoutePrivate::parseReply( const QByteArray &reply )
-{
-  qDebug() << "parsing route";
-
-  QList<RouteData> retVal;
-  RouteData routeData;
-  LegData legData;
-
-  QXmlStreamReader xml( reply );
-
-  QHash<QString, bool> in;
-  QHash<QString, bool> have;
-
-  QStringList haveKeys;
-  QStringList inKeys;
-
-  haveKeys
-    << "LINE"
-    << "TIME"
-    << "TRIP"
-    << "DEPARTURE"
-    << "ARRIVAL"
-    ;
-
-  inKeys
-    << "ROUTE"
-    << "LINE"
-    << "STOP"
-    << "WALK"
-    << "POINT"
-    ;
-
-  foreach( QString key, haveKeys ) {
-    have[ key ] = false;
-  }
-
-  foreach( QString key, inKeys ) {
-    in[ key ] = false;
-  }
-
-  while ( !xml.atEnd() ) {
-    xml.readNext();
-
-    QString xmlName = xml.name().toString();
-
-    if ( xml.isStartElement() ) {
-      if ( inKeys.contains( xmlName ) ) {
-        in[ xmlName ] = true;
-        //qDebug() << "in[" << xmlName << "] = true";
-      }
-
-      if ( xmlName == "ROUTE" ) {
-        foreach( QString key, haveKeys ) {
-          have[ key ] = false;
-        }
-      }
-
-      if ( xmlName == "WALK" ) {
-        legData.m_how = "WALK";
-        have[ "DEPARTURE" ] = false;
-        have[ "ARRIVAL" ]   = false;
-        have[ "LENGTH" ]    = false;
-      }
-
-      if ( xmlName == "LINE" ) {
-        legData.m_how = "LINE";
-        QString lineCode( xml.attributes().value("code").toString() );
-        legData.m_lineCode = parseJORECode( lineCode );
-        have[ "DEPARTURE" ] = false;
-        have[ "ARRIVAL" ]   = false;
-        have[ "LENGTH" ]    = false;
-      }
-    }
-
-    if ( xml.isEndElement() ) {
-      if ( inKeys.contains( xmlName ) ) {
-        in[ xmlName ] = false;
-        //qDebug() << "in[" << xmlName << "] = false";
-      }
-
-      if ( xmlName == "ROUTE" ) {
-        retVal.append( routeData );
-        routeData.clear();
-      }
-
-      if ( xmlName == "WALK" || xmlName == "LINE" ) {
-        routeData.m_legData.append( legData );
-        legData.clear();
-        have[ "LENGTH" ] = false;
-      }
-    }
-
-    if ( !have[ "ARRIVAL" ] && ( in[ "WALK" ] || in[ "LINE" ] ) && ( in[ "STOP" ] || in[ "POINT" ] ) && xml.isStartElement() && xmlName == "ARRIVAL" ) {
-      QString arrivalTime( xml.attributes().value("time").toString() );
-      legData.m_arrivalTime = arrivalTime.rightJustified(4).insert(2,":");
-
-      // don't set have[ "ARRIVAL" ] since we want the last one of many STOPs
-    }
-
-    if ( !have[ "DEPARTURE" ] && in[ "LINE" ] && in[ "STOP" ] && xml.isStartElement() && xmlName == "DEPARTURE" ) {
-      QString departureTime( xml.attributes().value("time").toString() );
-      legData.m_departureTime = departureTime.rightJustified(4).insert(2,":");
-
-      have[ "DEPARTURE" ] = true;
-    }
-
-    if ( !have[ "DEPARTURE" ] && in[ "WALK" ] && ( in[ "POINT" ] || in[ "STOP" ] ) && xml.isStartElement() && xmlName == "DEPARTURE" ) {
-      QString departureTime( xml.attributes().value("time").toString() );
-      legData.m_departureTime = departureTime.rightJustified(4).insert(2,":");
-
-      have[ "DEPARTURE" ] = true;
-    }
-
-    if ( !have[ "LENGTH" ] && ( in[ "WALK" ] || in[ "LINE" ] ) && xml.isStartElement() && xmlName == "LENGTH" ) {
-      legData.m_tripTime     = xml.attributes().value("time").toString();
-      legData.m_tripDistance = xml.attributes().value("dist").toString();
-
-      have[ "LENGTH" ] = true;
-    }
-
-    if ( !have[ "TRIP" ] && in[ "ROUTE" ] && xml.isStartElement() && xmlName == "LENGTH" ) {
-      routeData.m_tripTime     = xml.attributes().value("time").toString();
-      routeData.m_tripDistance = xml.attributes().value("dist").toString();
-
-      have[ "TRIP" ] = true;
-    }
-
-    if ( !have[ "LINE" ] && in[ "ROUTE" ] && xml.isStartElement() && xmlName == "LINE" ) {
-      QString lineCode( xml.attributes().value("code").toString() );
-
-      routeData.m_lineCode = parseJORECode( lineCode );
-      have[ "LINE" ] = true;
-    }
-
-    if ( !have[ "TIME" ] && in[ "ROUTE" ] && in[ "LINE" ] && in[ "STOP" ] && xmlName == "DEPARTURE" ) {
-      QString departureTime( xml.attributes().value("time").toString() );
-
-      routeData.m_departureTime = departureTime.rightJustified(4).insert(2,":");
-      have[ "TIME" ] = true;
-    }
-
-  }
-
-  if ( xml.hasError() ) {
-    qDebug() << "xml error:" << xml.errorString();
-  }
-
-  if ( retVal.isEmpty() ) {
-    qDebug() << "no routes found";
-#ifdef Q_WS_MAEMO_5
-    QMaemo5InformationBox::information( 0, "no routes found" );
-#endif
-  }
-
-  return retVal;
-}
-
-void RoutePrivate::setFromLocation( Location *location )
-{
-  m_fromLocation = location;
-  m_fromValid = true;
-}
-
-Location *RoutePrivate::fromLocation() const
-{
-  return m_fromLocation;
-}
-
-void RoutePrivate::setToLocation( Location *toLocation )
-{
-  m_toLocation = toLocation;
-  m_toValid = true;
-}
-
-QString RoutePrivate::parseJORECode( const QString &joreCode ) const
-{
-  QString retVal;
-
-  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() );
-
-  retVal = lineCode;
-
-  if ( letterVariant != " " ) {
-    retVal += letterVariant;
-  }
-
-  return retVal;
-}
-
-Location *RoutePrivate::toLocation() const
-{
-  return m_toLocation;
-}
-
-bool RoutePrivate::fromValid()
-{
-  return m_fromValid;
-}
-
-bool RoutePrivate::toValid()
-{
-  return m_toValid;
-}
diff --git a/zouba/src/route_p.h b/zouba/src/route_p.h
deleted file mode 100644 (file)
index 99a48e7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef ROUTE_P_H
-#define ROUTE_P_H
-
-#include "routedata.h"
-
-#include "logic/location.h"
-
-#include <QObject>
-
-class RoutePrivate: public QObject
-{
-  Q_OBJECT
-
-public:
-  RoutePrivate( QObject *parent=0 );
-  ~RoutePrivate();
-
-  QList<RouteData> parseReply( const QByteArray &reply );
-
-  Q_PROPERTY(Location* fromLocation READ fromLocation WRITE setFromLocation);
-  Q_PROPERTY(Location* toLocation READ toLocation WRITE setToLocation);
-
-  void setFromLocation( Location *fromLocation );
-
-  Location *fromLocation() const;
-
-  void setToLocation( Location *toLocation );
-
-  Location *toLocation() const;
-
-  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/src/routedata.h b/zouba/src/routedata.h
deleted file mode 100644 (file)
index b1bec0b..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef ROUTEDATA_H
-#define ROUTEDATA_H
-
-#include <QString>
-#include <QList>
-
-struct LegData
-{
-  LegData() :
-    m_how(),
-    m_tripTime(),
-    m_tripDistance(),
-    m_departureTime(),
-    m_arrivalTime(),
-    m_lineCode()
-  {
-  };
-
-  LegData( QString how, QString tripTime, QString tripDistance, QString departureTime, QString arrivalTime, QString lineCode=QString() ) :
-    m_how(how),
-    m_tripTime(tripTime),
-    m_tripDistance(tripDistance),
-    m_departureTime(departureTime),
-    m_arrivalTime(arrivalTime),
-    m_lineCode(lineCode)
-  {
-  };
-
-  void clear()
-  {
-    m_how = "";
-    m_tripTime = "";
-    m_tripDistance = "";
-    m_departureTime = "";
-    m_arrivalTime = "";
-    m_lineCode = "";
-  };
-
-  QString m_how;
-  QString m_tripTime;
-  QString m_tripDistance;
-  QString m_departureTime;
-  QString m_arrivalTime;
-  QString m_lineCode;
-
-};
-
-struct RouteData
-{
-  RouteData():
-    m_tripTime(),
-    m_tripDistance(),
-    m_departureTime(),
-    m_lineCode(),
-    m_legData()
-  {
-  };
-
-  RouteData( QString tripTime, QString tripDistance, QString departureTime, QString lineCode ):
-    m_tripTime(tripTime),
-    m_tripDistance(tripDistance),
-    m_departureTime(departureTime),
-    m_lineCode(lineCode),
-    m_legData()
-  {
-  };
-
-  RouteData &operator <<(const LegData &legData)
-  {
-    m_legData.append( legData );
-    return *this;
-  };
-
-  void clear()
-  {
-    m_tripTime = "";
-    m_tripDistance = "";
-    m_departureTime = "";
-    m_lineCode = "";
-    m_legData.clear();
-  };
-
-  QString m_tripTime;
-  QString m_tripDistance;
-  QString m_departureTime;
-  QString m_lineCode;
-  QList<LegData> m_legData;
-
-};
-
-#endif // ROUTEDATA_H
diff --git a/zouba/src/ui.cpp b/zouba/src/ui.cpp
deleted file mode 100644 (file)
index da74a1a..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-#include "ui.h"
-
-#include "logic/locations.h"
-#include "logic/ytv.h"
-
-#include <QMainWindow>
-#include <QRadioButton>
-#include <QTableWidget>
-#include <QString>
-#include <QRect>
-#include <QButtonGroup>
-#include <QHeaderView>
-#include <QObject>
-#include <QMenuBar>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include <QSizePolicy>
-#include <QInputDialog>
-#include <QDebug>
-#include <QMenu>
-#include <QPushButton>
-#ifdef Q_WS_MAEMO_5
-#include <QMaemo5ValueButton>
-#include <QMaemo5ListPickSelector>
-#endif
-#include <QStandardItemModel>
-
-UiClass::UiClass() :
-        m_centralWidget(NULL),
-        m_routeStack(NULL),
-        m_locDisp(NULL)
-{
-}
-
-UiClass::~UiClass()
-{
-    delete m_locDisp;
-}
-
-void UiClass::setupUi( QMainWindow *mainWindow )
-{
-    m_mainWindow = mainWindow;
-#ifdef Q_WS_MAEMO_5
-    m_mainWindow->setAttribute(Qt::WA_Maemo5StackedWindow);
-#endif
-    //m_mainWindow->resize(800,480);
-
-    m_locDisp = new LocationsDisplayWindow(mainWindow);
-
-    m_menu = mainWindow->menuBar();
-
-    /*QAction *setHomeAddressAction = new QAction("Set home address", this);
-    QAction *setWorkAddressAction = new QAction("Set work address", this);*/
-    QAction *modifyLocationsAction = new QAction("Modify locations", this);
-    m_UseGpsAction  = new QAction("Use GPS", this);
-    m_UseGpsAction->setCheckable(true);
-    m_UseGpsAction->setChecked(true);
-    connect(this->m_UseGpsAction, SIGNAL(toggled(bool)), this, SLOT(setLocations()));
-    /*m_menu->addAction(setHomeAddressAction);
-    m_menu->addAction(setWorkAddressAction);*/
-    m_menu->addAction(m_UseGpsAction);
-    m_menu->addAction(modifyLocationsAction);
-
-    /*connect(
-            setHomeAddressAction, SIGNAL(triggered()),
-            this, SLOT(setHomeAddress())
-            );
-    connect(
-            setWorkAddressAction, SIGNAL(triggered()),
-            this, SLOT(setWorkAddress())
-            );*/
-
-    connect(modifyLocationsAction, SIGNAL(triggered()), m_locDisp, SLOT(show()));
-
-    Locations* locations = Locations::GetInstance();
-    connect(locations, SIGNAL(locationsChanged()), this, SLOT(setLocations()));
-
-    m_centralWidget = new QWidget( m_mainWindow );
-    m_mainWindow->setCentralWidget( m_centralWidget);
-
-    m_locationsModel = new QStandardItemModel(0,1);
-    this->setLocations();
-
-#ifdef Q_WS_MAEMO_5
-    m_fromButton = new QMaemo5ValueButton(QString::fromUtf8("From"));
-    m_fromButton->setValueLayout(QMaemo5ValueButton::ValueBesideText);
-    QMaemo5ListPickSelector *fromSelector = new QMaemo5ListPickSelector();
-    fromSelector->setModel(m_locationsModel);
-    m_fromButton->setPickSelector(fromSelector);
-
-    m_toButton = new QMaemo5ValueButton(QString::fromUtf8("To"));
-    m_toButton->setValueLayout(QMaemo5ValueButton::ValueBesideText);
-    QMaemo5ListPickSelector *toSelector = new QMaemo5ListPickSelector();
-    toSelector->setModel(m_locationsModel);
-    m_toButton->setPickSelector(toSelector);
-#endif
-
-    m_routeButton = new QPushButton("Route");
-
-    m_routeButtons = new QButtonGroup();
-    m_routeButtons->setExclusive( true );
-    m_routeStack = new QVBoxLayout();
-    for ( int i=0; i<Ytv::ShowFiveResults; ++i ) {
-        QRadioButton *button = new QRadioButton();
-        button->setObjectName( "routeButton"+i );
-        button->setEnabled( false );
-
-        m_routeStack->addWidget( button, i );
-        m_routeButtons->addButton( button, i );
-    }
-    m_routeStack->addStretch();
-
-    QStringList headers( QStringList() << "How" << "Time" << "Dist" << "Dep" << "Arr" );
-    m_routeDetailTable = new QTableWidget();
-    m_routeDetailTable->setColumnCount( headers.count() );
-    m_routeDetailTable->setHorizontalHeaderLabels( headers );
-    m_routeDetailTable->resizeColumnsToContents();
-    m_routeDetailTable->setSelectionMode( QAbstractItemView::NoSelection );
-
-    QHBoxLayout *topLayout = new QHBoxLayout();
-    topLayout->addLayout( m_routeStack );
-    topLayout->addWidget( m_routeDetailTable );
-
-    m_buttonLayout = new QGridLayout();
-#ifdef Q_WS_MAEMO_5
-    m_buttonLayout->addWidget(m_fromButton, 0, 0);
-    m_buttonLayout->addWidget(m_toButton, 0, 1);
-#endif
-    m_buttonLayout->addWidget(m_routeButton, 0, 2);
-
-    m_mainLayout = new QVBoxLayout();
-    m_mainLayout->addLayout( topLayout );
-    m_mainLayout->addLayout( m_buttonLayout );
-
-    m_centralWidget->setLayout( m_mainLayout );
-}
-
-void UiClass::setLocations()
-{
-    qDebug() << "Setting locations for main menu selectors.";
-    Locations *locations = Locations::GetInstance();
-
-    m_locationsModel->clear();
-    QStandardItem *item;
-    if (this->m_UseGpsAction->isChecked())
-    {
-        item = new QStandardItem(QString("GPS"));
-        item->setTextAlignment(Qt::AlignCenter);
-        item->setEditable(false);
-        m_locationsModel->appendRow(item);
-    }
-
-    for (int index = 1; index <= locations->size(); ++index)
-    {
-        item = new QStandardItem(locations->getLocation(index)->label());
-        item->setTextAlignment(Qt::AlignCenter);
-        item->setEditable(false);
-        m_locationsModel->appendRow(item);
-    }
-}
-
-void UiClass::setHomeAddress()
-{
-    setAddress( "home" );
-}
-
-void UiClass::setWorkAddress()
-{
-    setAddress( "work" );
-}
-
-void UiClass::setAddress( const QString &label )
-{
-    /*Locations locations;
-    Location *location=locations.location( label );
-
-    bool ok;
-    QString address = QInputDialog::getText(
-            m_centralWidget,
-            tr("Enter address for \""+QString(label).toLatin1()+"\""),
-            tr("Address"),
-            QLineEdit::Normal,
-            location->address(),
-            &ok
-            );
-
-    if ( ok ) {
-        qDebug() << "new address" << address;
-        Locations locations;
-        Location  *location  = locations.location( label );
-        qDebug() << "location" << location;
-        if ( location ) {
-            //location->resolveAddress( address );
-        }
-    }*/
-}
-
-/*void Ui::modifyLocations()
-{
-    LocationsDisplay
-}*/
-
-void UiClass::setBusy( bool busy )
-{
-#ifdef Q_WS_MAEMO_5
-    m_mainWindow->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, busy);
-#endif
-}
diff --git a/zouba/src/ui.h b/zouba/src/ui.h
deleted file mode 100644 (file)
index 757bf3c..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef UI_H
-#define UI_H
-
-#include <QObject>
-#include <QStandardItemModel>
-#include <QPushButton>
-#include <QMenuBar>
-#include <QMainWindow>
-#include <QWidget>
-#include <QTableWidget>
-#include <QButtonGroup>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include <QAction>
-#ifdef Q_WS_MAEMO_5
-#include <QMaemo5ValueButton>
-#endif
-
-#include "logic/location.h"
-#include "gui/locationsdisplaywidget.h"
-
-/*class QMainWindow;
-class QWidget;
-class QTableWidget;
-class QButtonGroup;
-class QHBoxLayout;
-class QVBoxLayout;
-class QGridLayout;
-class QMenu;
-class QAction;
-class Location;*/
-
-class UiClass : public QObject
-{
-  Q_OBJECT
-
-public:
-  UiClass();
-  ~UiClass();
-  void setupUi( QMainWindow *mainWindow );
-
-  enum {
-    FromButtonId=0,
-    ToButtonId=1,
-    RouteButtonId=2
-  };
-
-  enum {
-    ScreenWidth=800,
-    ScreenHeight=480
-  };
-
-  QMainWindow *m_mainWindow;
-  QWidget *m_centralWidget;
-#ifdef Q_WS_MAEMO_5
-  QMaemo5ValueButton *m_fromButton;
-  QMaemo5ValueButton *m_toButton;
-#endif
-  QButtonGroup *m_routeButtons;
-  QVBoxLayout *m_routeStack;
-  QTableWidget *m_routeDetailTable;
-  QVBoxLayout *m_mainLayout;
-  QGridLayout *m_buttonLayout;
-  QMenuBar       *m_menu;
-  QAction     *m_UseGpsAction;
-  QStandardItemModel *m_locationsModel;
-  QPushButton *m_routeButton;
-  LocationsDisplayWidget *m_locDisp;
-
-public slots:
-  void setLocations();
-
-Q_SIGNALS:
-  void homeAddressChanged( QString address );
-  void workAddressChanged( QString address );
-
-private Q_SLOTS:
-  void setHomeAddress();
-  void setWorkAddress();
-  void setBusy( bool busy );
-  //void modifyLocations();
-
-
-private:
-  void setAddress( const QString &label );
-};
-#endif //UI_H
diff --git a/zouba/src/uicontroller.cpp b/zouba/src/uicontroller.cpp
deleted file mode 100644 (file)
index 5337d96..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-#include "uicontroller.h"
-#include "route.h"
-#include "ui.h"
-#include "logic/ytv.h"
-#include "logic/location.h"
-#include "logic/locations.h"
-
-#include <QObject>
-#include <QPushButton>
-#include <QDebug>
-#include <QButtonGroup>
-#include <QRadioButton>
-#include <QVBoxLayout>
-#include <QTableWidgetItem>
-#include <QString>
-#ifdef Q_WS_MAEMO_5
-#include <QMaemo5AbstractPickSelector>
-#include <QMaemo5InformationBox>
-#endif
-
-UiController::UiController( UiClass *ui ) :
-        m_routeData(),
-        m_ui(ui),
-        m_currentRoute(-1)
-{
-    Locations *locations = Locations::GetInstance();
-    /*if (locations->size() == 0)
-    {
-        locations->addEditLocation(new Location("Home"));
-        locations->addEditLocation(new Location("Work"));
-    }*/
-
-    QObject::connect(m_ui->m_routeButton, SIGNAL(clicked()), this, SLOT(findRoute()));
-#ifdef Q_WS_MAEMO_5
-    QObject::connect(this->m_ui->m_fromButton->pickSelector(), SIGNAL(selected(const QString &)), this, SLOT(changeFrom()));
-    connect(m_ui->m_toButton->pickSelector(), SIGNAL(selected(const QString &)), this, SLOT(changeTo()));
-#endif
-    connect(m_ui->m_routeButtons, SIGNAL(buttonClicked(int)), this, SLOT(displayRouteDetail(int)));
-}
-
-UiController::~UiController()
-{
-}
-
-void UiController::changeRoute( int id )
-{
-    bool routeHasChanged = ( m_currentRoute != id );
-    if ( routeHasChanged ) {
-        displayRouteDetail( id );
-    }
-}
-
-void UiController::displayRouteDetail( int id )
-{
-    QTableWidget *table = m_ui->m_routeDetailTable;
-
-    if ( id < m_routeData.count() ) {
-        QList<LegData> &legDataList = m_routeData[ id ].m_legData;
-        table->setRowCount( legDataList.count() );
-
-        int row=0;
-        foreach( LegData thisLegData, legDataList ) {
-            QString thisHow = thisLegData.m_how;
-
-            bool thisIsLine = ( thisHow == "LINE" );
-            if ( thisIsLine ) {
-                thisHow = thisLegData.m_lineCode;
-            }
-
-            QStringList tableStrings;
-            tableStrings
-                    << thisHow
-                    << thisLegData.m_tripTime
-                    << thisLegData.m_tripDistance
-                    << thisLegData.m_departureTime
-                    << thisLegData.m_arrivalTime;
-
-            int col=0;
-            foreach( QString thisString, tableStrings ) {
-                QTableWidgetItem *newItem = new QTableWidgetItem();
-                newItem->setText( thisString );
-                table->setItem( row,col, newItem );
-                ++col;
-            }
-
-            ++row;
-        }
-    } else {
-        table->setRowCount( 0 );
-    }
-
-    table->resizeColumnsToContents();
-}
-
-void UiController::displayRoute( const QList<RouteData> &routeData )
-{
-    m_routeData = routeData;
-
-    qDebug() << "displaying route";
-
-    for ( int i=0; i<Ytv::ShowFiveResults; ++i ) {
-        QString label;
-
-        QWidget *widget = m_ui->m_routeStack->itemAt( i )->widget();
-        QRadioButton *button = qobject_cast<QRadioButton *>(widget);
-
-        if ( i<routeData.count() ) {
-            RouteData thisRouteData = routeData.at(i);
-            label = ( QStringList()
-                      << thisRouteData.m_departureTime
-                      << thisRouteData.m_lineCode ).join( "/" );
-            button->setEnabled( true );
-        } else {
-            button->setEnabled( false );
-        }
-
-        if ( i==0 ) {
-            button->setChecked( true );
-        } else {
-            button->setChecked( false );
-        }
-
-        button->setText( label );
-    }
-
-    displayRouteDetail( 0 );
-}
-
-void UiController::findRoute()
-{
-    qDebug() << "Route search button clicked";
-    emit(routeSearchRequested());
-}
-
-/*void UiController::updateLocationSelectors()
-{
-    m_ui->setLocations();
-}*/
-
-void UiController::changeFrom()
-{
-    qDebug() << "From selection changed";
-    Locations *locations = Locations::GetInstance();
-    Location *from;
-
-#ifdef Q_WS_MAEMO_5
-    const QString newValue = m_ui->m_fromButton->valueText();
-#else
-    const QString newValue = "";
-#endif
-    if (newValue == "GPS")
-    {
-        from = locations->getGpsLocation();
-        if (!from->isValid())
-        {
-            qDebug() << "GPS location is not valid.";
-#ifdef Q_WS_MAEMO_5
-            QMaemo5InformationBox::information(this->m_ui->m_mainWindow, "GPS location has not been received yet. Wait a moment.");
-#endif
-            //connect(from, SIGNAL(becomeValid()), this, SLOT(gpsBecameValid()));
-            return;
-        }
-    }
-    else
-    {
-        from = locations->getLocation(newValue);
-        if (!from)
-            qDebug() << "No location with label " << newValue << " was found.";
-    }
-    if (from)
-    {
-        qDebug() << "Emitting signal of new from selection";
-        emit(fromChanged(from));
-    }
-}
-
-void UiController::gpsBecameValid()
-{
-#ifdef Q_WS_MAEMO_5
-    QMaemo5InformationBox::information(this->m_ui->m_mainWindow, "GPS location received.");
-#endif
-    Location *gps = Locations::GetInstance()->getGpsLocation();
-    //disconnect(gps, SIGNAL(becomeValid()), this, SLOT(gpsBecameValid()));
-    this->changeFrom();
-    this->changeTo();
-}
-
-void UiController::changeTo()
-{
-    qDebug() << "To selection changed";
-    Locations *locations = Locations::GetInstance();
-    Location *to;
-
-#ifdef Q_WS_MAEMO_5
-    const QString newValue = m_ui->m_toButton->valueText();
-#else
-    const QString newValue = "";
-#endif
-    if (newValue == "GPS")
-    {
-        to = locations->getGpsLocation();
-        if (!to->isValid())
-        {
-            qDebug() << "GPS location is not valid.";
-#ifdef Q_WS_MAEMO_5
-            QMaemo5InformationBox::information(this->m_ui->m_mainWindow, "GPS location has not been received yet. Wait a moment.");
-#endif
-            //connect(to, SIGNAL(becomeValid()), this, SLOT(gpsBecameValid()));
-            return;
-        }
-    }
-    else
-    {
-        to = locations->getLocation(newValue);
-        if (!to)
-            qDebug() << "No location with label " << newValue << " was found.";
-    }
-    if (to)
-    {
-        qDebug() << "Emitting signal of new to selection";
-        emit(toChanged(to));
-    }
-}
diff --git a/zouba/src/uicontroller.h b/zouba/src/uicontroller.h
deleted file mode 100644 (file)
index 94f18fe..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef UICONTROLLER_H
-#define UICONTROLLER_H
-
-#include "routedata.h"
-#include "logic/location.h"
-
-#include <QObject>
-
-class UiClass;
-
-class UiController : public QObject
-{
-  Q_OBJECT
-
-public:
-  UiController( UiClass *ui );
-  ~UiController();
-
-public Q_SLOTS:
-  void displayRoute( const QList<RouteData> &routeData );
-  //void updateLocationSelectors();
-  void changeFrom();
-  void changeTo();
-  void gpsBecameValid();
-
-Q_SIGNALS:
-  void routeSearchRequested();
-  void fromChanged(Location *newFromLocation);
-  void toChanged(Location *newToLocation);
-
-private Q_SLOTS:
-  void changeRoute( int id );
-  void displayRouteDetail( int id );
-  void findRoute();
-
-private:
-  QList<RouteData> m_routeData;
-  UiClass *m_ui;
-  int m_currentRoute;
-};
-#endif // UICONTROLLER_H
-