Add runtime and compiletime option to disable version checks in gui (#7291)

This only partially addresses #7291. There is still no option in the gui for this.
This commit is contained in:
Shelvacu 2024-11-30 15:02:01 -08:00 committed by Shelvacu on fw
parent b331830604
commit d10a06ae11
5 changed files with 26 additions and 6 deletions

View file

@ -70,6 +70,13 @@ endif ()
option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF)
option(SLIC3R_BUILD_TESTS "Build unit tests" OFF)
option(ORCA_TOOLS "Build Orca tools" OFF)
option(ORCA_VERSION_CHECK_DEFAULT "Whether to check for new versions on startup by default" ON)
if (ORCA_VERSION_CHECK_DEFAULT)
add_definitions(-DORCA_VERSION_CHECK_DEFAULT=true)
else ()
add_definitions(-DORCA_VERSION_CHECK_DEFAULT=false)
endif ()
if (IS_CROSS_COMPILE)
message("Detected cross compilation setup. Tests and encoding checks will be forcedly disabled!")

View file

@ -120,6 +120,10 @@ If you're running Klipper, it's recommended to add the following configuration t
resolution: 0.1
```
# Note if building for a package manager
If you're building this as a package for a package manager (`apt`, `brew`, `pacman`, `nix`, `chocolatey`, etc.) where the user is not going to be manually updating the software, you should disable the version check with `-DORCA_VERSION_CHECK_DEFAULT=OFF` flag to cmake
# Supports
**Orca Slicer** is an open-source project, and I'm deeply grateful to all my sponsors and backers.
Their generous support enables me to purchase filaments and other essential 3D printing materials for the project.

View file

@ -406,6 +406,12 @@ void AppConfig::set_defaults()
if (get("print", "timelapse").empty()) {
set_str("print", "timelapse", "1");
}
if (get("do_version_check").empty()) {
#ifndef ORCA_VERSION_CHECK_DEFAULT
#define ORCA_VERSION_CHECK_DEFAULT true
#endif
set_bool("do_version_check", ORCA_VERSION_CHECK_DEFAULT);
}
// Remove legacy window positions/sizes
erase("app", "main_frame_maximized");

View file

@ -971,7 +971,10 @@ void GUI_App::post_init()
bool sys_preset = app_config->get("sync_system_preset") == "true";
this->preset_updater->sync(http_url, language, network_ver, sys_preset ? preset_bundle : nullptr);
this->check_new_version_sf();
if (this->preset_updater->version_check_enabled()) {
this->check_new_version_sf();
}
if (is_user_login() && !app_config->get_stealth_mode()) {
// this->check_privacy_version(0);
request_user_handle(0);
@ -1964,14 +1967,14 @@ void GUI_App::init_app_config()
#endif
//BBS: remove GCodeViewer as seperate APP logic
if (!app_config)
if (!app_config)
app_config = new AppConfig();
//app_config = new AppConfig(is_editor() ? AppConfig::EAppMode::Editor : AppConfig::EAppMode::GCodeViewer);
m_config_corrupted = false;
// load settings
m_app_conf_exists = app_config->exists();
if (m_app_conf_exists) {
// load settings
m_app_conf_exists = app_config->exists();
if (m_app_conf_exists) {
std::string error = app_config->load();
if (!error.empty()) {
// Orca: if the config file is corrupted, we will show a error dialog and create a default config file.

View file

@ -242,7 +242,6 @@ PresetUpdater::priv::priv()
, cancel(false)
{
//BBS: refine preset updater logic
enabled_version_check = true;
set_download_prefs(GUI::wxGetApp().app_config);
// Install indicies from resources. Only installs those that are either missing or older than in resources.
check_installed_vendor_profiles();
@ -255,6 +254,7 @@ PresetUpdater::priv::priv()
void PresetUpdater::priv::set_download_prefs(AppConfig *app_config)
{
version_check_url = app_config->version_check_url();
enabled_version_check = app_config->get_bool("do_version_check");
auto profile_update_url = app_config->profile_update_url();
if (!profile_update_url.empty())