Save custom header values by type

This commit is contained in:
GriffinR
2022-10-15 14:49:35 -04:00
parent ec626a59a7
commit 463a7e01f6
4 changed files with 75 additions and 28 deletions

View File

@@ -1440,7 +1440,28 @@ void Project::saveMap(Map *map) {
// Custom header fields.
for (QString key : map->customHeaders.keys()) {
//mapObj[key] = map->customHeaders[key];
QJsonValue value = map->customHeaders[key];
switch (value.type())
{
default:
case QJsonValue::String:
mapObj[key] = value.toString();
break;
case QJsonValue::Double:
mapObj[key] = value.toInt();
break;
case QJsonValue::Bool:
mapObj[key] = value.toBool();
break;
case QJsonValue::Array:
// TODO: Custom array values are replaced with empty strings
mapObj[key] = value.toString();
break;
case QJsonValue::Object:
// TODO: Custom object values are replaced with empty strings
mapObj[key] = value.toString();
break;
}
}
OrderedJson mapJson(mapObj);