144ddd312e5d0b63d4081c6da473ddf64fb75a23
6 #include <sailfishapp.h>
9 #include "journeymodel.h"
12 int main(int argc
, char *argv
[])
14 // SailfishApp::main() will display "qml/harbour-pedalo.qml", if you need more
15 // control over initialization, you can use:
17 // - SailfishApp::application(int, char *[]) to get the QGuiApplication *
18 // - SailfishApp::createView() to get a new QQuickView * instance
19 // - SailfishApp::pathTo(QString) to get a QUrl to a resource file
20 // - SailfishApp::pathToMainQml() to get a QUrl to the main QML file
22 // To display the view, call "show()" (will show fullscreen on device).
24 QScopedPointer
<QGuiApplication
> app(SailfishApp::application(argc
, argv
));
26 JourneyModel journeys
;
30 file
.setFileName(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation
) + "/journeys.csv");
31 journeys
.importFromFile(file
);
33 QScopedPointer
<QQuickView
> view(SailfishApp::createView());
34 view
->setSource(SailfishApp::pathTo("qml/harbour-pedalo.qml"));
36 QQmlContext
*ctxt
= view
->rootContext();
37 ctxt
->setContextProperty("journeymodel", &journeys
);
38 ctxt
->setContextProperty("currentStatus", ¤tStatus
);
41 int result
= app
->exec();
43 // Write out the journey data
45 dir
.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation
));
46 file
.setFileName(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation
) + "/journeys.csv");
47 qDebug() << "File saved as: " << file
.fileName();
48 journeys
.exportToFile(file
);