Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement compile-time flag to disable automatic update checks. #4854

Merged
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00)

# registers the native messageing host
option(CHATTERINO_DEBUG_NATIVE_MESSAGES "Debug native messages" OFF)
option(DISABLE_AUTOMATIC_UPDATES "Disable automatic updates" OFF)
libklein marked this conversation as resolved.
Show resolved Hide resolved

set(SOURCE_FILES
Application.cpp
Expand Down Expand Up @@ -1039,3 +1040,8 @@ if(CHATTERINO_ENABLE_LTO)
set_property(TARGET ${LIBRARY_PROJECT}
PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

if(DISABLE_AUTOMATIC_UPDATES)
message(STATUS "Disabling automatic updates.")
target_compile_definitions(${LIBRARY_PROJECT} PUBLIC DISABLE_AUTOMATIC_UPDATES)
endif()
2 changes: 2 additions & 0 deletions src/util/InitUpdateButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ void initUpdateButton(Button &button,

// update image when state changes
auto updateChange = [&button](auto) {
#ifndef DISABLE_AUTOMATIC_UPDATES
button.setVisible(Updates::instance().shouldShowUpdateButton());

auto imageUrl = Updates::instance().isError()
? ":/buttons/updateError.png"
: ":/buttons/update.png";
button.setPixmap(QPixmap(imageUrl));
#endif
};

updateChange(Updates::instance().getStatus());
Expand Down
Loading