mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:30:05 +00:00 
			
		
		
		
	Adding apply/discard/reset functionality to settings dialog
This commit is contained in:
		
							parent
							
								
									a6974e31a2
								
							
						
					
					
						commit
						87f611e026
					
				
					 10 changed files with 276 additions and 13 deletions
				
			
		|  | @ -122,6 +122,19 @@ void SettingsVariable<T>::SetValueToDefault() | |||
|    p->value_ = p->default_; | ||||
| } | ||||
| 
 | ||||
| template<class T> | ||||
| void SettingsVariable<T>::StageDefault() | ||||
| { | ||||
|    if (p->value_ != p->default_) | ||||
|    { | ||||
|       p->staged_ = p->default_; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       p->staged_.reset(); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| template<class T> | ||||
| bool SettingsVariable<T>::StageValue(const T& value) | ||||
| { | ||||
|  | @ -144,13 +157,18 @@ bool SettingsVariable<T>::StageValue(const T& value) | |||
| } | ||||
| 
 | ||||
| template<class T> | ||||
| void SettingsVariable<T>::Commit() | ||||
| bool SettingsVariable<T>::Commit() | ||||
| { | ||||
|    bool committed = false; | ||||
| 
 | ||||
|    if (p->staged_.has_value()) | ||||
|    { | ||||
|       p->value_ = std::move(*p->staged_); | ||||
|       p->staged_.reset(); | ||||
|       committed = true; | ||||
|    } | ||||
| 
 | ||||
|    return committed; | ||||
| } | ||||
| 
 | ||||
| template<class T> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat