From f2132311e965133b737deef11fc13bf4c1549fd1 Mon Sep 17 00:00:00 2001 From: MishkaRogachev Date: Mon, 26 Mar 2018 18:19:02 +0300 Subject: [PATCH] Default settings params saves to settings --- sources/domain/services/mission_service/mission_service.cpp | 3 ++- .../qml/Views/Dashboard/Displays/AerialVehicleDisplay.qml | 1 + sources/settings/settings_provider.cpp | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sources/domain/services/mission_service/mission_service.cpp b/sources/domain/services/mission_service/mission_service.cpp index dc017538..a9842286 100644 --- a/sources/domain/services/mission_service/mission_service.cpp +++ b/sources/domain/services/mission_service/mission_service.cpp @@ -148,7 +148,8 @@ dto::MissionItemPtr MissionService::addNewMissionItem(int missionId, if (lastItem) item->setAltitudeRelative(true); item->setAltitude(settings::Provider::value( settings::parameters::defaultTakeoffAltitude).toReal()); - item->setParameter(dto::MissionItem::Pitch, 15); + item->setParameter(dto::MissionItem::Pitch, settings::Provider::value( + settings::parameters::defaultTakeoffPitch).toReal()); break; case dto::MissionItem::Landing: if (lastItem) diff --git a/sources/presentation/qml/Views/Dashboard/Displays/AerialVehicleDisplay.qml b/sources/presentation/qml/Views/Dashboard/Displays/AerialVehicleDisplay.qml index 299b12f7..5c128e7d 100644 --- a/sources/presentation/qml/Views/Dashboard/Displays/AerialVehicleDisplay.qml +++ b/sources/presentation/qml/Views/Dashboard/Displays/AerialVehicleDisplay.qml @@ -93,6 +93,7 @@ Item { Repeater { model: instrumentsModel + // Replace with Qt 5.10 Action Controls.CheckBox { text: name onCheckedChanged: instrumentVisible = checked diff --git a/sources/settings/settings_provider.cpp b/sources/settings/settings_provider.cpp index 5f02657f..ae9b0a58 100644 --- a/sources/settings/settings_provider.cpp +++ b/sources/settings/settings_provider.cpp @@ -130,7 +130,11 @@ Provider* Provider::instance() QVariant Provider::value(const QString& key) { - return instance()->d->settings.value(key, ::defaultSettings.value(key)); + if (!instance()->d->settings.contains(key)) + { + instance()->d->settings.setValue(key, ::defaultSettings.value(key)); + } + return instance()->d->settings.value(key); } bool Provider::boolValue(const QString& key)