@@ -1116,7 +1116,35 @@ bool Configurator::Load() {
11161116 // TAB_LAYERS_PATHS
11171117 if (json_interface_object.value (GetToken (TAB_LAYERS_PATHS)) != QJsonValue::Undefined) {
11181118 const QJsonObject& json_object = json_interface_object.value (GetToken (TAB_LAYERS_PATHS)).toObject ();
1119- (void )json_object;
1119+ if (json_object.value (" last_driver_dir" ) != QJsonValue::Undefined) {
1120+ this ->layers .last_layers_dir = json_object.value (" last_driver_dir" ).toString ().toStdString ();
1121+ }
1122+ if (json_object.value (" validate_manifests" ) != QJsonValue::Undefined) {
1123+ this ->layers .validate_manifests = json_object.value (" validate_manifests" ).toBool ();
1124+ }
1125+ if (json_object.value (" paths" ) != QJsonValue::Undefined) {
1126+ const QJsonObject& json_object_paths = json_object.value (" paths" ).toObject ();
1127+ QStringList keys = json_object_paths.keys ();
1128+ for (std::size_t i = 0 , n = keys.size (); i < n; ++i) {
1129+ const QJsonArray& json_descriptors = json_object_paths.value (keys[i]).toArray ();
1130+
1131+ std::vector<LayerDisplay> descriptors;
1132+ for (std::size_t j = 0 , o = json_descriptors.size (); j < o; ++j) {
1133+ const QJsonObject& json_descriptor_object = json_descriptors[j].toObject ();
1134+
1135+ LayerDisplay display;
1136+ display.id .key = json_descriptor_object.value (" key" ).toString ().toStdString ();
1137+ display.id .manifest_path = keys[i].toStdString ();
1138+ display.id .api_version = Version::NONE;
1139+ display.descriptor .enabled = json_descriptor_object.value (" enabled" ).toBool ();
1140+ display.descriptor .removed = json_descriptor_object.value (" removed" ).toBool ();
1141+ display.descriptor .validated = json_descriptor_object.value (" validated" ).toBool ();
1142+ descriptors.push_back (display);
1143+ }
1144+
1145+ this ->layers .AppendInit (Path (keys[i].toStdString ()), descriptors);
1146+ }
1147+ }
11201148 }
11211149
11221150 // TAB_DRIVERS
@@ -1199,6 +1227,10 @@ bool Configurator::Load() {
11991227 if (json_interface_object.value (GetToken (TAB_PREFERENCES)) != QJsonValue::Undefined) {
12001228 const QJsonObject& json_object = json_interface_object.value (GetToken (TAB_PREFERENCES)).toObject ();
12011229
1230+ if (json_object.value (" validate_manifests" ) != QJsonValue::Undefined) {
1231+ this ->layers .validate_manifests = json_object.value (" validate_manifests" ).toBool ();
1232+ }
1233+
12021234 if (json_object.value (" use_notify_releases" ) != QJsonValue::Undefined) {
12031235 this ->use_notify_releases = json_object.value (" use_notify_releases" ).toBool ();
12041236 }
@@ -1311,7 +1343,41 @@ bool Configurator::Save() const {
13111343 }
13121344
13131345 // TAB_LAYERS_PATHS
1314- {}
1346+ {
1347+ std::map<Path, std::map<std::string, LayerDisplay>> data = this ->layers .BuildLayerStoreList ();
1348+
1349+ QJsonObject json_layer_paths;
1350+ for (auto it = data.begin (); it != data.end (); ++it) {
1351+ std::map<std::string, LayerDisplay> descriptors = it->second ;
1352+
1353+ QJsonArray json_layer_descriptors;
1354+
1355+ bool all_removed = true ; // Only remember paths that don't have all layer removed
1356+
1357+ for (auto jt = it->second .begin (); jt != it->second .end (); ++jt) {
1358+ if (!jt->second .descriptor .removed ) {
1359+ all_removed = false ;
1360+ }
1361+
1362+ QJsonObject json_descriptor;
1363+ json_descriptor.insert (" key" , jt->first .c_str ());
1364+ json_descriptor.insert (" validated" , jt->second .descriptor .validated );
1365+ json_descriptor.insert (" enabled" , jt->second .descriptor .enabled );
1366+ json_descriptor.insert (" removed" , jt->second .descriptor .removed );
1367+
1368+ json_layer_descriptors.append (json_descriptor);
1369+ }
1370+
1371+ if (!all_removed) {
1372+ json_layer_paths.insert (it->first .AbsolutePath ().c_str (), json_layer_descriptors);
1373+ }
1374+ }
1375+
1376+ QJsonObject json_object;
1377+ json_object.insert (" paths" , json_layer_paths);
1378+ json_object.insert (" last_driver_dir" , this ->layers .last_layers_dir .AbsolutePath ().c_str ());
1379+ json_interface_object.insert (::GetToken (TAB_LAYERS_PATHS), json_object);
1380+ }
13151381
13161382 // TAB_DRIVER
13171383 {
@@ -1380,6 +1446,7 @@ bool Configurator::Save() const {
13801446 // TAB_PREFERENCES
13811447 {
13821448 QJsonObject json_object;
1449+ json_object.insert (" validate_manifests" , this ->layers .validate_manifests );
13831450 json_object.insert (" use_system_tray" , this ->use_system_tray );
13841451 json_object.insert (" use_layer_debug_mode" , this ->use_layer_debug_mode );
13851452 json_object.insert (" current_theme_mode" , ::GetToken (this ->current_theme_mode ));
0 commit comments