From 1c022196ebe29b39ca31145a28f99f880a63da03 Mon Sep 17 00:00:00 2001 From: casey langen Date: Thu, 13 Apr 2023 14:16:42 -0700 Subject: [PATCH] Disable update check for homebrew builds. --- CHANGELOG.txt | 1 + CMakeLists.txt | 7 +++++++ src/musikcube/app/layout/MainLayout.cpp | 2 ++ src/musikcube/app/layout/SettingsLayout.cpp | 13 ++++++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c6bc575ec..c838c595f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -9,6 +9,7 @@ - libopenmpt@0.6.9 - asio@1.27.0 * update to PDCursesMod@4.3.6 for Windows builds +* disable update check for `homebrew` builds -------------------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c15cbab8..880575400 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,13 @@ add_definitions( -D_WEBSOCKETPP_CPP11_RANDOM_DEVICE_ -DASIO_STANDALONE) +# disable update check for environments that we know will provided hosted, +# prebuilt binaries. +if (DEFINED ENV{HOMEBREW_PREFIX}) + message(STATUS "[build] detected homebrew, disabling update check functionality.") + add_definitions(-DDISABLE_UPDATE_CHECK) +endif() + if (${BUILD_STANDALONE} MATCHES "true") find_vendor_library(LIBCURL curl) find_vendor_library(LIBSSL ssl) diff --git a/src/musikcube/app/layout/MainLayout.cpp b/src/musikcube/app/layout/MainLayout.cpp index 9bc4bbee7..1da05543d 100755 --- a/src/musikcube/app/layout/MainLayout.cpp +++ b/src/musikcube/app/layout/MainLayout.cpp @@ -351,6 +351,7 @@ void MainLayout::OnTrackChanged(size_t index, musik::core::TrackPtr track) { } void MainLayout::RunUpdateCheck() { +#ifndef DISABLE_UPDATE_CHECK if (!prefs->GetBool(cube::prefs::keys::AutoUpdateCheck, true)) { return; } @@ -360,4 +361,5 @@ void MainLayout::RunUpdateCheck() { UpdateCheck::ShowUpgradeAvailableOverlay(version, url); } }); +#endif } diff --git a/src/musikcube/app/layout/SettingsLayout.cpp b/src/musikcube/app/layout/SettingsLayout.cpp index cf1be9d5a..6eae8b7e3 100755 --- a/src/musikcube/app/layout/SettingsLayout.cpp +++ b/src/musikcube/app/layout/SettingsLayout.cpp @@ -105,7 +105,9 @@ static const std::string arrow = "> "; static inline std::shared_ptr AdvancedSettingsSchema() { auto schema = std::make_shared>(); +#ifndef DISABLE_UPDATE_CHECK schema->AddBool(cube::prefs::keys::AutoUpdateCheck, false); +#endif #ifdef ENABLE_MINIMIZE_TO_TRAY schema->AddBool(cube::prefs::keys::MinimizeToTray, false); schema->AddBool(cube::prefs::keys::StartMinimized, false); @@ -310,6 +312,7 @@ void SettingsLayout::OnAdvancedSettingsActivate(cursespp::TextLabel* label) { } void SettingsLayout::OnUpdateDropdownActivate(cursespp::TextLabel* label) { +#ifndef DISABLE_UPDATE_CHECK updateCheck.Run([this](bool updateRequired, std::string version, std::string url) { if (updateRequired) { UpdateCheck::ShowUpgradeAvailableOverlay(version, url, false); @@ -318,6 +321,7 @@ void SettingsLayout::OnUpdateDropdownActivate(cursespp::TextLabel* label) { UpdateCheck::ShowNoUpgradeFoundOverlay(); } }); +#endif } void SettingsLayout::OnThemeDropdownActivate(cursespp::TextLabel* label) { @@ -386,8 +390,9 @@ void SettingsLayout::OnLayout() { this->saveSessionCheckbox->MoveAndResize(column2, y++, columnCx, kLabelHeight); this->pluginsDropdown->MoveAndResize(column2, y++, columnCx, kLabelHeight); this->advancedDropdown->MoveAndResize(column2, y++, columnCx, kLabelHeight); +#ifndef DISABLE_UPDATE_CHECK this->updateDropdown->MoveAndResize(column2, y++, columnCx, kLabelHeight); - +#endif this->appVersion->MoveAndResize(0, cy - 1, cx, kLabelHeight); } @@ -445,9 +450,11 @@ void SettingsLayout::InitializeWindows() { this->serverDropdown->Activated.connect(this, &SettingsLayout::OnServerDropdownActivate); } +#ifndef DISABLE_UPDATE_CHECK this->updateDropdown = std::make_shared(); this->updateDropdown->SetText(arrow + _TSTR("settings_check_for_updates")); this->updateDropdown->Activated.connect(this, &SettingsLayout::OnUpdateDropdownActivate); +#endif this->advancedDropdown = std::make_shared(); this->advancedDropdown->SetText(arrow + _TSTR("settings_advanced_settings")); @@ -496,7 +503,9 @@ void SettingsLayout::InitializeWindows() { this->saveSessionCheckbox->SetFocusOrder(order++); this->pluginsDropdown->SetFocusOrder(order++); this->advancedDropdown->SetFocusOrder(order++); +#ifndef DISABLE_UPDATE_CHECK this->updateDropdown->SetFocusOrder(order++); +#endif this->AddWindow(this->libraryTypeDropdown); this->AddWindow(this->localLibraryLayout); @@ -528,7 +537,9 @@ void SettingsLayout::InitializeWindows() { this->AddWindow(this->saveSessionCheckbox); this->AddWindow(this->pluginsDropdown); this->AddWindow(this->advancedDropdown); +#ifndef DISABLE_UPDATE_CHECK this->AddWindow(this->updateDropdown); +#endif this->AddWindow(this->appVersion); }