EntryProvider: readqsrunfile(): impl. inherit w/o using EntityConfig.update()
This commit is contained in:
		@@ -134,6 +134,19 @@ EntryConfig EntryProvider::readqsrunFile(const QString &path)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		map[key] = value;
 | 
							map[key] = value;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if(map.contains("inherit"))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							auto entry = readEntryFromPath(map["inherit"]);
 | 
				
			||||||
 | 
							if(entry)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								result = entry.value();
 | 
				
			||||||
 | 
								result.inherit = map["inherit"];
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								throw new ConfigFormatException("Error attempting to read inherited entry");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if(map.contains("arguments"))
 | 
						if(map.contains("arguments"))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		auto args = map["arguments"].split(' ');
 | 
							auto args = map["arguments"].split(' ');
 | 
				
			||||||
@@ -165,23 +178,19 @@ EntryConfig EntryProvider::readqsrunFile(const QString &path)
 | 
				
			|||||||
			throw ConfigFormatException("non-closed \" in config file " + path.toStdString());
 | 
								throw ConfigFormatException("non-closed \" in config file " + path.toStdString());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(map.contains("inherit"))
 | 
						auto assignIfSourceNotEmpty = [](QString source, QString &val) {
 | 
				
			||||||
 | 
							if(!source.isEmpty())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		result.inherit = map["inherit"];
 | 
								val = source;
 | 
				
			||||||
		auto entry = readEntryFromPath(resolveEntryPath(result.inherit));
 | 
					 | 
				
			||||||
		if(entry)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			inheritedConfig = *entry;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						};
 | 
				
			||||||
	result.key = map["key"].toLower();
 | 
						assignIfSourceNotEmpty(map["key"].toLower(), result.key);
 | 
				
			||||||
	result.command = map["command"];
 | 
						assignIfSourceNotEmpty(map["command"], result.command);
 | 
				
			||||||
 | 
						assignIfSourceNotEmpty(map["icon"], result.iconPath);
 | 
				
			||||||
 | 
						assignIfSourceNotEmpty(map["name"], result.name);
 | 
				
			||||||
	result.col = map["col"].toInt();
 | 
						result.col = map["col"].toInt();
 | 
				
			||||||
	result.row = map["row"].toInt();
 | 
						result.row = map["row"].toInt();
 | 
				
			||||||
	result.iconPath = map["icon"];
 | 
						return result;
 | 
				
			||||||
	result.name = map["name"];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return result.update(inheritedConfig);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString EntryProvider::resolveEntryPath(QString path)
 | 
					QString EntryProvider::resolveEntryPath(QString path)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user