X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=src%2Fharbour-pedalo.cpp;h=729edae2592b4825ca93f4bfefa4f45454b85e26;hp=216240d2444888f86c7faac66cda1e39162f637c;hb=41ee443df2b12e7a4373be580006f57cc5fd768a;hpb=7d6ca1150d70c17469e48d71920dfe6083e1a719 diff --git a/src/harbour-pedalo.cpp b/src/harbour-pedalo.cpp index 216240d..729edae 100644 --- a/src/harbour-pedalo.cpp +++ b/src/harbour-pedalo.cpp @@ -10,6 +10,7 @@ #include "status.h" #include "settings.h" #include "imageprovider.h" +#include "graph.h" #include "harbour-pedalo.h" @@ -34,15 +35,18 @@ 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; + Status currentStatus(journeys); Settings::getInstance().setMainStatus(currentStatus); Settings::getInstance().loadSettings(); QFile file; file.setFileName(Settings::getConfigDir() + "/journeys.csv"); journeys.importFromFile(file); + journeys.sort(JourneyModel::StartRole, Qt::DescendingOrder); QScopedPointer view(SailfishApp::createView()); view->engine()->addImageProvider(QLatin1String("pedalo"), new ImageProvider(Settings::getInstance())); @@ -54,6 +58,7 @@ int main(int argc, char *argv[]) qDebug() << "VERSION_MAJOR: " << VERSION_MAJOR; qDebug() << "VERSION_MINOR: " << VERSION_MINOR; qDebug() << "VERSION_BUILD: " << VERSION_BUILD; + ctxt->setContextProperty("journeymodel", &journeys); ctxt->setContextProperty("currentStatus", ¤tStatus);