mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	ENH:change to generic ip address enter dialog
Change-Id: I4d3b4f091e435d600216ef8ec44d04ca7c90a26d (cherry picked from commit 5796a72a567ee1a2b3dee7508832d9e0d6348820)
This commit is contained in:
		
							parent
							
								
									ea664b6e13
								
							
						
					
					
						commit
						d38fd70c2e
					
				
					 3 changed files with 23 additions and 25 deletions
				
			
		|  | @ -4556,6 +4556,26 @@ void GUI_App::update_mode() | ||||||
|     plater()->canvas3D()->update_gizmos_on_off_state(); |     plater()->canvas3D()->update_gizmos_on_off_state(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void GUI_App::show_ip_address_enter_dialog() | ||||||
|  | { | ||||||
|  |     DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); | ||||||
|  |     if (!dev) return; | ||||||
|  |     if (!dev->get_selected_machine()) return; | ||||||
|  |     auto obj = dev->get_selected_machine(); | ||||||
|  |     InputIpAddressDialog dlg(nullptr, from_u8(dev->get_selected_machine()->dev_name)); | ||||||
|  |     dlg.Bind(EVT_ENTER_IP_ADDRESS, [this, obj](wxCommandEvent& e) { | ||||||
|  |         auto ip_address = e.GetString(); | ||||||
|  |         BOOST_LOG_TRIVIAL(info) << "User enter IP address is " << ip_address; | ||||||
|  |         if (!ip_address.empty()) { | ||||||
|  |             wxGetApp().app_config->set_str("ip_address", obj->dev_id, ip_address.ToStdString()); | ||||||
|  |             wxGetApp().app_config->save(); | ||||||
|  |             obj->dev_ip = ip_address.ToStdString(); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         }); | ||||||
|  |     dlg.ShowModal(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| //void GUI_App::add_config_menu(wxMenuBar *menu)
 | //void GUI_App::add_config_menu(wxMenuBar *menu)
 | ||||||
| //void GUI_App::add_config_menu(wxMenu *menu)
 | //void GUI_App::add_config_menu(wxMenu *menu)
 | ||||||
| //{
 | //{
 | ||||||
|  |  | ||||||
|  | @ -437,6 +437,7 @@ public: | ||||||
|     ConfigOptionMode get_mode(); |     ConfigOptionMode get_mode(); | ||||||
|     void            save_mode(const /*ConfigOptionMode*/int mode) ; |     void            save_mode(const /*ConfigOptionMode*/int mode) ; | ||||||
|     void            update_mode(); |     void            update_mode(); | ||||||
|  |     void            show_ip_address_enter_dialog(); | ||||||
| 
 | 
 | ||||||
|     // BBS
 |     // BBS
 | ||||||
|     //void            add_config_menu(wxMenuBar *menu);
 |     //void            add_config_menu(wxMenuBar *menu);
 | ||||||
|  |  | ||||||
|  | @ -674,19 +674,7 @@ void SendToPrinterDialog::clear_ip_address_config(wxCommandEvent& e) | ||||||
|     auto obj = dev->get_selected_machine(); |     auto obj = dev->get_selected_machine(); | ||||||
|     Slic3r::GUI::wxGetApp().app_config->set_str("ip_address", obj->dev_id, ""); |     Slic3r::GUI::wxGetApp().app_config->set_str("ip_address", obj->dev_id, ""); | ||||||
|     Slic3r::GUI::wxGetApp().app_config->save(); |     Slic3r::GUI::wxGetApp().app_config->save(); | ||||||
| 
 |     wxGetApp().show_ip_address_enter_dialog(); | ||||||
|     InputIpAddressDialog dlg(this, from_u8(dev->get_selected_machine()->dev_name)); |  | ||||||
|     dlg.Bind(EVT_ENTER_IP_ADDRESS, [this, obj](wxCommandEvent& e) { |  | ||||||
|         auto ip_address = e.GetString(); |  | ||||||
|         BOOST_LOG_TRIVIAL(info) << "User enter IP address is " << ip_address; |  | ||||||
|         if (!ip_address.empty()) { |  | ||||||
|             wxGetApp().app_config->set_str("ip_address", obj->dev_id, ip_address.ToStdString()); |  | ||||||
|             wxGetApp().app_config->save(); |  | ||||||
|             obj->dev_ip = ip_address.ToStdString(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         }); |  | ||||||
|     dlg.ShowModal(); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void SendToPrinterDialog::update_user_machine_list() | void SendToPrinterDialog::update_user_machine_list() | ||||||
|  | @ -876,18 +864,7 @@ void SendToPrinterDialog::on_selection_changed(wxCommandEvent &event) | ||||||
|         std::string app_config_dev_ip = Slic3r::GUI::wxGetApp().app_config->get("ip_address", obj->dev_id); |         std::string app_config_dev_ip = Slic3r::GUI::wxGetApp().app_config->get("ip_address", obj->dev_id); | ||||||
| 
 | 
 | ||||||
|         if (app_config_dev_ip.empty()) { |         if (app_config_dev_ip.empty()) { | ||||||
|             InputIpAddressDialog dlg(this, from_u8(obj->dev_name)); |             wxGetApp().show_ip_address_enter_dialog(); | ||||||
|             dlg.Bind(EVT_ENTER_IP_ADDRESS, [this, obj, app_config_dev_ip](wxCommandEvent& e) { |  | ||||||
|                 auto ip_address = e.GetString(); |  | ||||||
|                 BOOST_LOG_TRIVIAL(info) << "User enter IP address is "<< ip_address; |  | ||||||
|                 if (!ip_address.empty()) { |  | ||||||
|                     wxGetApp().app_config->set_str("ip_address", obj->dev_id, ip_address.ToStdString()); |  | ||||||
|                     wxGetApp().app_config->save(); |  | ||||||
|                     obj->dev_ip = ip_address.ToStdString(); |  | ||||||
|                 } |  | ||||||
|                  |  | ||||||
|             }); |  | ||||||
|             dlg.ShowModal(); |  | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             obj->dev_ip = app_config_dev_ip; |             obj->dev_ip = app_config_dev_ip; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang