Add map logo and attribution toggle to settings

This commit is contained in:
Dan Paulat 2024-03-06 23:13:18 -06:00
parent 4c844459a0
commit 7cfb55a4de
5 changed files with 48 additions and 3 deletions

View file

@ -46,6 +46,8 @@ public:
mapProvider_.SetDefault(defaultMapProviderValue);
mapboxApiKey_.SetDefault("?");
maptilerApiKey_.SetDefault("?");
showMapAttribution_.SetDefault(true);
showMapLogo_.SetDefault(true);
theme_.SetDefault(defaultThemeValue);
trackLocation_.SetDefault(false);
updateNotificationsEnabled_.SetDefault(true);
@ -142,6 +144,8 @@ public:
SettingsVariable<std::string> mapProvider_ {"map_provider"};
SettingsVariable<std::string> mapboxApiKey_ {"mapbox_api_key"};
SettingsVariable<std::string> maptilerApiKey_ {"maptiler_api_key"};
SettingsVariable<bool> showMapAttribution_ {"show_map_attribution"};
SettingsVariable<bool> showMapLogo_ {"show_map_logo"};
SettingsVariable<std::string> theme_ {"theme"};
SettingsVariable<bool> trackLocation_ {"track_location"};
SettingsVariable<bool> updateNotificationsEnabled_ {"update_notifications"};
@ -163,6 +167,8 @@ GeneralSettings::GeneralSettings() :
&p->mapProvider_,
&p->mapboxApiKey_,
&p->maptilerApiKey_,
&p->showMapAttribution_,
&p->showMapLogo_,
&p->theme_,
&p->trackLocation_,
&p->updateNotificationsEnabled_});
@ -240,6 +246,16 @@ SettingsVariable<std::string>& GeneralSettings::maptiler_api_key() const
return p->maptilerApiKey_;
}
SettingsVariable<bool>& GeneralSettings::show_map_attribution() const
{
return p->showMapAttribution_;
}
SettingsVariable<bool>& GeneralSettings::show_map_logo() const
{
return p->showMapLogo_;
}
SettingsVariable<std::string>& GeneralSettings::theme() const
{
return p->theme_;
@ -289,6 +305,8 @@ bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs)
lhs.p->mapProvider_ == rhs.p->mapProvider_ &&
lhs.p->mapboxApiKey_ == rhs.p->mapboxApiKey_ &&
lhs.p->maptilerApiKey_ == rhs.p->maptilerApiKey_ &&
lhs.p->showMapAttribution_ == rhs.p->showMapAttribution_ &&
lhs.p->showMapLogo_ == rhs.p->showMapLogo_ &&
lhs.p->theme_ == rhs.p->theme_ &&
lhs.p->trackLocation_ == rhs.p->trackLocation_ &&
lhs.p->updateNotificationsEnabled_ ==

View file

@ -38,6 +38,8 @@ public:
SettingsVariable<std::string>& map_provider() const;
SettingsVariable<std::string>& mapbox_api_key() const;
SettingsVariable<std::string>& maptiler_api_key() const;
SettingsVariable<bool>& show_map_attribution() const;
SettingsVariable<bool>& show_map_logo() const;
SettingsVariable<std::string>& theme() const;
SettingsVariable<bool>& track_location() const;
SettingsVariable<bool>& update_notifications_enabled() const;

View file

@ -130,6 +130,8 @@ public:
&theme_,
&defaultAlertAction_,
&antiAliasingEnabled_,
&showMapAttribution_,
&showMapLogo_,
&updateNotificationsEnabled_,
&debugEnabled_,
&alertAudioSoundFile_,
@ -220,6 +222,8 @@ public:
settings::SettingsInterface<std::string> defaultAlertAction_ {};
settings::SettingsInterface<std::string> theme_ {};
settings::SettingsInterface<bool> antiAliasingEnabled_ {};
settings::SettingsInterface<bool> showMapAttribution_ {};
settings::SettingsInterface<bool> showMapLogo_ {};
settings::SettingsInterface<bool> updateNotificationsEnabled_ {};
settings::SettingsInterface<bool> debugEnabled_ {};
@ -617,6 +621,13 @@ void SettingsDialogImpl::SetupGeneralTab()
generalSettings.anti_aliasing_enabled());
antiAliasingEnabled_.SetEditWidget(self_->ui->antiAliasingEnabledCheckBox);
showMapAttribution_.SetSettingsVariable(
generalSettings.show_map_attribution());
showMapAttribution_.SetEditWidget(self_->ui->showMapAttributionCheckBox);
showMapLogo_.SetSettingsVariable(generalSettings.show_map_logo());
showMapLogo_.SetEditWidget(self_->ui->showMapLogoCheckBox);
updateNotificationsEnabled_.SetSettingsVariable(
generalSettings.update_notifications_enabled());
updateNotificationsEnabled_.SetEditWidget(

View file

@ -322,6 +322,20 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showMapAttributionCheckBox">
<property name="text">
<string>Show Map Attribution</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showMapLogoCheckBox">
<property name="text">
<string>Show Map Logo</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableUpdateNotificationsCheckBox">
<property name="text">
@ -373,8 +387,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>382</height>
<width>66</width>
<height>18</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">