Support multiple graphs
[harbour-pedalo.git] / src / harbour-pedalo.cpp
index e8f123d..abbe2be 100644 (file)
@@ -7,9 +7,11 @@
 
 #include "journey.h"
 #include "journeymodel.h"
+#include "statsmodel.h"
 #include "status.h"
 #include "settings.h"
 #include "imageprovider.h"
+#include "graph.h"
 
 #include "harbour-pedalo.h"
 
@@ -34,12 +36,29 @@ int main(int argc, char *argv[])
 
     Settings::instantiate();
     qmlRegisterSingletonType<Settings>("harbour.pedalo.settings", 1, 0, "Settings", Settings::provider);
+    qmlRegisterType<JourneyModel>("harbour.pedalo.journeymodel", 1, 0, "JourneyModel");
+    qmlRegisterType<Graph>("harbour.pedalo.graph", 1, 0, "Graph");
 
     JourneyModel journeys;
     Status currentStatus(journeys);
     Settings::getInstance().setMainStatus(currentStatus);
     Settings::getInstance().loadSettings();
 
+    StatsModel statsmodel;
+    Stats stats;
+    QList<float> data{0.1, 0.1, 0.2};
+    QStringList labels{"A", "B", "C"};
+    stats.setValues(data);
+    stats.setLabels(labels);
+    statsmodel.addStats(stats);
+
+    data = QList<float>{0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.5};
+    labels = QStringList{"M", "T", "W", "Th", "F", "S", "Su"};
+    stats.setValues(data);
+    stats.setLabels(labels);
+    statsmodel.addStats(stats);
+
+
     QFile file;
     file.setFileName(Settings::getConfigDir() + "/journeys.csv");
     journeys.importFromFile(file);
@@ -58,6 +77,7 @@ int main(int argc, char *argv[])
 
     ctxt->setContextProperty("journeymodel", &journeys);
     ctxt->setContextProperty("currentStatus", &currentStatus);
+    ctxt->setContextProperty("statsmodel", &statsmodel);
 
     view->show();
     int result = app->exec();