diff --git a/src/musikcube/app/layout/MainLayout.cpp b/src/musikcube/app/layout/MainLayout.cpp index aad342416..562da841b 100755 --- a/src/musikcube/app/layout/MainLayout.cpp +++ b/src/musikcube/app/layout/MainLayout.cpp @@ -370,6 +370,10 @@ void MainLayout::OnIndexerFinished(int count) { } void MainLayout::RunUpdateCheck() { + if (!prefs->GetBool(cube::prefs::keys::AutoUpdateCheck, true)) { + return; + } + updateCheck.Run([this](bool updateRequired, std::string version, std::string url) { if (updateRequired) { UpdateCheck::ShowUpgradeAvailableOverlay(version, url); diff --git a/src/musikcube/app/layout/SettingsLayout.cpp b/src/musikcube/app/layout/SettingsLayout.cpp index 1df466243..ee2887eba 100755 --- a/src/musikcube/app/layout/SettingsLayout.cpp +++ b/src/musikcube/app/layout/SettingsLayout.cpp @@ -159,6 +159,9 @@ void SettingsLayout::OnCheckboxChanged(cursespp::Checkbox* cb, bool checked) { this->prefs->SetBool(cube::prefs::keys::StartMinimized, checked); } #endif + else if (cb == autoUpdateCheckbox.get()) { + this->prefs->SetBool(cube::prefs::keys::AutoUpdateCheck, checked); + } } void SettingsLayout::OnLocaleDropdownActivate(cursespp::TextLabel* label) { @@ -263,6 +266,8 @@ void SettingsLayout::OnLayout() { this->serverDropdown->MoveAndResize(column1, y++, columnCx, LABEL_HEIGHT); } + this->updateDropdown->MoveAndResize(column1, y++, columnCx, LABEL_HEIGHT); + y = BOTTOM(this->browseList); #ifdef ENABLE_256_COLOR_OPTION this->paletteCheckbox->MoveAndResize(column2, y++, columnCx, LABEL_HEIGHT); @@ -275,8 +280,7 @@ void SettingsLayout::OnLayout() { this->minimizeToTrayCheckbox->MoveAndResize(column2, y++, columnCx, LABEL_HEIGHT); this->startMinimizedCheckbox->MoveAndResize(column2, y++, columnCx, LABEL_HEIGHT); #endif - - this->updateDropdown->MoveAndResize(column2, y++, columnCx, LABEL_HEIGHT); + this->autoUpdateCheckbox->MoveAndResize(column2, y++, columnCx, LABEL_HEIGHT); } void SettingsLayout::RefreshAddedPaths() { @@ -362,6 +366,10 @@ void SettingsLayout::InitializeWindows() { this->serverDropdown->Activated.connect(this, &SettingsLayout::OnServerDropdownActivate); } + this->updateDropdown.reset(new TextLabel()); + this->updateDropdown->SetText(arrow + _TSTR("settings_check_for_updates")); + this->updateDropdown->Activated.connect(this, &SettingsLayout::OnUpdateDropdownActivate); + CREATE_CHECKBOX(this->dotfileCheckbox, _TSTR("settings_show_dotfiles")); CREATE_CHECKBOX(this->syncOnStartupCheckbox, _TSTR("settings_sync_on_startup")); CREATE_CHECKBOX(this->removeCheckbox, _TSTR("settings_remove_missing")); @@ -374,10 +382,7 @@ void SettingsLayout::InitializeWindows() { CREATE_CHECKBOX(this->minimizeToTrayCheckbox, _TSTR("settings_minimize_to_tray")); CREATE_CHECKBOX(this->startMinimizedCheckbox, _TSTR("settings_start_minimized")); #endif - - this->updateDropdown.reset(new TextLabel()); - this->updateDropdown->SetText(arrow + _TSTR("settings_check_for_updates")); - this->updateDropdown->Activated.connect(this, &SettingsLayout::OnUpdateDropdownActivate); + CREATE_CHECKBOX(this->autoUpdateCheckbox, _TSTR("settings_auto_update_check")); int order = 0; this->browseList->SetFocusOrder(order++); @@ -393,6 +398,8 @@ void SettingsLayout::InitializeWindows() { this->serverDropdown->SetFocusOrder(order++); } + this->updateDropdown->SetFocusOrder(order++); + #ifdef ENABLE_256_COLOR_OPTION this->paletteCheckbox->SetFocusOrder(order++); #endif @@ -404,7 +411,7 @@ void SettingsLayout::InitializeWindows() { this->minimizeToTrayCheckbox->SetFocusOrder(order++); this->startMinimizedCheckbox->SetFocusOrder(order++); #endif - this->updateDropdown->SetFocusOrder(order++); + this->autoUpdateCheckbox->SetFocusOrder(order++); this->AddWindow(this->browseLabel); this->AddWindow(this->addedPathsLabel); @@ -419,6 +426,8 @@ void SettingsLayout::InitializeWindows() { this->AddWindow(this->serverDropdown); } + this->AddWindow(updateDropdown); + #ifdef ENABLE_256_COLOR_OPTION this->AddWindow(this->paletteCheckbox); #endif @@ -433,7 +442,7 @@ void SettingsLayout::InitializeWindows() { this->AddWindow(this->minimizeToTrayCheckbox); this->AddWindow(this->startMinimizedCheckbox); #endif - this->AddWindow(updateDropdown); + this->AddWindow(this->autoUpdateCheckbox); } void SettingsLayout::SetShortcutsWindow(ShortcutsWindow* shortcuts) { @@ -533,6 +542,7 @@ void SettingsLayout::LoadPreferences() { this->minimizeToTrayCheckbox->SetChecked(this->prefs->GetBool(cube::prefs::keys::MinimizeToTray, false)); this->startMinimizedCheckbox->SetChecked(this->prefs->GetBool(cube::prefs::keys::StartMinimized, false)); #endif + this->autoUpdateCheckbox->SetChecked(this->prefs->GetBool(cube::prefs::keys::AutoUpdateCheck, true)); /* output plugin */ std::shared_ptr output = outputs::SelectedOutput(); diff --git a/src/musikcube/app/layout/SettingsLayout.h b/src/musikcube/app/layout/SettingsLayout.h index 8aaf97604..086f286d6 100755 --- a/src/musikcube/app/layout/SettingsLayout.h +++ b/src/musikcube/app/layout/SettingsLayout.h @@ -138,6 +138,7 @@ namespace musik { std::shared_ptr seekScrubCheckbox; std::shared_ptr minimizeToTrayCheckbox; std::shared_ptr startMinimizedCheckbox; + std::shared_ptr autoUpdateCheckbox; std::shared_ptr browseLabel; std::shared_ptr addedPathsLabel; diff --git a/src/musikcube/app/util/PreferenceKeys.cpp b/src/musikcube/app/util/PreferenceKeys.cpp index 636508f8a..53e5fe355 100644 --- a/src/musikcube/app/util/PreferenceKeys.cpp +++ b/src/musikcube/app/util/PreferenceKeys.cpp @@ -43,6 +43,7 @@ namespace musik { namespace cube { namespace prefs { const std::string keys::ColorTheme = "ColorTheme"; const std::string keys::MinimizeToTray = "MinimizeToTray"; const std::string keys::StartMinimized = "StartMinimized"; + const std::string keys::AutoUpdateCheck = "AutoUpdateCheck"; const std::string keys::LastAcknowledgedUpdateVersion = "LastAcknowledgedUpdateVersion"; } } } diff --git a/src/musikcube/app/util/PreferenceKeys.h b/src/musikcube/app/util/PreferenceKeys.h index fafa6aba3..a31178220 100644 --- a/src/musikcube/app/util/PreferenceKeys.h +++ b/src/musikcube/app/util/PreferenceKeys.h @@ -45,6 +45,7 @@ namespace musik { namespace cube { namespace prefs { extern const std::string ColorTheme; extern const std::string MinimizeToTray; extern const std::string StartMinimized; + extern const std::string AutoUpdateCheck; extern const std::string LastAcknowledgedUpdateVersion; } diff --git a/src/musikcube/data/locales/en_US.json b/src/musikcube/data/locales/en_US.json index 56bfe8899..cb78cf9d5 100644 --- a/src/musikcube/data/locales/en_US.json +++ b/src/musikcube/data/locales/en_US.json @@ -48,6 +48,7 @@ "settings_minimize_to_tray": "minimize to tray", "settings_start_minimized": "start minimized", "settings_server_setup": "server setup", + "settings_auto_update_check": "check for updates on startup", "settings_check_for_updates": "check for updates", "settings_server_enable_websockets": "metadata server enabled",