X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=src%2Fharbour-pedalo.cpp;h=f19a8fcc0dd56df91b931f93cf487a1af889fa72;hp=e8f123dd1728db6debfe7ed8eef1ba2df6f72588;hb=e6c4099f5bb1565a770e55d1dd671d846dcbd68b;hpb=70180c4c4fd2807d16f90562d6876f3f07d388b1 diff --git a/src/harbour-pedalo.cpp b/src/harbour-pedalo.cpp index e8f123d..f19a8fc 100644 --- a/src/harbour-pedalo.cpp +++ b/src/harbour-pedalo.cpp @@ -7,9 +7,15 @@ #include "journey.h" #include "journeymodel.h" +#include "statsmodel.h" #include "status.h" #include "settings.h" #include "imageprovider.h" +#include "graph.h" +#include "statsweekdayave.h" +#include "statshourjourneys.h" +#include "statsweekdaycongestion.h" +#include "statshourcongestion.h" #include "harbour-pedalo.h" @@ -34,12 +40,28 @@ int main(int argc, char *argv[]) Settings::instantiate(); qmlRegisterSingletonType("harbour.pedalo.settings", 1, 0, "Settings", Settings::provider); + qmlRegisterType("harbour.pedalo.journeymodel", 1, 0, "JourneyModel"); + qmlRegisterType("harbour.pedalo.graph", 1, 0, "Graph"); JourneyModel journeys; Status currentStatus(journeys); Settings::getInstance().setMainStatus(currentStatus); Settings::getInstance().loadSettings(); + StatsModel statsmodel; + + StatsWeekdayAve statsweekdayave(&journeys); + statsmodel.addStats(statsweekdayave); + + StatsHourJourneys statshourjourneys(&journeys); + statsmodel.addStats(statshourjourneys); + + StatsWeekdayCongestion statsweekdaycongestion(&journeys); + statsmodel.addStats(statsweekdaycongestion); + + StatsHourCongestion statshourcongestion(&journeys); + statsmodel.addStats(statshourcongestion); + QFile file; file.setFileName(Settings::getConfigDir() + "/journeys.csv"); journeys.importFromFile(file); @@ -58,6 +80,7 @@ int main(int argc, char *argv[]) ctxt->setContextProperty("journeymodel", &journeys); ctxt->setContextProperty("currentStatus", ¤tStatus); + ctxt->setContextProperty("statsmodel", &statsmodel); view->show(); int result = app->exec();