Location selector and edit window finished
[ptas] / zouba / src / main.cpp
1 #include "routedata.h"
2 #include "route.h"
3 #include "ui.h"
4 #include "uicontroller.h"
5 #include "location.h"
6 #include "gpscontroller.h"
7 #include "ytv.h"
8 #include "locations.h"
9
10 #include <QDebug>
11 #include <QObject>
12 #include <QApplication>
13 #include <QMainWindow>
14
15 int main(int argc, char *argv[] )
16 {
17     QApplication app(argc, argv);
18
19     QCoreApplication::setOrganizationName("ZouBa");
20     QCoreApplication::setOrganizationDomain("zouba.yi.org");
21     QCoreApplication::setApplicationName("ZouBa");
22
23     Locations* locations = Locations::GetInstance();
24     Locations *other_locations = Locations::GetInstance();
25     if (locations == other_locations)
26         qDebug() << "Same instance";
27     else
28         qDebug() << "!!NOT SAME INSTANCE!!";
29
30     QMainWindow *mainWindow = new QMainWindow;
31     UiClass *ui = new UiClass;;
32     ui->setupUi(mainWindow);
33
34     UiController  *uiController  = new UiController( ui );
35     Route         *route         = new Route();
36 #ifdef Q_WS_MAEMO_5
37     GpsController *gpsController = new GpsController();
38 #endif
39
40     QObject::connect(
41             route, SIGNAL( routeReady( QList<RouteData> ) ),
42             uiController, SLOT( displayRoute( QList<RouteData> ) )
43             );
44
45     /*QObject::connect(
46       gpsController, SIGNAL( gpsLocationChanged( Location* ) ),
47       uiController, SLOT()
48       );*/
49
50     QObject::connect(
51             uiController, SIGNAL(fromChanged(Location*)),
52             route, SLOT(setFromLocation(Location*)));
53
54     QObject::connect(
55             uiController, SIGNAL(toChanged(Location*)),
56             route, SLOT(setToLocation(Location*)));
57
58     QObject::connect(
59             uiController, SIGNAL(routeSearchRequested()),
60             route, SLOT(searchRoute()));
61
62     QObject::connect(
63             route, SIGNAL(busy(bool)),
64             ui, SLOT(setBusy(bool)));
65
66 #ifdef Q_WS_MAEMO_5
67     QObject::connect(
68             ui->m_UseGpsAction, SIGNAL(toggled(bool)), gpsController, SLOT(useGPS(bool)));
69 #endif
70
71     mainWindow->show();
72
73     //Locations::destroyLocations();
74
75     return app.exec();
76 }