mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-02-02 01:48:42 +03:00
Many issues have been optimized and fixed
This commit is contained in:
@@ -521,17 +521,9 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
machine_button->SetBorderColor(wxColour(57, 51, 55));
|
||||
machine_button->SetCanFocus(false);
|
||||
machine_button->SetIsSimpleMode(m_isSimpleMode);
|
||||
wxString formattedHost = ip;
|
||||
if (!formattedHost.Lower().starts_with("http"))
|
||||
formattedHost = wxString::Format("http://%s", formattedHost);
|
||||
if (isQIDI) {
|
||||
if (!formattedHost.Lower().ends_with("10088"))
|
||||
formattedHost = wxString::Format("%s:10088", formattedHost);
|
||||
}
|
||||
|
||||
machine_button->Bind(wxEVT_BUTTON, [this, formattedHost](wxCommandEvent &event) {
|
||||
wxString url = formattedHost;
|
||||
load_url(url);
|
||||
machine_button->Bind(wxEVT_BUTTON, [this, ip](wxCommandEvent &event) {
|
||||
FormatUrl(into_u8(ip));
|
||||
});
|
||||
devicesizer->Add(machine_button, wxSizerFlags().Border(wxALL, 1).Expand());
|
||||
devicesizer->Layout();
|
||||
@@ -539,7 +531,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
|
||||
// y13
|
||||
if (isSelected)
|
||||
load_url(formattedHost);
|
||||
FormatUrl(into_u8(ip));
|
||||
}
|
||||
// y22
|
||||
std::string PrinterWebView::NormalizeVendor(const std::string& str)
|
||||
@@ -614,38 +606,9 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
machine_button->SetIsSimpleMode(m_isSimpleMode);
|
||||
|
||||
machine_button->Bind(wxEVT_BUTTON, [this, device](wxCommandEvent &event) {
|
||||
std::string formattedHost;
|
||||
if (device.isSpecialMachine)
|
||||
{
|
||||
if(wxGetApp().app_config->get("dark_color_mode") == "1")
|
||||
formattedHost = device.link_url + "&theme=dark";
|
||||
else
|
||||
formattedHost = device.link_url + "&theme=light";
|
||||
|
||||
std::string formattedHost1 = "http://fluidd_" + formattedHost;
|
||||
std::string formattedHost2 = "http://fluidd2_" + formattedHost;
|
||||
if (formattedHost1 == m_web || formattedHost2 == m_web)
|
||||
return;
|
||||
|
||||
if (m_isfluidd_1)
|
||||
{
|
||||
formattedHost = "http://fluidd_" + formattedHost;
|
||||
m_isfluidd_1 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedHost = "http://fluidd2_" + formattedHost;
|
||||
m_isfluidd_1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedHost = "http://" + device.link_url;
|
||||
}
|
||||
load_net_url(formattedHost, device.local_ip);
|
||||
FormatNetUrl(device.link_url, device.local_ip, device.isSpecialMachine);
|
||||
});
|
||||
|
||||
|
||||
devicesizer->Add(machine_button, wxSizerFlags().Border(wxALL, 1).Expand());
|
||||
devicesizer->Layout();
|
||||
m_net_buttons.push_back(machine_button);
|
||||
@@ -931,14 +894,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
m_handlerl(event);
|
||||
}
|
||||
m_ip = dlg.get_host();
|
||||
wxString url;
|
||||
if (!m_ip.Lower().starts_with("http"))
|
||||
url = wxString::Format("http://%s", m_ip);
|
||||
|
||||
if (!url.Lower().ends_with("10088"))
|
||||
url = wxString::Format("%s:10088", url);
|
||||
|
||||
load_url(url);
|
||||
FormatUrl(into_u8(m_ip));
|
||||
|
||||
SetPresetChanged(true);
|
||||
}
|
||||
@@ -1148,5 +1104,59 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel)
|
||||
|
||||
WebView::RunScript(m_browser, javascript);
|
||||
}
|
||||
|
||||
void PrinterWebView::FormatNetUrl(std::string link_url, std::string local_ip, bool isSpecialMachine)
|
||||
{
|
||||
std::string formattedHost;
|
||||
if (isSpecialMachine)
|
||||
{
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1")
|
||||
formattedHost = link_url + "&theme=dark";
|
||||
else
|
||||
formattedHost = link_url + "&theme=light";
|
||||
|
||||
std::string formattedHost1 = "http://fluidd_" + formattedHost;
|
||||
std::string formattedHost2 = "http://fluidd2_" + formattedHost;
|
||||
if (formattedHost1 == m_web || formattedHost2 == m_web)
|
||||
return;
|
||||
|
||||
if (m_isfluidd_1)
|
||||
{
|
||||
formattedHost = "http://fluidd_" + formattedHost;
|
||||
m_isfluidd_1 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedHost = "http://fluidd2_" + formattedHost;
|
||||
m_isfluidd_1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedHost = "http://" + link_url;
|
||||
}
|
||||
load_net_url(formattedHost, local_ip);
|
||||
}
|
||||
|
||||
void PrinterWebView::FormatUrl(std::string link_url)
|
||||
{
|
||||
wxString m_link_url = from_u8(link_url);
|
||||
wxString url;
|
||||
if (!m_link_url.Lower().starts_with("http"))
|
||||
url = wxString::Format("http://%s", m_link_url);
|
||||
|
||||
if (!url.Lower().ends_with("10088"))
|
||||
url = wxString::Format("%s:10088", url);
|
||||
|
||||
load_url(url);
|
||||
}
|
||||
|
||||
void PrinterWebView::SetToggleBar(bool is_net_mode)
|
||||
{
|
||||
toggleBar->SetValue(is_net_mode);
|
||||
m_isNetMode = is_net_mode;
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
|
||||
Reference in New Issue
Block a user