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

View file

@ -38,6 +38,8 @@ public:
SettingsVariable<std::string>& map_provider() const; SettingsVariable<std::string>& map_provider() const;
SettingsVariable<std::string>& mapbox_api_key() const; SettingsVariable<std::string>& mapbox_api_key() const;
SettingsVariable<std::string>& maptiler_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<std::string>& theme() const;
SettingsVariable<bool>& track_location() const; SettingsVariable<bool>& track_location() const;
SettingsVariable<bool>& update_notifications_enabled() const; SettingsVariable<bool>& update_notifications_enabled() const;

View file

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

View file

@ -322,6 +322,20 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QCheckBox" name="enableUpdateNotificationsCheckBox"> <widget class="QCheckBox" name="enableUpdateNotificationsCheckBox">
<property name="text"> <property name="text">
@ -373,8 +387,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>514</width> <width>66</width>
<height>382</height> <height>18</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">

@ -1 +1 @@
Subproject commit 08d481f3bf96ebd44825359082cfd1243c09a72c Subproject commit 9cef3730c84d22803ea433fba8111826327dd82f