mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:20:06 +00:00 
			
		
		
		
	Add checks to prevent files being saved before being fully read.
This commit is contained in:
		
							parent
							
								
									f3c846f0b1
								
							
						
					
					
						commit
						bc79ed11a3
					
				
					 5 changed files with 31 additions and 1 deletions
				
			
		|  | @ -96,6 +96,8 @@ public: | |||
|       manager::PlacefileManager::Instance()}; | ||||
| 
 | ||||
|    types::LayerVector layers_ {}; | ||||
| 
 | ||||
|    bool fileRead_ {false}; | ||||
| }; | ||||
| 
 | ||||
| LayerModel::LayerModel(QObject* parent) : | ||||
|  | @ -201,6 +203,8 @@ void LayerModel::Impl::ReadLayerSettings() | |||
|       // Assign read layers
 | ||||
|       layers_.swap(newLayers); | ||||
|    } | ||||
| 
 | ||||
|    fileRead_ = true; | ||||
| } | ||||
| 
 | ||||
| void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers) | ||||
|  | @ -314,6 +318,10 @@ void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers) | |||
| 
 | ||||
| void LayerModel::Impl::WriteLayerSettings() | ||||
| { | ||||
|    if (!fileRead_) | ||||
|    { | ||||
|       return; | ||||
|    } | ||||
|    logger_->info("Saving layer settings"); | ||||
| 
 | ||||
|    auto layerJson = boost::json::value_from(layers_); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak