mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:20:05 +00:00
Add setting for centering radar on site selection
This commit is contained in:
parent
7fdf25f1e7
commit
6b2f3dd84f
6 changed files with 39 additions and 10 deletions
|
|
@ -1265,11 +1265,16 @@ void MapWidgetImpl::AddLayer(types::LayerType type,
|
|||
case types::InformationLayer::RadarSite:
|
||||
radarSiteLayer_ = std::make_shared<RadarSiteLayer>(context_);
|
||||
AddLayer(layerName, radarSiteLayer_, before);
|
||||
connect(radarSiteLayer_.get(),
|
||||
&RadarSiteLayer::RadarSiteSelected,
|
||||
this,
|
||||
[this](const std::string& id)
|
||||
{ widget_->RadarSiteRequested(id, false); });
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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<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> customStyleDrawLayer_ {
|
||||
"custom_style_draw_layer"};
|
||||
|
|
@ -189,6 +191,7 @@ GeneralSettings::GeneralSettings() :
|
|||
SettingsCategory("general"), p(std::make_unique<Impl>())
|
||||
{
|
||||
RegisterVariables({&p->antiAliasingEnabled_,
|
||||
&p->centerOnRadarSelection_,
|
||||
&p->clockFormat_,
|
||||
&p->customStyleDrawLayer_,
|
||||
&p->customStyleUrl_,
|
||||
|
|
@ -233,6 +236,11 @@ SettingsVariable<bool>& GeneralSettings::anti_aliasing_enabled() const
|
|||
return p->antiAliasingEnabled_;
|
||||
}
|
||||
|
||||
SettingsVariable<bool>& GeneralSettings::center_on_radar_selection() const
|
||||
{
|
||||
return p->centerOnRadarSelection_;
|
||||
}
|
||||
|
||||
SettingsVariable<std::string>& 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_ &&
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ public:
|
|||
GeneralSettings(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>& custom_style_draw_layer() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& custom_style_url() const;
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ public:
|
|||
&warningsProvider_,
|
||||
&radarSiteThreshold_,
|
||||
&antiAliasingEnabled_,
|
||||
¢erOnRadarSelection_,
|
||||
&showMapAttribution_,
|
||||
&showMapCenter_,
|
||||
&showMapLogo_,
|
||||
|
|
@ -258,6 +259,7 @@ public:
|
|||
settings::SettingsInterface<std::string> warningsProvider_ {};
|
||||
settings::SettingsInterface<double> radarSiteThreshold_ {};
|
||||
settings::SettingsInterface<bool> antiAliasingEnabled_ {};
|
||||
settings::SettingsInterface<bool> centerOnRadarSelection_ {};
|
||||
settings::SettingsInterface<bool> showMapAttribution_ {};
|
||||
settings::SettingsInterface<bool> showMapCenter_ {};
|
||||
settings::SettingsInterface<bool> 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);
|
||||
|
|
|
|||
|
|
@ -135,9 +135,9 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-260</y>
|
||||
<y>-412</y>
|
||||
<width>511</width>
|
||||
<height>812</height>
|
||||
<height>841</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
|
@ -625,6 +625,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="centerOnRadarSelectionCheckBox">
|
||||
<property name="text">
|
||||
<string>Center Map on Radar Selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cursorIconAlwaysOnCheckBox">
|
||||
<property name="acceptDrops">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue