Don't perform downloader desktop integration if built with SLIC3R_DESKTOP_INTEGRATION = 0 (PR #12252)

This commit is contained in:
Elia Devito 2024-02-14 21:03:07 +01:00 committed by Lukas Matena
parent d421f5b1f8
commit 691900201a
3 changed files with 20 additions and 20 deletions

View File

@ -1518,11 +1518,11 @@ PageDownloader::PageDownloader(ConfigWizard* parent)
)); ));
} }
#ifdef __linux__ #if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
append_text(wxString::Format(_L( append_text(wxString::Format(_L(
"On Linux systems the process of registration also creates desktop integration files for this version of application." "On Linux systems the process of registration also creates desktop integration files for this version of application."
))); )));
#endif #endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
box_allow_downloads->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->m_downloader->allow(event.IsChecked()); }); box_allow_downloads->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->m_downloader->allow(event.IsChecked()); });
@ -1582,7 +1582,7 @@ bool DownloaderUtils::Worker::perform_register(const std::string& path_override/
#elif __APPLE__ #elif __APPLE__
// Apple registers for custom url in info.plist thus it has to be already registered since build. // Apple registers for custom url in info.plist thus it has to be already registered since build.
// The url will always trigger opening of prusaslicer and we have to check that user has allowed it. (GUI_App::MacOpenURL is the triggered method) // The url will always trigger opening of prusaslicer and we have to check that user has allowed it. (GUI_App::MacOpenURL is the triggered method)
#else #elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
// the performation should be called later during desktop integration // the performation should be called later during desktop integration
perform_registration_linux = true; perform_registration_linux = true;
#endif #endif
@ -1600,7 +1600,7 @@ void DownloaderUtils::Worker::deregister()
key_full = key_string; key_full = key_string;
#elif __APPLE__ #elif __APPLE__
// TODO // TODO
#else #elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
BOOST_LOG_TRIVIAL(debug) << "DesktopIntegrationDialog::undo_downloader_registration"; BOOST_LOG_TRIVIAL(debug) << "DesktopIntegrationDialog::undo_downloader_registration";
DesktopIntegrationDialog::undo_downloader_registration(); DesktopIntegrationDialog::undo_downloader_registration();
perform_registration_linux = false; perform_registration_linux = false;
@ -3063,14 +3063,14 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
if ((check_unsaved_preset_changes = install_bundles.size() > 0)) if ((check_unsaved_preset_changes = install_bundles.size() > 0))
header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size()); header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size());
#ifdef __linux__ #if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
// Desktop integration on Linux // Desktop integration on Linux
BOOST_LOG_TRIVIAL(debug) << "ConfigWizard::priv::apply_config integrate_desktop" << page_welcome->integrate_desktop() << " perform_registration_linux " << page_downloader->m_downloader->get_perform_registration_linux(); BOOST_LOG_TRIVIAL(debug) << "ConfigWizard::priv::apply_config integrate_desktop" << page_welcome->integrate_desktop() << " perform_registration_linux " << page_downloader->m_downloader->get_perform_registration_linux();
if (page_welcome->integrate_desktop()) if (page_welcome->integrate_desktop())
DesktopIntegrationDialog::perform_desktop_integration(); DesktopIntegrationDialog::perform_desktop_integration();
if (page_downloader->m_downloader->get_perform_registration_linux()) if (page_downloader->m_downloader->get_perform_registration_linux())
DesktopIntegrationDialog::perform_downloader_desktop_integration(); DesktopIntegrationDialog::perform_downloader_desktop_integration();
#endif #endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
// Decide whether to create snapshot based on run_reason and the reset profile checkbox // Decide whether to create snapshot based on run_reason and the reset profile checkbox
bool snapshot = true; bool snapshot = true;

View File

@ -3175,10 +3175,10 @@ void GUI_App::show_downloader_registration_dialog()
if (msg.ShowModal() == wxID_YES) { if (msg.ShowModal() == wxID_YES) {
auto downloader_worker = new DownloaderUtils::Worker(nullptr); auto downloader_worker = new DownloaderUtils::Worker(nullptr);
downloader_worker->perform_register(app_config->get("url_downloader_dest")); downloader_worker->perform_register(app_config->get("url_downloader_dest"));
#ifdef __linux__ #if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
if (downloader_worker->get_perform_registration_linux()) if (downloader_worker->get_perform_registration_linux())
DesktopIntegrationDialog::perform_downloader_desktop_integration(); DesktopIntegrationDialog::perform_downloader_desktop_integration();
#endif // __linux__ #endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
} else { } else {
app_config->set("downloader_url_registered", "0"); app_config->set("downloader_url_registered", "0");
} }

View File

@ -28,9 +28,9 @@
#ifdef WIN32 #ifdef WIN32
#include <wx/msw/registry.h> #include <wx/msw/registry.h>
#endif // WIN32 #endif // WIN32
#ifdef __linux__ #if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
#include "DesktopIntegrationDialog.hpp" #include "DesktopIntegrationDialog.hpp"
#endif //__linux__ #endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
namespace Slic3r { namespace Slic3r {
@ -758,10 +758,10 @@ void PreferencesDialog::accept(wxEvent&)
downloader->allow(it->second == "1"); downloader->allow(it->second == "1");
if (!downloader->on_finish()) if (!downloader->on_finish())
return; return;
#ifdef __linux__ #if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
if( downloader->get_perform_registration_linux()) if( downloader->get_perform_registration_linux())
DesktopIntegrationDialog::perform_downloader_desktop_integration(); DesktopIntegrationDialog::perform_downloader_desktop_integration();
#endif // __linux__ #endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
} }
std::vector<std::string> options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled", "font_pt_size", "suppress_round_corners" }; std::vector<std::string> options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled", "font_pt_size", "suppress_round_corners" };