Do not hardcode 'Pictures', use PicturesLocation instead

This commit is contained in:
Andrea Scarpino 2015-06-16 21:32:20 +02:00
parent 8b07b6338b
commit d4fee6abeb
2 changed files with 7 additions and 6 deletions

View file

@ -24,18 +24,18 @@ QString papocchioDir();
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QGuiApplication *app = SailfishApp::application(argc, argv); QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> view(SailfishApp::createView());
// Otherwise the Canvas is cleaned when the application is not // Otherwise the Canvas is cleaned when the application is not
// marked as active. See for more: // marked as active. See for more:
// https://lists.sailfishos.org/pipermail/devel/2014-October/005065.html // https://lists.sailfishos.org/pipermail/devel/2014-October/005065.html
QQuickView *view = SailfishApp::createView();
view->setSource(SailfishApp::pathTo("qml/Papocchio.qml"));
view->setPersistentOpenGLContext(true); view->setPersistentOpenGLContext(true);
view->setPersistentSceneGraph(true); view->setPersistentSceneGraph(true);
view->rootContext()->setContextProperty("papocchioDir", papocchioDir()); view->rootContext()->setContextProperty("papocchioDir", papocchioDir());
view->setSource(SailfishApp::pathTo("qml/Papocchio.qml"));
view->show(); view->show();
return app->exec(); return app->exec();
@ -48,11 +48,12 @@ int main(int argc, char *argv[])
*/ */
QString papocchioDir() QString papocchioDir()
{ {
QDir papocchioDir(QDir::homePath() + "/Pictures/Papocchio"); const QDir papocchioDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)
+ QDir::separator() + "Papocchio");
if (!papocchioDir.exists()) { if (!papocchioDir.exists()) {
papocchioDir.mkpath(papocchioDir.absolutePath()); papocchioDir.mkpath(papocchioDir.absolutePath());
} }
return QString(papocchioDir.absolutePath() + "/"); return QString(papocchioDir.absolutePath() + QDir::separator());
} }

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.0"> <TS version="2.1">
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>
<message> <message>