From ac2545fede2258a279d7777a0846cac2d31ee4c1 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Wed, 1 Nov 2023 10:42:20 +0100 Subject: [PATCH] Store dialog decline in app config --- src/libslic3r/AppConfig.cpp | 3 +++ src/slic3r/GUI/GUI_App.cpp | 13 +++++++------ src/slic3r/GUI/Plater.cpp | 7 +++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 4bf4b4a2cd..12796b435f 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -210,6 +210,9 @@ void AppConfig::set_defaults() if (get("allow_ip_resolve").empty()) set("allow_ip_resolve", "1"); + if (get("wifi_config_dialog_declined").empty()) + set("wifi_config_dialog_declined", "0"); + #ifdef _WIN32 if (get("use_legacy_3DConnexion").empty()) set("use_legacy_3DConnexion", "0"); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index c4758c0b02..b6a14091e4 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3579,7 +3579,9 @@ void GUI_App::open_wifi_config_dialog(bool forced, const wxString& drive_path/* if(m_wifi_config_dialog_shown) 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 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; WifiConfigDialog dialog(mainframe, file_path, removable_drive_manager(), drive_path); 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); - } else - m_wifi_config_dialog_was_declined = true; + app_config->set("wifi_config_dialog_declined", "0"); + } else { + app_config->set("wifi_config_dialog_declined", "1"); + } m_wifi_config_dialog_shown = false; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 8392283611..e0bd80bcfe 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2286,9 +2286,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) }); 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 (fs::exists(fs::path(evt.GetString().utf8_string()) / CONFIG_FILE_NAME)) wxGetApp().open_wifi_config_dialog(false, evt.GetString()); } else { // at startup, show only notification 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 , _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 - , _u8L("Write Wi-Fi credetials."), [evt, CONFIG_FILE_NAME](wxEvtHandler* evt_hndlr){ - //if (fs::exists(fs::path(evt.GetString().utf8_string()) / CONFIG_FILE_NAME)) + , _u8L("Write Wi-Fi credetials."), [evt/*, CONFIG_FILE_NAME*/](wxEvtHandler* evt_hndlr){ wxGetApp().open_wifi_config_dialog(true, evt.GetString()); return true;}); }