diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index e164210f..4b87d60b 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -506,9 +506,14 @@ void MainWindow::on_resourceTreeView_doubleClicked(const QModelIndex& index) void MainWindowImpl::AsyncSetup() { + auto& generalSettings = manager::SettingsManager::general_settings(); + // Check for updates - scwx::util::async( - [this]() { updateManager_->CheckForUpdates(main::kVersionString_); }); + if (generalSettings.update_notifications_enabled().GetValue()) + { + scwx::util::async( + [this]() { updateManager_->CheckForUpdates(main::kVersionString_); }); + } } void MainWindowImpl::ConfigureMapLayout() diff --git a/scwx-qt/source/scwx/qt/settings/general_settings.cpp b/scwx-qt/source/scwx/qt/settings/general_settings.cpp index ddc2098a..55f74a00 100644 --- a/scwx-qt/source/scwx/qt/settings/general_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/general_settings.cpp @@ -21,6 +21,7 @@ public: gridWidth_.SetDefault(1); gridHeight_.SetDefault(1); mapboxApiKey_.SetDefault("?"); + updateNotificationsEnabled_.SetDefault(true); fontSizes_.SetElementMinimum(1); fontSizes_.SetElementMaximum(72); @@ -42,6 +43,7 @@ public: SettingsVariable gridWidth_ {"grid_width"}; SettingsVariable gridHeight_ {"grid_height"}; SettingsVariable mapboxApiKey_ {"mapbox_api_key"}; + SettingsVariable updateNotificationsEnabled_ {"update_notifications"}; }; GeneralSettings::GeneralSettings() : @@ -52,7 +54,8 @@ GeneralSettings::GeneralSettings() : &p->fontSizes_, &p->gridWidth_, &p->gridHeight_, - &p->mapboxApiKey_}); + &p->mapboxApiKey_, + &p->updateNotificationsEnabled_}); SetDefaults(); } GeneralSettings::~GeneralSettings() = default; @@ -92,6 +95,11 @@ SettingsVariable& GeneralSettings::mapbox_api_key() const return p->mapboxApiKey_; } +SettingsVariable& GeneralSettings::update_notifications_enabled() const +{ + return p->updateNotificationsEnabled_; +} + bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs) { return (lhs.p->debugEnabled_ == rhs.p->debugEnabled_ && @@ -99,7 +107,9 @@ bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs) lhs.p->fontSizes_ == rhs.p->fontSizes_ && lhs.p->gridWidth_ == rhs.p->gridWidth_ && lhs.p->gridHeight_ == rhs.p->gridHeight_ && - lhs.p->mapboxApiKey_ == rhs.p->mapboxApiKey_); + lhs.p->mapboxApiKey_ == rhs.p->mapboxApiKey_ && + lhs.p->updateNotificationsEnabled_ == + rhs.p->updateNotificationsEnabled_); } } // namespace settings diff --git a/scwx-qt/source/scwx/qt/settings/general_settings.hpp b/scwx-qt/source/scwx/qt/settings/general_settings.hpp index 1770150f..48757e28 100644 --- a/scwx-qt/source/scwx/qt/settings/general_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/general_settings.hpp @@ -33,6 +33,7 @@ public: SettingsVariable& grid_height() const; SettingsVariable& grid_width() const; SettingsVariable& mapbox_api_key() const; + SettingsVariable& update_notifications_enabled() const; friend bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs); diff --git a/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp b/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp index 02c82b44..b8250d7f 100644 --- a/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp +++ b/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp @@ -84,6 +84,7 @@ public: &gridWidth_, &gridHeight_, &mapboxApiKey_, + &updateNotificationsEnabled_, &debugEnabled_}} { // Configure default alert phenomena colors @@ -137,7 +138,8 @@ public: settings::SettingsInterface gridWidth_ {}; settings::SettingsInterface gridHeight_ {}; settings::SettingsInterface mapboxApiKey_ {}; - settings::SettingsInterface debugEnabled_ {}; + settings::SettingsInterface updateNotificationsEnabled_ {}; + settings::SettingsInterface debugEnabled_ {}; std::unordered_map> colorTables_ {}; @@ -315,6 +317,11 @@ void SettingsDialogImpl::SetupGeneralTab() mapboxApiKey_.SetEditWidget(self_->ui->mapboxApiKeyLineEdit); mapboxApiKey_.SetResetButton(self_->ui->resetMapboxApiKeyButton); + updateNotificationsEnabled_.SetSettingsVariable( + generalSettings.update_notifications_enabled()); + updateNotificationsEnabled_.SetEditWidget( + self_->ui->enableUpdateNotificationsCheckBox); + debugEnabled_.SetSettingsVariable(generalSettings.debug_enabled()); debugEnabled_.SetEditWidget(self_->ui->debugEnabledCheckBox); } diff --git a/scwx-qt/source/scwx/qt/ui/settings_dialog.ui b/scwx-qt/source/scwx/qt/ui/settings_dialog.ui index 28bb1733..f021c230 100644 --- a/scwx-qt/source/scwx/qt/ui/settings_dialog.ui +++ b/scwx-qt/source/scwx/qt/ui/settings_dialog.ui @@ -224,6 +224,13 @@ + + + + Update Notifications Enabled + + + @@ -268,8 +275,8 @@ 0 0 - 489 - 382 + 66 + 18 diff --git a/test/data b/test/data index 16017d0b..5b507378 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 16017d0b6446228ecfd8ef4cd733e8b1595ab2fb +Subproject commit 5b5073780fe44e55eb4c33799036683b28ffd2bd