mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-20 05:19:06 +08:00
ENH:change to generic ip address enter dialog
Change-Id: I4d3b4f091e435d600216ef8ec44d04ca7c90a26d (cherry picked from commit 5796a72a567ee1a2b3dee7508832d9e0d6348820)
This commit is contained in:
parent
341dfb9585
commit
809b38ef67
@ -4535,6 +4535,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);
|
||||||
|
@ -666,6 +666,7 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
|||||||
BOOST_LOG_TRIVIAL(info) << "send_job: send print job";
|
BOOST_LOG_TRIVIAL(info) << "send_job: send print job";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SendToPrinterDialog::clear_ip_address_config(wxCommandEvent& e)
|
void SendToPrinterDialog::clear_ip_address_config(wxCommandEvent& e)
|
||||||
{
|
{
|
||||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
@ -674,19 +675,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()
|
||||||
@ -870,30 +859,6 @@ void SendToPrinterDialog::on_selection_changed(wxCommandEvent &event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check ip address
|
|
||||||
if (obj->dev_ip.empty()) {
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "MachineObject IP is empty ";
|
|
||||||
std::string app_config_dev_ip = Slic3r::GUI::wxGetApp().app_config->get("ip_address", obj->dev_id);
|
|
||||||
|
|
||||||
if (app_config_dev_ip.empty()) {
|
|
||||||
InputIpAddressDialog dlg(this, from_u8(obj->dev_name));
|
|
||||||
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 {
|
|
||||||
obj->dev_ip = app_config_dev_ip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update_show_status();
|
update_show_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user