#include "routedata.h"
#include "route.h"
-#include "ui_zouba.h"
+#include "ui.h"
#include "uicontroller.h"
#include "location.h"
+#include "gpscontroller.h"
#include "ytv.h"
#include <QDebug>
#include <QObject>
+#include <QApplication>
+#include <QMainWindow>
int main(int argc, char *argv[] )
{
QApplication app(argc, argv);
- QMainWindow *widget = new QMainWindow;
- Ui::MainWindow ui;
- ui.setupUi(widget);
+ QMainWindow *mainWindow = new QMainWindow;
+ Ui ui;
+ ui.setupUi(mainWindow);
- UiController *uiController = new UiController( &ui );
-
- Route *route = new Route();
+ UiController *uiController = new UiController( &ui );
+ Route *route = new Route();
+ GpsController *gpsController = new GpsController();
+ Location *to = new Location();
QObject::connect(
route, SIGNAL( routeReady( RouteData ) ),
uiController, SLOT( displayRoute( RouteData ) )
);
- Location *from = new Location();
- Location *to = new Location();
-
QObject::connect(
- from, SIGNAL( becomeValid() ),
- route, SLOT( setFromLocation() )
+ gpsController, SIGNAL( locationChanged( Location ) ),
+ route, SLOT( setFromLocation( Location ) )
);
+
QObject::connect(
to, SIGNAL( becomeValid() ),
route, SLOT( setToLocation() )
);
- ui.homeaddress->setText( home );
- ui.workaddress->setText( work );
-
- from->resolveAddress( home );
- to->resolveAddress( work );
-
QObject::connect(
- uiController, SIGNAL( homeAddressChanged( QString ) ),
- from, SLOT( resolveAddress( QString ) )
+ uiController, SIGNAL( homePressed() ),
+ gpsController, SLOT( startGps() )
);
- QObject::connect(
- uiController, SIGNAL( workAddressChanged( QString ) ),
- to, SLOT( resolveAddress( QString ) )
- );
+ mainWindow->show();
- /* toggle doesn't work yet because 'from' is connected to 'homeAddressChanged'
- QObject::connect(
- uiController, SIGNAL( directionChanged() ),
- route, SLOT( toggleDirection() )
- );
- */
+ to->resolveAddress( work );
- widget->show();
return app.exec();
}