Store dialog decline in app config

This commit is contained in:
David Kocik 2023-11-01 10:42:20 +01:00
parent 0e889eae09
commit ac2545fede
3 changed files with 13 additions and 10 deletions

View File

@ -210,6 +210,9 @@ void AppConfig::set_defaults()
if (get("allow_ip_resolve").empty()) if (get("allow_ip_resolve").empty())
set("allow_ip_resolve", "1"); set("allow_ip_resolve", "1");
if (get("wifi_config_dialog_declined").empty())
set("wifi_config_dialog_declined", "0");
#ifdef _WIN32 #ifdef _WIN32
if (get("use_legacy_3DConnexion").empty()) if (get("use_legacy_3DConnexion").empty())
set("use_legacy_3DConnexion", "0"); set("use_legacy_3DConnexion", "0");

View File

@ -3579,7 +3579,9 @@ void GUI_App::open_wifi_config_dialog(bool forced, const wxString& drive_path/*
if(m_wifi_config_dialog_shown) if(m_wifi_config_dialog_shown)
return; return;
if (!forced && m_wifi_config_dialog_was_declined) { bool dialog_was_declined = app_config->get_bool("wifi_config_dialog_declined");
if (!forced && dialog_was_declined) {
// dialog was already declined this run, show only notification // dialog was already declined this run, show only notification
notification_manager()->push_notification(NotificationType::WifiConfigFileDetected notification_manager()->push_notification(NotificationType::WifiConfigFileDetected
@ -3597,12 +3599,11 @@ void GUI_App::open_wifi_config_dialog(bool forced, const wxString& drive_path/*
std::string file_path; std::string file_path;
WifiConfigDialog dialog(mainframe, file_path, removable_drive_manager(), drive_path); WifiConfigDialog dialog(mainframe, file_path, removable_drive_manager(), drive_path);
if (dialog.ShowModal() == wxID_OK) { if (dialog.ShowModal() == wxID_OK) {
//wxString used_path = dialog.get_used_path();
//if(std::find(m_wifi_config_dialog_used_paths.begin(), m_wifi_config_dialog_used_paths.end(), used_path) == m_wifi_config_dialog_used_paths.end())
// m_wifi_config_dialog_used_paths.emplace_back(std::move(used_path));
plater_->get_notification_manager()->push_exporting_finished_notification(file_path, boost::filesystem::path(file_path).parent_path().string(), true); plater_->get_notification_manager()->push_exporting_finished_notification(file_path, boost::filesystem::path(file_path).parent_path().string(), true);
} else app_config->set("wifi_config_dialog_declined", "0");
m_wifi_config_dialog_was_declined = true; } else {
app_config->set("wifi_config_dialog_declined", "1");
}
m_wifi_config_dialog_shown = false; m_wifi_config_dialog_shown = false;
} }

View File

@ -2286,9 +2286,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
}); });
this->q->Bind(EVT_REMOVABLE_DRIVE_ADDED, [this](wxCommandEvent& evt) { this->q->Bind(EVT_REMOVABLE_DRIVE_ADDED, [this](wxCommandEvent& evt) {
const std::string CONFIG_FILE_NAME = "prusa_printer_settings.ini"; if (!fs::exists(fs::path(evt.GetString().utf8_string()) / "prusa_printer_settings.ini"))
return;
if (evt.GetInt() == 0) { // not at startup, show dialog if (evt.GetInt() == 0) { // not at startup, show dialog
if (fs::exists(fs::path(evt.GetString().utf8_string()) / CONFIG_FILE_NAME))
wxGetApp().open_wifi_config_dialog(false, evt.GetString()); wxGetApp().open_wifi_config_dialog(false, evt.GetString());
} else { // at startup, show only notification } else { // at startup, show only notification
notification_manager->push_notification(NotificationType::WifiConfigFileDetected notification_manager->push_notification(NotificationType::WifiConfigFileDetected
@ -2296,8 +2296,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
// TRN Text of notification when Slicer starts and usb stick with printer settings ini file is present // TRN Text of notification when Slicer starts and usb stick with printer settings ini file is present
, _u8L("Printer configuration file detected on removable media.") , _u8L("Printer configuration file detected on removable media.")
// TRN Text of hypertext of notification when Slicer starts and usb stick with printer settings ini file is present // TRN Text of hypertext of notification when Slicer starts and usb stick with printer settings ini file is present
, _u8L("Write Wi-Fi credetials."), [evt, CONFIG_FILE_NAME](wxEvtHandler* evt_hndlr){ , _u8L("Write Wi-Fi credetials."), [evt/*, CONFIG_FILE_NAME*/](wxEvtHandler* evt_hndlr){
//if (fs::exists(fs::path(evt.GetString().utf8_string()) / CONFIG_FILE_NAME))
wxGetApp().open_wifi_config_dialog(true, evt.GetString()); wxGetApp().open_wifi_config_dialog(true, evt.GetString());
return true;}); return true;});
} }