diff --git a/scwx-qt/source/scwx/qt/map/map_widget.cpp b/scwx-qt/source/scwx/qt/map/map_widget.cpp index ebea2b21..ed288a40 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.cpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.cpp @@ -1265,11 +1265,16 @@ void MapWidgetImpl::AddLayer(types::LayerType type, case types::InformationLayer::RadarSite: radarSiteLayer_ = std::make_shared(context_); AddLayer(layerName, radarSiteLayer_, before); - connect(radarSiteLayer_.get(), - &RadarSiteLayer::RadarSiteSelected, - this, - [this](const std::string& id) - { widget_->RadarSiteRequested(id); }); + connect( + radarSiteLayer_.get(), + &RadarSiteLayer::RadarSiteSelected, + this, + [this](const std::string& id) + { + auto& generalSettings = settings::GeneralSettings::Instance(); + widget_->RadarSiteRequested( + id, generalSettings.center_on_radar_selection().GetValue()); + }); break; // Create the location marker layer diff --git a/scwx-qt/source/scwx/qt/settings/general_settings.cpp b/scwx-qt/source/scwx/qt/settings/general_settings.cpp index a445da6d..c0d7ec39 100644 --- a/scwx-qt/source/scwx/qt/settings/general_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/general_settings.cpp @@ -47,6 +47,7 @@ public: // SetDefault, SetMinimum, and SetMaximum are descriptive // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) antiAliasingEnabled_.SetDefault(true); + centerOnRadarSelection_.SetDefault(false); clockFormat_.SetDefault(defaultClockFormatValue); customStyleDrawLayer_.SetDefault(".*\\.annotations\\.points"); debugEnabled_.SetDefault(false); @@ -148,7 +149,8 @@ public: Impl(const Impl&&) = delete; Impl& operator=(const Impl&&) = delete; - SettingsVariable antiAliasingEnabled_ {"anti_aliasing_enabled"}; + SettingsVariable antiAliasingEnabled_ {"anti_aliasing_enabled"}; + SettingsVariable centerOnRadarSelection_ {"center_on_radar_selection"}; SettingsVariable clockFormat_ {"clock_format"}; SettingsVariable customStyleDrawLayer_ { "custom_style_draw_layer"}; @@ -189,6 +191,7 @@ GeneralSettings::GeneralSettings() : SettingsCategory("general"), p(std::make_unique()) { RegisterVariables({&p->antiAliasingEnabled_, + &p->centerOnRadarSelection_, &p->clockFormat_, &p->customStyleDrawLayer_, &p->customStyleUrl_, @@ -233,6 +236,11 @@ SettingsVariable& GeneralSettings::anti_aliasing_enabled() const return p->antiAliasingEnabled_; } +SettingsVariable& GeneralSettings::center_on_radar_selection() const +{ + return p->centerOnRadarSelection_; +} + SettingsVariable& GeneralSettings::clock_format() const { return p->clockFormat_; @@ -413,6 +421,7 @@ GeneralSettings& GeneralSettings::Instance() bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs) { return (lhs.p->antiAliasingEnabled_ == rhs.p->antiAliasingEnabled_ && + lhs.p->centerOnRadarSelection_ == rhs.p->centerOnRadarSelection_ && lhs.p->clockFormat_ == rhs.p->clockFormat_ && lhs.p->customStyleDrawLayer_ == rhs.p->customStyleDrawLayer_ && lhs.p->customStyleUrl_ == rhs.p->customStyleUrl_ && diff --git a/scwx-qt/source/scwx/qt/settings/general_settings.hpp b/scwx-qt/source/scwx/qt/settings/general_settings.hpp index ad49761b..3484461b 100644 --- a/scwx-qt/source/scwx/qt/settings/general_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/general_settings.hpp @@ -21,7 +21,8 @@ public: GeneralSettings(GeneralSettings&&) noexcept; GeneralSettings& operator=(GeneralSettings&&) noexcept; - [[nodiscard]] SettingsVariable& anti_aliasing_enabled() const; + [[nodiscard]] SettingsVariable& anti_aliasing_enabled() const; + [[nodiscard]] SettingsVariable& center_on_radar_selection() const; [[nodiscard]] SettingsVariable& clock_format() const; [[nodiscard]] SettingsVariable& custom_style_draw_layer() const; [[nodiscard]] SettingsVariable& custom_style_url() const; diff --git a/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp b/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp index c1e6d501..b3a9a381 100644 --- a/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp +++ b/scwx-qt/source/scwx/qt/ui/settings_dialog.cpp @@ -139,6 +139,7 @@ public: &warningsProvider_, &radarSiteThreshold_, &antiAliasingEnabled_, + ¢erOnRadarSelection_, &showMapAttribution_, &showMapCenter_, &showMapLogo_, @@ -258,6 +259,7 @@ public: settings::SettingsInterface warningsProvider_ {}; settings::SettingsInterface radarSiteThreshold_ {}; settings::SettingsInterface antiAliasingEnabled_ {}; + settings::SettingsInterface centerOnRadarSelection_ {}; settings::SettingsInterface showMapAttribution_ {}; settings::SettingsInterface showMapCenter_ {}; settings::SettingsInterface showMapLogo_ {}; @@ -813,6 +815,11 @@ void SettingsDialogImpl::SetupGeneralTab() generalSettings.anti_aliasing_enabled()); antiAliasingEnabled_.SetEditWidget(self_->ui->antiAliasingEnabledCheckBox); + centerOnRadarSelection_.SetSettingsVariable( + generalSettings.center_on_radar_selection()); + centerOnRadarSelection_.SetEditWidget( + self_->ui->centerOnRadarSelectionCheckBox); + showMapAttribution_.SetSettingsVariable( generalSettings.show_map_attribution()); showMapAttribution_.SetEditWidget(self_->ui->showMapAttributionCheckBox); diff --git a/scwx-qt/source/scwx/qt/ui/settings_dialog.ui b/scwx-qt/source/scwx/qt/ui/settings_dialog.ui index f14c6a96..3205e553 100644 --- a/scwx-qt/source/scwx/qt/ui/settings_dialog.ui +++ b/scwx-qt/source/scwx/qt/ui/settings_dialog.ui @@ -135,9 +135,9 @@ 0 - -260 + -412 511 - 812 + 841 @@ -625,6 +625,13 @@ + + + + Center Map on Radar Selection + + + diff --git a/test/data b/test/data index 1f3e1259..6a76030a 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 1f3e1259130a5eb4a6df37d721fe6c8301213e7e +Subproject commit 6a76030a4c3864cb387033d10ce3de88b292828d