Changes: gps controller uses labels for fake gps
[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 "messagetable.h"
9 #include "messagehandler.h"
10
11 #include <QDebug>
12 #include <QObject>
13 #include <QApplication>
14 #include <QMainWindow>
15
16 int main(int argc, char *argv[] )
17 {
18   //qInstallMsgHandler( messageHandler );
19   QApplication app(argc, argv);
20
21   QMainWindow *mainWindow = new QMainWindow;
22   Ui *ui = new Ui;;
23   ui->setupUi(mainWindow);
24
25   UiController  *uiController  = new UiController( ui );
26   Route         *route         = new Route();
27   GpsController *gpsController = new GpsController();
28
29   QObject::connect(
30       route, SIGNAL( routeReady( QList<RouteData> ) ),
31       uiController, SLOT( displayRoute( QList<RouteData> ) )
32       );
33
34   QObject::connect(
35       gpsController, SIGNAL( locationChanged( Location* ) ),
36       route, SLOT( setFromLocation( Location* ) )
37       );
38
39   QObject::connect(
40       uiController, SIGNAL( destinationChanged( Location* ) ),
41       route, SLOT( setToLocation( Location* ) )
42     );
43
44   QObject::connect(
45       uiController, SIGNAL( buttonClicked() ),
46       gpsController, SLOT( getGps() )
47     );
48
49   QObject::connect(
50       ui, SIGNAL( fakeGpsPressed( const QString & ) ),
51       gpsController, SLOT( useFakeGps( const QString & ) )
52     );
53
54   QObject::connect(
55       ui, SIGNAL( liveGpsPressed() ),
56       gpsController, SLOT( useLiveGps() )
57     );
58
59   mainWindow->show();
60
61   return app.exec();
62 }