mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	ENH:optimize the management of access code
Change-Id: If8a3644207d5bca2bb10f49f8ee251b6b6219ce2
This commit is contained in:
		
							parent
							
								
									21cee56dbf
								
							
						
					
					
						commit
						3f109501ba
					
				
					 3 changed files with 15 additions and 1 deletions
				
			
		|  | @ -318,6 +318,15 @@ std::string MachineObject::get_access_code() | |||
|     return get_user_access_code(); | ||||
| } | ||||
| 
 | ||||
| void MachineObject::set_access_code(std::string code) | ||||
| { | ||||
|     this->access_code = code; | ||||
|     AppConfig* config = GUI::wxGetApp().app_config; | ||||
|     if (config && !code.empty()) { | ||||
|         GUI::wxGetApp().app_config->set_str("access_code", dev_id, code); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MachineObject::set_user_access_code(std::string code) | ||||
| { | ||||
|     this->user_access_code = code; | ||||
|  | @ -3637,6 +3646,7 @@ void DeviceManager::on_machine_alive(std::string json_str) | |||
|             AppConfig* config = Slic3r::GUI::wxGetApp().app_config; | ||||
|             if (config) { | ||||
|                 obj->set_access_code(Slic3r::GUI::wxGetApp().app_config->get("access_code", dev_id)); | ||||
|                 obj->set_user_access_code(Slic3r::GUI::wxGetApp().app_config->get("user_access_code", dev_id)); | ||||
|             } | ||||
|             localMachineList.insert(std::make_pair(dev_id, obj)); | ||||
| 
 | ||||
|  |  | |||
|  | @ -405,11 +405,14 @@ public: | |||
|     std::string connection_type() { return dev_connection_type; } | ||||
|     void set_dev_ip(std::string ip) {dev_ip = ip;}; | ||||
|     bool has_access_right() { return !get_access_code().empty(); } | ||||
|     void set_access_code(std::string code); | ||||
|     std::string get_access_code(); | ||||
| 
 | ||||
|     void set_access_code(std::string code); | ||||
|     void set_user_access_code(std::string code); | ||||
| 
 | ||||
|     std::string get_user_access_code(); | ||||
|     bool is_lan_mode_printer(); | ||||
| 
 | ||||
|     //PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
 | ||||
|     std::string printer_type;       /* model_id */ | ||||
| 
 | ||||
|  |  | |||
|  | @ -1724,6 +1724,7 @@ void GUI_App::init_networking_callbacks() | |||
|                                 event.SetInt(1); | ||||
|                                 event.SetString(obj->dev_id); | ||||
|                             } else if (state == ConnectStatus::ConnectStatusFailed) { | ||||
|                                 obj->set_access_code(""); | ||||
|                                 obj->set_user_access_code(""); | ||||
|                                 m_device_manager->set_selected_machine(""); | ||||
|                                 wxString text; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang