harbour-quill 0.2.12: note markdown con sync WebDAV
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QQuickView>
|
||||
#include <QQmlContext>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
#include <QLocale>
|
||||
#include <QTranslator>
|
||||
#include <sailfishapp.h>
|
||||
|
||||
#include "settings.h"
|
||||
#include "downloader.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
qDebug() << "Quill v0.2.12 build" << __DATE__ << __TIME__;
|
||||
|
||||
QGuiApplication *app = SailfishApp::application(argc, argv);
|
||||
|
||||
// Identita' applicazione allineata al profilo X-Sailjail del desktop file:
|
||||
// QStandardPaths::AppConfigLocation diventa ~/.config/harbour/quill,
|
||||
// l'unica zona config persistente della sandbox di Sailfish 5.1.
|
||||
app->setOrganizationName(QStringLiteral("harbour"));
|
||||
app->setApplicationName(QStringLiteral("quill"));
|
||||
|
||||
Settings *settings = new Settings();
|
||||
settings->setParent(app);
|
||||
|
||||
// User-chosen language (Settings -> Language). "system" = follow the
|
||||
// Sailfish UI language. "en" = force English. "it" = force Italian.
|
||||
// The .qm lives in the app data dir (the RPM validator rejects
|
||||
// /usr/share/translations), so libsailfishapp's auto-load cannot be
|
||||
// used: resolve the language here and install our own translator.
|
||||
QString lang = settings->language();
|
||||
if (lang == "system") {
|
||||
const QString sys = QLocale::system().name();
|
||||
lang = sys.startsWith(QLatin1String("it")) ? QStringLiteral("it")
|
||||
: QStringLiteral("en");
|
||||
}
|
||||
if (lang == "en" || lang == "it") {
|
||||
const QList<QTranslator *> trs = app->findChildren<QTranslator *>();
|
||||
foreach (QTranslator *t, trs) {
|
||||
app->removeTranslator(t);
|
||||
t->deleteLater();
|
||||
}
|
||||
if (lang == "it") {
|
||||
QTranslator *translator = new QTranslator(app);
|
||||
if (translator->load(QStringLiteral("harbour-quill_it"),
|
||||
QStringLiteral("/usr/share/harbour-quill/translations"))) {
|
||||
app->installTranslator(translator);
|
||||
} else {
|
||||
qWarning() << "Quill: cannot load harbour-quill_it.qm";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Downloader *downloader = new Downloader(app);
|
||||
|
||||
QQuickView *view = SailfishApp::createView();
|
||||
view->rootContext()->setContextProperty("appSettings", settings);
|
||||
view->rootContext()->setContextProperty("downloader", downloader);
|
||||
|
||||
// pathTo() resolves relative to the installed app dir (/usr/share/harbour-quill);
|
||||
// a plain relative QUrl would resolve against the CWD and fail when the app
|
||||
// is launched from the launcher -> blank first screen.
|
||||
view->setSource(SailfishApp::pathTo(QStringLiteral("qml/harbour-quill.qml")));
|
||||
view->showFullScreen();
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
Reference in New Issue
Block a user