mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Merge pull request #4140 from zhaowenlan1779/input-config
citra_qt/configuration: misc input tab improvements
This commit is contained in:
		
						commit
						b2bfcfcbd7
					
				
					 5 changed files with 119 additions and 19 deletions
				
			
		|  | @ -19,7 +19,15 @@ constexpr char KEY_VALUE_SEPARATOR_ESCAPE[] = "$0"; | |||
| constexpr char PARAM_SEPARATOR_ESCAPE[] = "$1"; | ||||
| constexpr char ESCAPE_CHARACTER_ESCAPE[] = "$2"; | ||||
| 
 | ||||
| /// A placeholder for empty param packages to avoid empty strings
 | ||||
| /// (they may be recognized as "not set" by some frontend libraries like qt)
 | ||||
| constexpr char EMPTY_PLACEHOLDER[] = "[empty]"; | ||||
| 
 | ||||
| ParamPackage::ParamPackage(const std::string& serialized) { | ||||
|     if (serialized == EMPTY_PLACEHOLDER) { | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     std::vector<std::string> pairs; | ||||
|     Common::SplitString(serialized, PARAM_SEPARATOR, pairs); | ||||
| 
 | ||||
|  | @ -45,7 +53,7 @@ ParamPackage::ParamPackage(std::initializer_list<DataType::value_type> list) : d | |||
| 
 | ||||
| std::string ParamPackage::Serialize() const { | ||||
|     if (data.empty()) | ||||
|         return ""; | ||||
|         return EMPTY_PLACEHOLDER; | ||||
| 
 | ||||
|     std::string result; | ||||
| 
 | ||||
|  | @ -119,4 +127,12 @@ bool ParamPackage::Has(const std::string& key) const { | |||
|     return data.find(key) != data.end(); | ||||
| } | ||||
| 
 | ||||
| void ParamPackage::Erase(const std::string& key) { | ||||
|     data.erase(key); | ||||
| } | ||||
| 
 | ||||
| void ParamPackage::Clear() { | ||||
|     data.clear(); | ||||
| } | ||||
| 
 | ||||
| } // namespace Common
 | ||||
|  |  | |||
|  | @ -32,6 +32,8 @@ public: | |||
|     void Set(const std::string& key, int value); | ||||
|     void Set(const std::string& key, float value); | ||||
|     bool Has(const std::string& key) const; | ||||
|     void Erase(const std::string& key); | ||||
|     void Clear(); | ||||
| 
 | ||||
| private: | ||||
|     DataType data; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue