6 #include <sailfishapp.h>
9 #include "journeymodel.h"
11 int main(int argc
, char *argv
[])
13 // SailfishApp::main() will display "qml/harbour-pedalo.qml", if you need more
14 // control over initialization, you can use:
16 // - SailfishApp::application(int, char *[]) to get the QGuiApplication *
17 // - SailfishApp::createView() to get a new QQuickView * instance
18 // - SailfishApp::pathTo(QString) to get a QUrl to a resource file
19 // - SailfishApp::pathToMainQml() to get a QUrl to the main QML file
21 // To display the view, call "show()" (will show fullscreen on device).
23 QScopedPointer
<QGuiApplication
> app(SailfishApp::application(argc
, argv
));
25 JourneyModel journeys
;
28 file
.setFileName(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation
) + "/journeys.csv");
29 journeys
.importFromFile(file
);
31 QScopedPointer
<QQuickView
> view(SailfishApp::createView());
32 view
->setSource(SailfishApp::pathTo("qml/harbour-pedalo.qml"));
34 QQmlContext
*ctxt
= view
->rootContext();
35 ctxt
->setContextProperty("journeymodel", &journeys
);
38 int result
= app
->exec();
40 // Write out the journey data
42 dir
.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation
));
43 file
.setFileName(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation
) + "/journeys.csv");
44 qDebug() << "File saved as: " << file
.fileName();
45 journeys
.exportToFile(file
);