ENH: refine vcamera guide link

Change-Id: Ia94b7c5da9ed6a45c542dac177d0ea2b262c2d95
This commit is contained in:
tao.jin 2022-12-28 15:44:08 +08:00 committed by Lane.Wei
parent d16dee04af
commit db94a8dbba
2 changed files with 27 additions and 5 deletions

View file

@ -84,10 +84,26 @@ CameraPopup::CameraPopup(wxWindow *parent, MachineObject* obj)
main_sizer->Add(top_sizer, 0, wxALL, FromDIP(10)); main_sizer->Add(top_sizer, 0, wxALL, FromDIP(10));
auto url = wxString::Format(L"https://wiki.bambulab.com/%s/software/bambu-studio/virtual-camera", L"en"); auto url = wxString::Format(L"https://wiki.bambulab.com/%s/software/bambu-studio/virtual-camera", L"en");
vcamera_guide_link = new wxHyperlinkCtrl(m_panel, wxID_ANY, _L("Show \"Live Video\" guide page."), auto text = _L("Show \"Live Video\" guide page.");
url, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
wxBoxSizer* link_sizer = new wxBoxSizer(wxVERTICAL);
vcamera_guide_link = new Label(m_panel, text);
vcamera_guide_link->Wrap(-1);
vcamera_guide_link->SetForegroundColour(wxColour(0x1F, 0x8E, 0xEA));
auto text_size = vcamera_guide_link->GetTextExtent(text);
vcamera_guide_link->Bind(wxEVT_LEFT_DOWN, [this, url](wxMouseEvent& e) {wxLaunchDefaultBrowser(url); });
link_underline = new wxPanel(m_panel, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
link_underline->SetBackgroundColour(wxColour(0x1F, 0x8E, 0xEA));
link_underline->SetSize(wxSize(text_size.x, 1));
link_underline->SetMinSize(wxSize(text_size.x, 1));
vcamera_guide_link->Hide(); vcamera_guide_link->Hide();
main_sizer->Add(vcamera_guide_link, 0, wxALL, FromDIP(15)); link_underline->Hide();
link_sizer->Add(vcamera_guide_link, 0, wxALL, 0);
link_sizer->Add(link_underline, 0, wxALL, 0);
main_sizer->Add(link_sizer, 0, wxALL, FromDIP(15));
m_panel->SetSizer(main_sizer); m_panel->SetSizer(main_sizer);
m_panel->Layout(); m_panel->Layout();
@ -225,10 +241,12 @@ void CameraPopup::sync_vcamera_state(bool show_vcamera)
if (is_vcamera_show) { if (is_vcamera_show) {
m_switch_vcamera->SetValue(true); m_switch_vcamera->SetValue(true);
vcamera_guide_link->Show(); vcamera_guide_link->Show();
link_underline->Show();
} }
else { else {
m_switch_vcamera->SetValue(false); m_switch_vcamera->SetValue(false);
vcamera_guide_link->Hide(); vcamera_guide_link->Hide();
link_underline->Hide();
} }
rescale(); rescale();
@ -248,12 +266,15 @@ void CameraPopup::check_func_supported()
if (m_obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_CAMERA) && m_obj->has_ipcam) { if (m_obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_CAMERA) && m_obj->has_ipcam) {
m_text_vcamera->Show(); m_text_vcamera->Show();
m_switch_vcamera->Show(); m_switch_vcamera->Show();
if (is_vcamera_show) if (is_vcamera_show) {
vcamera_guide_link->Show(); vcamera_guide_link->Show();
link_underline->Show();
}
} else { } else {
m_text_vcamera->Hide(); m_text_vcamera->Hide();
m_switch_vcamera->Hide(); m_switch_vcamera->Hide();
vcamera_guide_link->Hide(); vcamera_guide_link->Hide();
link_underline->Hide();
} }
allow_alter_resolution = (m_obj->is_function_supported(PrinterFunction::FUNC_ALTER_RESOLUTION) && m_obj->has_ipcam); allow_alter_resolution = (m_obj->is_function_supported(PrinterFunction::FUNC_ALTER_RESOLUTION) && m_obj->has_ipcam);

View file

@ -70,7 +70,8 @@ private:
std::vector<RadioBox*> resolution_rbtns; std::vector<RadioBox*> resolution_rbtns;
std::vector<wxStaticText*> resolution_texts; std::vector<wxStaticText*> resolution_texts;
CameraResolution curr_sel_resolution = RESOLUTION_1080P; CameraResolution curr_sel_resolution = RESOLUTION_1080P;
wxHyperlinkCtrl* vcamera_guide_link { nullptr }; Label* vcamera_guide_link { nullptr };
wxPanel* link_underline{ nullptr };
bool is_vcamera_show = false; bool is_vcamera_show = false;
bool allow_alter_resolution = false; bool allow_alter_resolution = false;