Add anti-aliasing to settings

This commit is contained in:
Dan Paulat 2023-10-09 23:10:10 -05:00
parent 3a754c01c5
commit c5a56680ea
6 changed files with 32 additions and 6 deletions

View file

@ -201,9 +201,12 @@ public slots:
MapWidget::MapWidget(const QMapLibreGL::Settings& settings) : MapWidget::MapWidget(const QMapLibreGL::Settings& settings) :
p(std::make_unique<MapWidgetImpl>(this, settings)) p(std::make_unique<MapWidgetImpl>(this, settings))
{ {
if (settings::GeneralSettings::Instance().anti_aliasing_enabled().GetValue())
{
QSurfaceFormat surfaceFormat = QSurfaceFormat::defaultFormat(); QSurfaceFormat surfaceFormat = QSurfaceFormat::defaultFormat();
surfaceFormat.setSamples(4); surfaceFormat.setSamples(4);
setFormat(surfaceFormat); setFormat(surfaceFormat);
}
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);

View file

@ -29,6 +29,7 @@ public:
boost::to_lower(defaultDefaultAlertActionValue); boost::to_lower(defaultDefaultAlertActionValue);
boost::to_lower(defaultMapProviderValue); boost::to_lower(defaultMapProviderValue);
antiAliasingEnabled_.SetDefault(true);
debugEnabled_.SetDefault(false); debugEnabled_.SetDefault(false);
defaultAlertAction_.SetDefault(defaultDefaultAlertActionValue); defaultAlertAction_.SetDefault(defaultDefaultAlertActionValue);
defaultRadarSite_.SetDefault("KLSX"); defaultRadarSite_.SetDefault("KLSX");
@ -104,6 +105,7 @@ public:
~Impl() {} ~Impl() {}
SettingsVariable<bool> antiAliasingEnabled_ {"anti_aliasing_enabled"};
SettingsVariable<bool> debugEnabled_ {"debug_enabled"}; SettingsVariable<bool> debugEnabled_ {"debug_enabled"};
SettingsVariable<std::string> defaultAlertAction_ {"default_alert_action"}; SettingsVariable<std::string> defaultAlertAction_ {"default_alert_action"};
SettingsVariable<std::string> defaultRadarSite_ {"default_radar_site"}; SettingsVariable<std::string> defaultRadarSite_ {"default_radar_site"};
@ -122,7 +124,8 @@ public:
GeneralSettings::GeneralSettings() : GeneralSettings::GeneralSettings() :
SettingsCategory("general"), p(std::make_unique<Impl>()) SettingsCategory("general"), p(std::make_unique<Impl>())
{ {
RegisterVariables({&p->debugEnabled_, RegisterVariables({&p->antiAliasingEnabled_,
&p->debugEnabled_,
&p->defaultAlertAction_, &p->defaultAlertAction_,
&p->defaultRadarSite_, &p->defaultRadarSite_,
&p->fontSizes_, &p->fontSizes_,
@ -143,6 +146,11 @@ GeneralSettings::GeneralSettings(GeneralSettings&&) noexcept = default;
GeneralSettings& GeneralSettings&
GeneralSettings::operator=(GeneralSettings&&) noexcept = default; GeneralSettings::operator=(GeneralSettings&&) noexcept = default;
SettingsVariable<bool>& GeneralSettings::anti_aliasing_enabled() const
{
return p->antiAliasingEnabled_;
}
SettingsVariable<bool>& GeneralSettings::debug_enabled() const SettingsVariable<bool>& GeneralSettings::debug_enabled() const
{ {
return p->debugEnabled_; return p->debugEnabled_;
@ -229,7 +237,8 @@ GeneralSettings& GeneralSettings::Instance()
bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs) bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs)
{ {
return (lhs.p->debugEnabled_ == rhs.p->debugEnabled_ && return (lhs.p->antiAliasingEnabled_ == rhs.p->antiAliasingEnabled_ &&
lhs.p->debugEnabled_ == rhs.p->debugEnabled_ &&
lhs.p->defaultAlertAction_ == rhs.p->defaultAlertAction_ && lhs.p->defaultAlertAction_ == rhs.p->defaultAlertAction_ &&
lhs.p->defaultRadarSite_ == rhs.p->defaultRadarSite_ && lhs.p->defaultRadarSite_ == rhs.p->defaultRadarSite_ &&
lhs.p->fontSizes_ == rhs.p->fontSizes_ && lhs.p->fontSizes_ == rhs.p->fontSizes_ &&

View file

@ -25,6 +25,7 @@ public:
GeneralSettings(GeneralSettings&&) noexcept; GeneralSettings(GeneralSettings&&) noexcept;
GeneralSettings& operator=(GeneralSettings&&) noexcept; GeneralSettings& operator=(GeneralSettings&&) noexcept;
SettingsVariable<bool>& anti_aliasing_enabled() const;
SettingsVariable<bool>& debug_enabled() const; SettingsVariable<bool>& debug_enabled() const;
SettingsVariable<std::string>& default_alert_action() const; SettingsVariable<std::string>& default_alert_action() const;
SettingsVariable<std::string>& default_radar_site() const; SettingsVariable<std::string>& default_radar_site() const;

View file

@ -99,6 +99,7 @@ public:
&mapboxApiKey_, &mapboxApiKey_,
&mapTilerApiKey_, &mapTilerApiKey_,
&defaultAlertAction_, &defaultAlertAction_,
&antiAliasingEnabled_,
&updateNotificationsEnabled_, &updateNotificationsEnabled_,
&debugEnabled_, &debugEnabled_,
&hoverTextWrap_, &hoverTextWrap_,
@ -176,6 +177,7 @@ public:
settings::SettingsInterface<std::string> mapboxApiKey_ {}; settings::SettingsInterface<std::string> mapboxApiKey_ {};
settings::SettingsInterface<std::string> mapTilerApiKey_ {}; settings::SettingsInterface<std::string> mapTilerApiKey_ {};
settings::SettingsInterface<std::string> defaultAlertAction_ {}; settings::SettingsInterface<std::string> defaultAlertAction_ {};
settings::SettingsInterface<bool> antiAliasingEnabled_ {};
settings::SettingsInterface<bool> updateNotificationsEnabled_ {}; settings::SettingsInterface<bool> updateNotificationsEnabled_ {};
settings::SettingsInterface<bool> debugEnabled_ {}; settings::SettingsInterface<bool> debugEnabled_ {};
@ -511,6 +513,10 @@ void SettingsDialogImpl::SetupGeneralTab()
defaultAlertAction_.SetEditWidget(self_->ui->defaultAlertActionComboBox); defaultAlertAction_.SetEditWidget(self_->ui->defaultAlertActionComboBox);
defaultAlertAction_.SetResetButton(self_->ui->resetDefaultAlertActionButton); defaultAlertAction_.SetResetButton(self_->ui->resetDefaultAlertActionButton);
antiAliasingEnabled_.SetSettingsVariable(
generalSettings.anti_aliasing_enabled());
antiAliasingEnabled_.SetEditWidget(self_->ui->antiAliasingEnabledCheckBox);
updateNotificationsEnabled_.SetSettingsVariable( updateNotificationsEnabled_.SetSettingsVariable(
generalSettings.update_notifications_enabled()); generalSettings.update_notifications_enabled());
updateNotificationsEnabled_.SetEditWidget( updateNotificationsEnabled_.SetEditWidget(

View file

@ -292,6 +292,13 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="antiAliasingEnabledCheckBox">
<property name="text">
<string>Anti-Aliasing Enabled</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="enableUpdateNotificationsCheckBox"> <widget class="QCheckBox" name="enableUpdateNotificationsCheckBox">
<property name="text"> <property name="text">

@ -1 +1 @@
Subproject commit 58d61ba37385c699df1eca547668ec3c2a93871e Subproject commit fc428fa1460b3d5ce04646727e379e2f4f90f5ec