d7da21f1404ebc3ac3822d73d535b640b60dbd64
6 #include <sailfishapp.h>
9 #include "journeymodel.h"
13 #include "harbour-pedalo.h"
15 int main(int argc
, char *argv
[])
17 // SailfishApp::main() will display "qml/harbour-pedalo.qml", if you need more
18 // control over initialization, you can use:
20 // - SailfishApp::application(int, char *[]) to get the QGuiApplication *
21 // - SailfishApp::createView() to get a new QQuickView * instance
22 // - SailfishApp::pathTo(QString) to get a QUrl to a resource file
23 // - SailfishApp::pathToMainQml() to get a QUrl to the main QML file
25 // To display the view, call "show()" (will show fullscreen on device).
27 QScopedPointer
<QGuiApplication
> app(SailfishApp::application(argc
, argv
));
28 // These values are used by QSettings to access the config file in
29 // /home/nemo/.local/share/flypig/harbour-pedalo.conf
30 //QCoreApplication::setOrganizationName("flypig");
31 QCoreApplication::setOrganizationDomain("www.flypig.co.uk");
32 QCoreApplication::setApplicationName(APP_NAME
);
34 Settings::instantiate();
35 qmlRegisterSingletonType
<Settings
>("harbour.pedalo.settings", 1, 0, "Settings", Settings::provider
);
37 JourneyModel journeys
;
39 Settings::getInstance().setMainStatus(currentStatus
);
40 Settings::getInstance().loadSettings();
43 file
.setFileName(Settings::getConfigDir() + "/journeys.csv");
44 journeys
.importFromFile(file
);
46 QScopedPointer
<QQuickView
> view(SailfishApp::createView());
47 view
->setSource(SailfishApp::pathTo("qml/harbour-pedalo.qml"));
49 QQmlContext
*ctxt
= view
->rootContext();
50 ctxt
->setContextProperty("journeymodel", &journeys
);
51 ctxt
->setContextProperty("currentStatus", ¤tStatus
);
54 int result
= app
->exec();
56 // Write out the journey data
58 dir
.mkpath(Settings::getConfigDir());
59 file
.setFileName(Settings::getConfigDir() + "/journeys.csv");
60 qDebug() << "File saved as: " << file
.fileName();
61 journeys
.exportToFile(file
);
63 Settings::getInstance().saveSettings();