projects
/
harbour-pedalo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add graphs generated from journey data
[harbour-pedalo.git]
/
src
/
harbour-pedalo.cpp
diff --git
a/src/harbour-pedalo.cpp
b/src/harbour-pedalo.cpp
index
6c0094d
..
35fc77f
100644
(file)
--- a/
src/harbour-pedalo.cpp
+++ b/
src/harbour-pedalo.cpp
@@
-7,9
+7,13
@@
#include "journey.h"
#include "journeymodel.h"
#include "journey.h"
#include "journeymodel.h"
+#include "statsmodel.h"
#include "status.h"
#include "settings.h"
#include "imageprovider.h"
#include "status.h"
#include "settings.h"
#include "imageprovider.h"
+#include "graph.h"
+#include "statsweekdayave.h"
+#include "statsweekdaycongestion.h"
#include "harbour-pedalo.h"
#include "harbour-pedalo.h"
@@
-34,15
+38,26
@@
int main(int argc, char *argv[])
Settings::instantiate();
qmlRegisterSingletonType<Settings>("harbour.pedalo.settings", 1, 0, "Settings", Settings::provider);
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();
JourneyModel journeys;
Status currentStatus(journeys);
Settings::getInstance().setMainStatus(currentStatus);
Settings::getInstance().loadSettings();
+ StatsModel statsmodel;
+
+ StatsWeekdayAve statsweekdayave(&journeys);
+ statsmodel.addStats(statsweekdayave);
+
+ StatsWeekdayCongestion statsweekdaycongestion(&journeys);
+ statsmodel.addStats(statsweekdaycongestion);
+
QFile file;
file.setFileName(Settings::getConfigDir() + "/journeys.csv");
journeys.importFromFile(file);
QFile file;
file.setFileName(Settings::getConfigDir() + "/journeys.csv");
journeys.importFromFile(file);
+ journeys.sort(JourneyModel::StartRole, Qt::DescendingOrder);
QScopedPointer<QQuickView> view(SailfishApp::createView());
view->engine()->addImageProvider(QLatin1String("pedalo"), new ImageProvider(Settings::getInstance()));
QScopedPointer<QQuickView> view(SailfishApp::createView());
view->engine()->addImageProvider(QLatin1String("pedalo"), new ImageProvider(Settings::getInstance()));
@@
-54,8
+69,10
@@
int main(int argc, char *argv[])
qDebug() << "VERSION_MAJOR: " << VERSION_MAJOR;
qDebug() << "VERSION_MINOR: " << VERSION_MINOR;
qDebug() << "VERSION_BUILD: " << VERSION_BUILD;
qDebug() << "VERSION_MAJOR: " << VERSION_MAJOR;
qDebug() << "VERSION_MINOR: " << VERSION_MINOR;
qDebug() << "VERSION_BUILD: " << VERSION_BUILD;
+
ctxt->setContextProperty("journeymodel", &journeys);
ctxt->setContextProperty("currentStatus", ¤tStatus);
ctxt->setContextProperty("journeymodel", &journeys);
ctxt->setContextProperty("currentStatus", ¤tStatus);
+ ctxt->setContextProperty("statsmodel", &statsmodel);
view->show();
int result = app->exec();
view->show();
int result = app->exec();