Skip to content

Commit

Permalink
Default settings params saves to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MishkaRogachev committed Mar 26, 2018
1 parent 1ec546e commit f213231
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sources/domain/services/mission_service/mission_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Item {
Repeater {
model: instrumentsModel

// Replace with Qt 5.10 Action
Controls.CheckBox {
text: name
onCheckedChanged: instrumentVisible = checked
Expand Down
6 changes: 5 additions & 1 deletion sources/settings/settings_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f213231

Please sign in to comment.