FIX: auto stop liveview when no operation

Change-Id: Icc8668fefcdbdd8bf767dddee0226413a089c2c9
Jira: none
This commit is contained in:
chunmao.guo 2024-09-06 09:13:21 +08:00 committed by Lane.Wei
parent 06bbd235b8
commit 2c38dc51f2
3 changed files with 12 additions and 8 deletions

View File

@ -187,14 +187,18 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
auto now = std::chrono::system_clock::now();
if (m_play_timer <= now) {
m_play_timer = now + 1min;
if (SecondsSinceLastInput() >= 900) { // 15 min
auto close = wxGetApp().app_config->get("liveview", "auto_stop_liveview") == "true";
if (close) {
Stop(_L("Temporarily closed because there is no operating for a long time."));
return;
}
}
auto obj = wxGetApp().getDeviceManager()->get_selected_machine();
if (obj && obj->is_in_printing()) {
m_print_idle = 0;
} else if (++m_print_idle >= 5) {
auto close = wxGetApp().app_config->get("liveview", "auto_stop_liveview") == "true";
if (close) {
Stop(_L("Temporarily closed because there is no printing for a long time."));
}
Stop(_L("Temporarily closed because there is no printing for a while."));
}
}
}

View File

@ -1742,7 +1742,7 @@ void Sidebar::sync_ams_list()
add_button(wxID_OK, true, _L("Sync"));
add_button(wxID_YES, false, _L("Resync"));
}
add_button(wxID_CANCEL, false, _L("Cancel"));
add_button(wxID_CANCEL, false, _L("No"));
}
} dlg(this, ams_filament_ids.empty());
auto res = dlg.ShowModal();

View File

@ -631,7 +631,7 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
if (param == "privacyuse") {
checkbox->SetValue((app_config->get("firstguide", param) == "true") ? true : false);
} else if (param == "auto_stop_liveview") {
checkbox->SetValue((app_config->get("liveview", param) == "true") ? true : false);
checkbox->SetValue((app_config->get("liveview", param) == "true") ? false : true);
} else {
checkbox->SetValue((app_config->get(param) == "true") ? true : false);
}
@ -663,7 +663,7 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
app_config->save();
}
else if (param == "auto_stop_liveview") {
app_config->set("liveview", param, checkbox->GetValue());
app_config->set("liveview", param, !checkbox->GetValue());
}
else {
app_config->set_bool(param, checkbox->GetValue());
@ -1083,7 +1083,7 @@ wxWindow* PreferencesDialog::create_general_page()
//downloads
auto title_media = create_item_title(_L("Media"), page, _L("Media"));
auto item_downloads = create_item_downloads(page,50,"download_path");
auto item_auto_stop_liveview = create_item_checkbox(_L("Auto Stop Liveview"), page, _L("Automatically close the video after printing."), 50, "auto_stop_liveview");
auto item_auto_stop_liveview = create_item_checkbox(_L("Keep liveview when printing."), page, _L("By default, Liveview will pause after 15 minutes of inactivity on the computer. Check this box to disable this feature during printing."), 50, "auto_stop_liveview");
//dark mode
#ifdef _WIN32