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(
"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()); });
@ -1582,7 +1582,7 @@ bool DownloaderUtils::Worker::perform_register(const std::string& path_override/
#elif __APPLE__
// 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)
#else
#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
// the performation should be called later during desktop integration
perform_registration_linux = true;
#endif
@ -1600,7 +1600,7 @@ void DownloaderUtils::Worker::deregister()
key_full = key_string;
#elif __APPLE__
// TODO
#else
#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
BOOST_LOG_TRIVIAL(debug) << "DesktopIntegrationDialog::undo_downloader_registration";
DesktopIntegrationDialog::undo_downloader_registration();
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))
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
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())
DesktopIntegrationDialog::perform_desktop_integration();
if (page_downloader->m_downloader->get_perform_registration_linux())
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
bool snapshot = true;

View File

@ -3175,10 +3175,10 @@ void GUI_App::show_downloader_registration_dialog()
if (msg.ShowModal() == wxID_YES) {
auto downloader_worker = new DownloaderUtils::Worker(nullptr);
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())
DesktopIntegrationDialog::perform_downloader_desktop_integration();
#endif // __linux__
#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
} else {
app_config->set("downloader_url_registered", "0");
}

View File

@ -1,11 +1,11 @@
///|/ Copyright (c) Prusa Research 2018 - 2023 Oleksandra Iushchenko @YuSanka, David Kocík @kocikdav, Vojtěch Bubník @bubnikv, Pavel Mikuš @Godrak, Enrico Turri @enricoturri1966, Lukáš Matěna @lukasmatena, Vojtěch Král @vojtechkral
///|/
///|/ ported from lib/Slic3r/GUI/Preferences.pm:
///|/ Copyright (c) Prusa Research 2016 - 2018 Vojtěch Bubník @bubnikv
///|/ Copyright (c) Slic3r 2013 - 2014 Alessandro Ranellucci @alranel
///|/
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
///|/
///|/ Copyright (c) Prusa Research 2018 - 2023 Oleksandra Iushchenko @YuSanka, David Kocík @kocikdav, Vojtěch Bubník @bubnikv, Pavel Mikuš @Godrak, Enrico Turri @enricoturri1966, Lukáš Matěna @lukasmatena, Vojtěch Král @vojtechkral
///|/
///|/ ported from lib/Slic3r/GUI/Preferences.pm:
///|/ Copyright (c) Prusa Research 2016 - 2018 Vojtěch Bubník @bubnikv
///|/ Copyright (c) Slic3r 2013 - 2014 Alessandro Ranellucci @alranel
///|/
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
///|/
#include "Preferences.hpp"
#include "OptionsGroup.hpp"
#include "GUI_App.hpp"
@ -28,9 +28,9 @@
#ifdef WIN32
#include <wx/msw/registry.h>
#endif // WIN32
#ifdef __linux__
#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
#include "DesktopIntegrationDialog.hpp"
#endif //__linux__
#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
namespace Slic3r {
@ -758,10 +758,10 @@ void PreferencesDialog::accept(wxEvent&)
downloader->allow(it->second == "1");
if (!downloader->on_finish())
return;
#ifdef __linux__
#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
if( downloader->get_perform_registration_linux())
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" };