Commit 4283729f authored by Gus Grubba's avatar Gus Grubba

Change feature default values to something that will be identified as "not...

Change feature default values to something that will be identified as "not set". When a flight is created, features with missing values (not set) are not included. Note that all these are persistent, which may create a problem if something changes (different vehicle with large weight difference for instance). As the subsequent use of these are persistent, a question may not be asked because it's already set (the brief only asks for missing or problem values).
parent ec510466
...@@ -431,7 +431,10 @@ AirMapFlightPlanManager::_updateRulesAndFeatures(std::vector<RuleSet::Id>& rules ...@@ -431,7 +431,10 @@ AirMapFlightPlanManager::_updateRulesAndFeatures(std::vector<RuleSet::Id>& rules
if(feature && feature->value().isValid()) { if(feature && feature->value().isValid()) {
switch(feature->type()) { switch(feature->type()) {
case AirspaceRuleFeature::Boolean: case AirspaceRuleFeature::Boolean:
features[feature->name().toStdString()] = RuleSet::Feature::Value(feature->value().toBool()); //-- Skip not set responses (feature->value is initialized to "2")
if(feature->value().toInt() == 0 || feature->value().toInt() == 1) {
features[feature->name().toStdString()] = RuleSet::Feature::Value(feature->value().toBool());
}
break; break;
case AirspaceRuleFeature::Float: case AirspaceRuleFeature::Float:
//-- Sanity check for floats //-- Sanity check for floats
......
...@@ -31,12 +31,10 @@ AirMapRuleFeature::AirMapRuleFeature(airmap::RuleSet::Feature feature, QObject* ...@@ -31,12 +31,10 @@ AirMapRuleFeature::AirMapRuleFeature(airmap::RuleSet::Feature feature, QObject*
settings.beginGroup(kAirMapFeatureGroup); settings.beginGroup(kAirMapFeatureGroup);
switch(_feature.type) { switch(_feature.type) {
case RuleSet::Feature::Type::boolean: case RuleSet::Feature::Type::boolean:
_value = settings.value(name(), false); _value = settings.value(name(), 2);
break;; break;;
case RuleSet::Feature::Type::floating_point: case RuleSet::Feature::Type::floating_point:
//_value = settings.value(name(), 0.0f); _value = settings.value(name(), NAN);
//-- Default to 1 for now
_value = settings.value(name(), 1.0f);
break;; break;;
case RuleSet::Feature::Type::string: case RuleSet::Feature::Type::string:
_value = settings.value(name(), QString()); _value = settings.value(name(), QString());
......
...@@ -56,7 +56,7 @@ Rectangle { ...@@ -56,7 +56,7 @@ Rectangle {
QGCCheckBox { QGCCheckBox {
id: checkBox id: checkBox
text: "" text: ""
checked: feature.value ? feature.value : false checked: feature.value && feature.value < 2 ? feature.value : false
onClicked: feature.value = checked onClicked: feature.value = checked
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
......
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