|
|
|
@ -37,6 +37,7 @@ const char* MissionCommandUIInfo::_rawNameJsonKey = "rawName";
@@ -37,6 +37,7 @@ const char* MissionCommandUIInfo::_rawNameJsonKey = "rawName";
|
|
|
|
|
const char* MissionCommandUIInfo::_standaloneCoordinateJsonKey = "standaloneCoordinate"; |
|
|
|
|
const char* MissionCommandUIInfo::_specifiesCoordinateJsonKey = "specifiesCoordinate"; |
|
|
|
|
const char* MissionCommandUIInfo::_specifiesAltitudeOnlyJsonKey = "specifiesAltitudeOnly"; |
|
|
|
|
const char* MissionCommandUIInfo::_isLandCommandJsonKey = "isLandCommand"; |
|
|
|
|
const char* MissionCommandUIInfo::_unitsJsonKey = "units"; |
|
|
|
|
const char* MissionCommandUIInfo::_commentJsonKey = "comment"; |
|
|
|
|
const char* MissionCommandUIInfo::_advancedCategory = "Advanced"; |
|
|
|
@ -164,6 +165,15 @@ bool MissionCommandUIInfo::specifiesAltitudeOnly(void) const
@@ -164,6 +165,15 @@ bool MissionCommandUIInfo::specifiesAltitudeOnly(void) const
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool MissionCommandUIInfo::isLandCommand(void) const |
|
|
|
|
{ |
|
|
|
|
if (_infoMap.contains(_isLandCommandJsonKey)) { |
|
|
|
|
return _infoMap[_isLandCommandJsonKey].toBool(); |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MissionCommandUIInfo::_overrideInfo(MissionCommandUIInfo* uiInfo) |
|
|
|
|
{ |
|
|
|
|
// Override info values
|
|
|
|
@ -199,7 +209,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
@@ -199,7 +209,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
|
|
|
|
|
QStringList allKeys; |
|
|
|
|
allKeys << _idJsonKey << _rawNameJsonKey << _friendlyNameJsonKey << _descriptionJsonKey << _standaloneCoordinateJsonKey << _specifiesCoordinateJsonKey |
|
|
|
|
<<_friendlyEditJsonKey << _param1JsonKey << _param2JsonKey << _param3JsonKey << _param4JsonKey << _param5JsonKey << _param6JsonKey << _param7JsonKey |
|
|
|
|
<< _paramRemoveJsonKey << _categoryJsonKey << _specifiesAltitudeOnlyJsonKey; |
|
|
|
|
<< _paramRemoveJsonKey << _categoryJsonKey << _specifiesAltitudeOnlyJsonKey << _isLandCommandJsonKey; |
|
|
|
|
|
|
|
|
|
// Look for unknown keys in top level object
|
|
|
|
|
for (const QString& key: jsonObject.keys()) { |
|
|
|
@ -231,7 +241,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
@@ -231,7 +241,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
|
|
|
|
|
QList<QJsonValue::Type> types; |
|
|
|
|
types << QJsonValue::Double << QJsonValue::String << QJsonValue::String<< QJsonValue::String << QJsonValue::Bool << QJsonValue::Bool << QJsonValue::Bool |
|
|
|
|
<< QJsonValue::Object << QJsonValue::Object << QJsonValue::Object << QJsonValue::Object << QJsonValue::Object << QJsonValue::Object << QJsonValue::Object |
|
|
|
|
<< QJsonValue::String << QJsonValue::String << QJsonValue::Bool; |
|
|
|
|
<< QJsonValue::String << QJsonValue::String << QJsonValue::Bool << QJsonValue::Bool; |
|
|
|
|
if (!JsonHelper::validateKeyTypes(jsonObject, allKeys, types, internalError)) { |
|
|
|
|
errorString = _loadErrorString(internalError); |
|
|
|
|
return false; |
|
|
|
@ -262,6 +272,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
@@ -262,6 +272,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
|
|
|
|
|
if (jsonObject.contains(_specifiesAltitudeOnlyJsonKey)) { |
|
|
|
|
_infoMap[_specifiesAltitudeOnlyJsonKey] = jsonObject.value(_specifiesAltitudeOnlyJsonKey).toBool(); |
|
|
|
|
} |
|
|
|
|
if (jsonObject.contains(_isLandCommandJsonKey)) { |
|
|
|
|
_infoMap[_isLandCommandJsonKey] = jsonObject.value(_isLandCommandJsonKey).toBool(); |
|
|
|
|
} |
|
|
|
|
if (jsonObject.contains(_friendlyEditJsonKey)) { |
|
|
|
|
_infoMap[_friendlyEditJsonKey] = jsonObject.value(_friendlyEditJsonKey).toVariant(); |
|
|
|
|
} |
|
|
|
@ -289,6 +302,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
@@ -289,6 +302,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
|
|
|
|
|
if (!_infoAvailable(_specifiesCoordinateJsonKey)) { |
|
|
|
|
_setInfoValue(_specifiesCoordinateJsonKey, false); |
|
|
|
|
} |
|
|
|
|
if (!_infoAvailable(_isLandCommandJsonKey)) { |
|
|
|
|
_setInfoValue(_isLandCommandJsonKey, false); |
|
|
|
|
} |
|
|
|
|
if (!_infoAvailable(_friendlyEditJsonKey)) { |
|
|
|
|
_setInfoValue(_friendlyEditJsonKey, false); |
|
|
|
|
} |
|
|
|
|