ENH: support turn off liveview auto retry

Change-Id: I24b39f74e0a40a13277d6eae3830c95c5c9de333
Jira: none
(cherry picked from commit f6ceb3fb8e4df3f876c50a1c4ba96b4a1be60190)
This commit is contained in:
chunmao.guo 2023-11-14 10:48:35 +08:00 committed by Lane.Wei
parent cc7ef50bd0
commit 2564c51b36
4 changed files with 30 additions and 1 deletions

View File

@ -8,6 +8,7 @@
#include <wx/clipbrd.h>
#include <wx/dcgraph.h>
#include "GUI_App.hpp"
#include <slic3r/GUI/StatusPanel.hpp>
namespace Slic3r {
namespace GUI {
@ -64,6 +65,23 @@ CameraPopup::CameraPopup(wxWindow *parent)
top_sizer->Add(m_text_vcamera, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
top_sizer->Add(m_switch_vcamera, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5));
#if !BBL_RELEASE_TO_PUBLIC
m_text_liveview_retry = new wxStaticText(m_panel, wxID_ANY, _L("Liveview Retry"));
m_text_liveview_retry->Wrap(-1);
m_text_liveview_retry->SetFont(Label::Head_14);
m_text_liveview_retry->SetForegroundColour(TEXT_COL);
m_switch_liveview_retry = new SwitchButton(m_panel);
m_switch_liveview_retry->SetValue(true);
top_sizer->Add(m_text_liveview_retry, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
top_sizer->Add(m_switch_liveview_retry, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5));
m_switch_liveview_retry->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &e) {
dynamic_cast<MediaPlayCtrl *>(GetParent()->FindWindowByLabel("MediaPlayCtrl"))->SetAutoRetry(e.IsChecked());
e.Skip();
});
#endif
//resolution
m_text_resolution = new wxStaticText(m_panel, wxID_ANY, _L("Resolution"));
m_text_resolution->Wrap(-1);

View File

@ -67,6 +67,8 @@ private:
SwitchButton* m_switch_recording;
wxStaticText* m_text_vcamera;
SwitchButton* m_switch_vcamera;
wxStaticText* m_text_liveview_retry;
SwitchButton* m_switch_liveview_retry;
wxStaticText* m_text_resolution;
wxWindow* m_resolution_options[RESOLUTION_OPTIONS_NUM];
wxScrolledWindow *m_panel;

View File

@ -31,6 +31,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
: wxPanel(parent, wxID_ANY, pos, size)
, m_media_ctrl(media_ctrl)
{
SetLabel("MediaPlayCtrl");
SetBackgroundColour(*wxWHITE);
m_media_ctrl->Bind(wxEVT_MEDIA_STATECHANGED, &MediaPlayCtrl::onStateChanged, this);
@ -146,6 +147,11 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
SetStatus("", false);
}
void MediaPlayCtrl::SetAutoRetry(bool b)
{
m_auto_retry = b;
}
wxString hide_passwd(wxString url, std::vector<wxString> const &passwords)
{
for (auto &p : passwords) {
@ -281,7 +287,7 @@ void MediaPlayCtrl::Stop(wxString const &msg)
SetStatus(_L("Stopped [%d]!"), true);
else
SetStatus(_L("Stopped."), false);
if (m_failed_code >= 100) // not keep retry on local error
if (!m_auto_retry || m_failed_code >= 100) // not keep retry on local error
m_next_retry = wxDateTime();
} else if (!msg.IsEmpty()) {
SetStatus(msg, false);

View File

@ -36,6 +36,8 @@ public:
void SetMachineObject(MachineObject * obj);
void SetAutoRetry(bool b);
bool IsStreaming() const;
void ToggleStream();
@ -84,6 +86,7 @@ private:
bool m_remote_support = false;
bool m_device_busy = false;
bool m_disable_lan = false;
bool m_auto_retry = true;
wxString m_url;
std::deque<wxString> m_tasks;