mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 21:05:56 -05:00
build: Added option to disable update checking (#1036)
This is aimed at use by linux distros, where package updates come from a central location, and users shouldn't need to worry about updating ImHex on their own. This disables parts of the ImHex UI that would not be useful in that case. Tested and confirmed that this works in both states of the of the `-DIMHEX_DISABLE_UPDATE_CHECK` switch.
This commit is contained in:
@@ -45,6 +45,7 @@ namespace hex::plugin::builtin {
|
||||
1 - check for updates on startup
|
||||
2 - default value - ask the user if he wants to check for updates. This value should only be encountered on the first startup.
|
||||
*/
|
||||
#if defined(HEX_UPDATE_CHECK)
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2, [](auto name, nlohmann::json &setting) {
|
||||
static bool enabled = static_cast<int>(setting) == 1;
|
||||
|
||||
@@ -55,6 +56,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
return false;
|
||||
});
|
||||
#endif
|
||||
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", 1, [](auto name, nlohmann::json &setting) {
|
||||
static bool enabled = static_cast<int>(setting);
|
||||
|
||||
@@ -535,6 +535,7 @@ namespace hex::plugin::builtin {
|
||||
loadDefaultLayout();
|
||||
});
|
||||
|
||||
#if defined(HEX_UPDATE_CHECK)
|
||||
EventManager::subscribe<EventWindowInitialized>([] {
|
||||
// documentation of the value above the setting definition
|
||||
auto showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2);
|
||||
@@ -550,6 +551,7 @@ namespace hex::plugin::builtin {
|
||||
);
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
// Clear project context if we go back to the welcome screen
|
||||
EventManager::subscribe<EventProviderChanged>([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) {
|
||||
|
||||
Reference in New Issue
Block a user