Add setting for centering radar on site selection

This commit is contained in:
AdenKoperczak 2025-04-02 11:20:46 -04:00
parent 7fdf25f1e7
commit 6b2f3dd84f
6 changed files with 39 additions and 10 deletions

View file

@ -1265,11 +1265,16 @@ void MapWidgetImpl::AddLayer(types::LayerType type,
case types::InformationLayer::RadarSite: case types::InformationLayer::RadarSite:
radarSiteLayer_ = std::make_shared<RadarSiteLayer>(context_); radarSiteLayer_ = std::make_shared<RadarSiteLayer>(context_);
AddLayer(layerName, radarSiteLayer_, before); AddLayer(layerName, radarSiteLayer_, before);
connect(radarSiteLayer_.get(), connect(
&RadarSiteLayer::RadarSiteSelected, radarSiteLayer_.get(),
this, &RadarSiteLayer::RadarSiteSelected,
[this](const std::string& id) this,
{ widget_->RadarSiteRequested(id, false); }); [this](const std::string& id)
{
auto& generalSettings = settings::GeneralSettings::Instance();
widget_->RadarSiteRequested(
id, generalSettings.center_on_radar_selection().GetValue());
});
break; break;
// Create the location marker layer // Create the location marker layer

View file

@ -47,6 +47,7 @@ public:
// SetDefault, SetMinimum, and SetMaximum are descriptive // SetDefault, SetMinimum, and SetMaximum are descriptive
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers) // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
antiAliasingEnabled_.SetDefault(true); antiAliasingEnabled_.SetDefault(true);
centerOnRadarSelection_.SetDefault(false);
clockFormat_.SetDefault(defaultClockFormatValue); clockFormat_.SetDefault(defaultClockFormatValue);
customStyleDrawLayer_.SetDefault(".*\\.annotations\\.points"); customStyleDrawLayer_.SetDefault(".*\\.annotations\\.points");
debugEnabled_.SetDefault(false); debugEnabled_.SetDefault(false);
@ -148,7 +149,8 @@ public:
Impl(const Impl&&) = delete; Impl(const Impl&&) = delete;
Impl& operator=(const Impl&&) = delete; Impl& operator=(const Impl&&) = delete;
SettingsVariable<bool> antiAliasingEnabled_ {"anti_aliasing_enabled"}; SettingsVariable<bool> antiAliasingEnabled_ {"anti_aliasing_enabled"};
SettingsVariable<bool> centerOnRadarSelection_ {"center_on_radar_selection"};
SettingsVariable<std::string> clockFormat_ {"clock_format"}; SettingsVariable<std::string> clockFormat_ {"clock_format"};
SettingsVariable<std::string> customStyleDrawLayer_ { SettingsVariable<std::string> customStyleDrawLayer_ {
"custom_style_draw_layer"}; "custom_style_draw_layer"};
@ -189,6 +191,7 @@ GeneralSettings::GeneralSettings() :
SettingsCategory("general"), p(std::make_unique<Impl>()) SettingsCategory("general"), p(std::make_unique<Impl>())
{ {
RegisterVariables({&p->antiAliasingEnabled_, RegisterVariables({&p->antiAliasingEnabled_,
&p->centerOnRadarSelection_,
&p->clockFormat_, &p->clockFormat_,
&p->customStyleDrawLayer_, &p->customStyleDrawLayer_,
&p->customStyleUrl_, &p->customStyleUrl_,
@ -233,6 +236,11 @@ SettingsVariable<bool>& GeneralSettings::anti_aliasing_enabled() const
return p->antiAliasingEnabled_; return p->antiAliasingEnabled_;
} }
SettingsVariable<bool>& GeneralSettings::center_on_radar_selection() const
{
return p->centerOnRadarSelection_;
}
SettingsVariable<std::string>& GeneralSettings::clock_format() const SettingsVariable<std::string>& GeneralSettings::clock_format() const
{ {
return p->clockFormat_; return p->clockFormat_;
@ -413,6 +421,7 @@ GeneralSettings& GeneralSettings::Instance()
bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs) bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs)
{ {
return (lhs.p->antiAliasingEnabled_ == rhs.p->antiAliasingEnabled_ && return (lhs.p->antiAliasingEnabled_ == rhs.p->antiAliasingEnabled_ &&
lhs.p->centerOnRadarSelection_ == rhs.p->centerOnRadarSelection_ &&
lhs.p->clockFormat_ == rhs.p->clockFormat_ && lhs.p->clockFormat_ == rhs.p->clockFormat_ &&
lhs.p->customStyleDrawLayer_ == rhs.p->customStyleDrawLayer_ && lhs.p->customStyleDrawLayer_ == rhs.p->customStyleDrawLayer_ &&
lhs.p->customStyleUrl_ == rhs.p->customStyleUrl_ && lhs.p->customStyleUrl_ == rhs.p->customStyleUrl_ &&

View file

@ -21,7 +21,8 @@ public:
GeneralSettings(GeneralSettings&&) noexcept; GeneralSettings(GeneralSettings&&) noexcept;
GeneralSettings& operator=(GeneralSettings&&) noexcept; GeneralSettings& operator=(GeneralSettings&&) noexcept;
[[nodiscard]] SettingsVariable<bool>& anti_aliasing_enabled() const; [[nodiscard]] SettingsVariable<bool>& anti_aliasing_enabled() const;
[[nodiscard]] SettingsVariable<bool>& center_on_radar_selection() const;
[[nodiscard]] SettingsVariable<std::string>& clock_format() const; [[nodiscard]] SettingsVariable<std::string>& clock_format() const;
[[nodiscard]] SettingsVariable<std::string>& custom_style_draw_layer() const; [[nodiscard]] SettingsVariable<std::string>& custom_style_draw_layer() const;
[[nodiscard]] SettingsVariable<std::string>& custom_style_url() const; [[nodiscard]] SettingsVariable<std::string>& custom_style_url() const;

View file

@ -139,6 +139,7 @@ public:
&warningsProvider_, &warningsProvider_,
&radarSiteThreshold_, &radarSiteThreshold_,
&antiAliasingEnabled_, &antiAliasingEnabled_,
&centerOnRadarSelection_,
&showMapAttribution_, &showMapAttribution_,
&showMapCenter_, &showMapCenter_,
&showMapLogo_, &showMapLogo_,
@ -258,6 +259,7 @@ public:
settings::SettingsInterface<std::string> warningsProvider_ {}; settings::SettingsInterface<std::string> warningsProvider_ {};
settings::SettingsInterface<double> radarSiteThreshold_ {}; settings::SettingsInterface<double> radarSiteThreshold_ {};
settings::SettingsInterface<bool> antiAliasingEnabled_ {}; settings::SettingsInterface<bool> antiAliasingEnabled_ {};
settings::SettingsInterface<bool> centerOnRadarSelection_ {};
settings::SettingsInterface<bool> showMapAttribution_ {}; settings::SettingsInterface<bool> showMapAttribution_ {};
settings::SettingsInterface<bool> showMapCenter_ {}; settings::SettingsInterface<bool> showMapCenter_ {};
settings::SettingsInterface<bool> showMapLogo_ {}; settings::SettingsInterface<bool> showMapLogo_ {};
@ -813,6 +815,11 @@ void SettingsDialogImpl::SetupGeneralTab()
generalSettings.anti_aliasing_enabled()); generalSettings.anti_aliasing_enabled());
antiAliasingEnabled_.SetEditWidget(self_->ui->antiAliasingEnabledCheckBox); antiAliasingEnabled_.SetEditWidget(self_->ui->antiAliasingEnabledCheckBox);
centerOnRadarSelection_.SetSettingsVariable(
generalSettings.center_on_radar_selection());
centerOnRadarSelection_.SetEditWidget(
self_->ui->centerOnRadarSelectionCheckBox);
showMapAttribution_.SetSettingsVariable( showMapAttribution_.SetSettingsVariable(
generalSettings.show_map_attribution()); generalSettings.show_map_attribution());
showMapAttribution_.SetEditWidget(self_->ui->showMapAttributionCheckBox); showMapAttribution_.SetEditWidget(self_->ui->showMapAttributionCheckBox);

View file

@ -135,9 +135,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-260</y> <y>-412</y>
<width>511</width> <width>511</width>
<height>812</height> <height>841</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -625,6 +625,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="centerOnRadarSelectionCheckBox">
<property name="text">
<string>Center Map on Radar Selection</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="cursorIconAlwaysOnCheckBox"> <widget class="QCheckBox" name="cursorIconAlwaysOnCheckBox">
<property name="acceptDrops"> <property name="acceptDrops">

@ -1 +1 @@
Subproject commit 1f3e1259130a5eb4a6df37d721fe6c8301213e7e Subproject commit 6a76030a4c3864cb387033d10ce3de88b292828d