Added dialogs to change home and work locations.
[ptas] / zouba / 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 "messagehandler.h"
9 #include "messagetable.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   QMainWindow *mainWindow = new QMainWindow;
21   Ui ui;
22   ui.setupUi(mainWindow);
23
24   UiController  *uiController  = new UiController( &ui );
25   Route         *route         = new Route();
26   GpsController *gpsController = new GpsController();
27
28   QObject::connect(
29       route, SIGNAL( routeReady( QList<RouteData> ) ),
30       uiController, SLOT( displayRoute( QList<RouteData> ) )
31       );
32
33   QObject::connect(
34       gpsController, SIGNAL( locationChanged( Location* ) ),
35       route, SLOT( setFromLocation( Location* ) )
36       );
37
38   QObject::connect(
39       uiController, SIGNAL( destinationChanged( Location* ) ),
40       route, SLOT( setToLocation( Location* ) )
41     );
42
43   QObject::connect(
44       uiController, SIGNAL( buttonClicked() ),
45       gpsController, SLOT( startGps() )
46     );
47
48   mainWindow->show();
49
50   return app.exec();
51 }