Commit 9acbdf15 authored by Nicolas Fella's avatar Nicolas Fella

Revert "Use singleton for settings"

Breaks build

This reverts commit 54faff6c.
parent 0b84a355
......@@ -75,12 +75,12 @@ int main(int argc, char *argv[])
manager.setBackendsEnabledByDefault(false);
engine.rootContext()->setContextProperty(QStringLiteral("_manager"), &manager);
KTripSettings *settings = new KTripSettings;
manager.setEnabledBackends(settings->enabledBackends());
KTripSettings settings;
manager.setEnabledBackends(settings.enabledBackends());
QObject::connect(&manager, &KPublicTransport::Manager::configurationChanged, settings, [settings, &manager] {
settings->setEnabledBackends(manager.enabledBackends());
settings->save();
QObject::connect(&manager, &KPublicTransport::Manager::configurationChanged, &settings, [&settings, &manager]{
settings.setEnabledBackends(manager.enabledBackends());
settings.save();
});
KAboutData about(QStringLiteral("ktrip"), i18n("KTrip"), QStringLiteral("0.1"), i18n("Public transport assistant"), KAboutLicense::GPL, i18n("© 2019 KDE Community"));
......@@ -90,6 +90,8 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty(QStringLiteral("_aboutData"), QVariant::fromValue(about));
engine.rootContext()->setContextProperty(QStringLiteral("_settings"), &settings);
Formatter formatter;
engine.rootContext()->setContextProperty(QStringLiteral("_formatter"), &formatter);
......@@ -102,11 +104,6 @@ int main(int argc, char *argv[])
qmlRegisterSingletonType("org.kde.ktrip", 1, 0, "Localizer", [](QQmlEngine *, QJSEngine *engine) -> QJSValue { return engine->toScriptValue(Localizer()); });
qmlRegisterSingletonType<KTripSettings>("org.kde.ktrip", 1, 0, "Settings", [settings](QQmlEngine *, QJSEngine *engine) -> QObject * {
Q_UNUSED(engine);
return settings;
});
qmlRegisterSingletonType<Controller>("org.kde.ktrip", 1, 0, "Controller", [](QQmlEngine *, QJSEngine *engine) -> QObject * {
Q_UNUSED(engine);
return new Controller;
......
......@@ -22,8 +22,6 @@ import QtQuick 2.2
import QtQuick.Controls 2.4
import org.kde.kirigami 2.6 as Kirigami
import org.kde.ktrip 1.0
Kirigami.ApplicationWindow
{
id: window
......@@ -33,10 +31,10 @@ Kirigami.ApplicationWindow
pageStack.initialPage: Qt.resolvedUrl("QueryPage.qml")
Component.onCompleted: {
if (Settings.firstRun) {
if (_settings.firstRun) {
window.pageStack.push(Qt.resolvedUrl("BackendPage.qml"))
Settings.firstRun = false
Settings.save()
_settings.firstRun = false
_settings.save()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment