46632e2004152a4aea098140ec6711701cb2747b
[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   qDebug() << "1";
25   qDebug() << "2";
26   qDebug() << "3";
27
28   UiController  *uiController  = new UiController( &ui );
29   Route         *route         = new Route();
30   GpsController *gpsController = new GpsController();
31
32   QObject::connect(
33       route, SIGNAL( routeReady( QList<RouteData> ) ),
34       uiController, SLOT( displayRoute( QList<RouteData> ) )
35       );
36
37   QObject::connect(
38       gpsController, SIGNAL( locationChanged( Location ) ),
39       route, SLOT( setFromLocation( Location ) )
40       );
41
42   QObject::connect(
43       uiController, SIGNAL( destinationChanged( Location ) ),
44       route, SLOT( setToLocation( Location ) )
45     );
46
47   QObject::connect(
48       uiController, SIGNAL( buttonClicked() ),
49       gpsController, SLOT( startGps() )
50     );
51
52   mainWindow->show();
53
54   return app.exec();
55 }