mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:10:06 +00:00
Add NMEA settings
This commit is contained in:
parent
075d65a535
commit
b7a258d143
5 changed files with 74 additions and 8 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
#include <scwx/qt/settings/settings_definitions.hpp>
|
#include <scwx/qt/settings/settings_definitions.hpp>
|
||||||
#include <scwx/qt/map/map_provider.hpp>
|
#include <scwx/qt/map/map_provider.hpp>
|
||||||
#include <scwx/qt/types/alert_types.hpp>
|
#include <scwx/qt/types/alert_types.hpp>
|
||||||
|
#include <scwx/qt/types/location_types.hpp>
|
||||||
#include <scwx/qt/types/qt_types.hpp>
|
#include <scwx/qt/types/qt_types.hpp>
|
||||||
#include <scwx/qt/types/time_types.hpp>
|
#include <scwx/qt/types/time_types.hpp>
|
||||||
#include <scwx/util/time.hpp>
|
#include <scwx/util/time.hpp>
|
||||||
|
|
@ -37,6 +38,8 @@ public:
|
||||||
types::GetDefaultTimeZoneName(types::DefaultTimeZone::Radar);
|
types::GetDefaultTimeZoneName(types::DefaultTimeZone::Radar);
|
||||||
std::string defaultMapProviderValue =
|
std::string defaultMapProviderValue =
|
||||||
map::GetMapProviderName(map::MapProvider::MapTiler);
|
map::GetMapProviderName(map::MapProvider::MapTiler);
|
||||||
|
std::string defaultPositioningPlugin =
|
||||||
|
types::GetPositioningPluginName(types::PositioningPlugin::Default);
|
||||||
std::string defaultThemeValue =
|
std::string defaultThemeValue =
|
||||||
types::GetUiStyleName(types::UiStyle::Default);
|
types::GetUiStyleName(types::UiStyle::Default);
|
||||||
|
|
||||||
|
|
@ -44,6 +47,7 @@ public:
|
||||||
boost::to_lower(defaultDefaultAlertActionValue);
|
boost::to_lower(defaultDefaultAlertActionValue);
|
||||||
boost::to_lower(defaultDefaultTimeZoneValue);
|
boost::to_lower(defaultDefaultTimeZoneValue);
|
||||||
boost::to_lower(defaultMapProviderValue);
|
boost::to_lower(defaultMapProviderValue);
|
||||||
|
boost::to_lower(defaultPositioningPlugin);
|
||||||
boost::to_lower(defaultThemeValue);
|
boost::to_lower(defaultThemeValue);
|
||||||
|
|
||||||
antiAliasingEnabled_.SetDefault(true);
|
antiAliasingEnabled_.SetDefault(true);
|
||||||
|
|
@ -61,6 +65,9 @@ public:
|
||||||
mapProvider_.SetDefault(defaultMapProviderValue);
|
mapProvider_.SetDefault(defaultMapProviderValue);
|
||||||
mapboxApiKey_.SetDefault("?");
|
mapboxApiKey_.SetDefault("?");
|
||||||
maptilerApiKey_.SetDefault("?");
|
maptilerApiKey_.SetDefault("?");
|
||||||
|
nmeaBaudRate_.SetDefault(9600);
|
||||||
|
nmeaSource_.SetDefault("");
|
||||||
|
positioningPlugin_.SetDefault(defaultPositioningPlugin);
|
||||||
showMapAttribution_.SetDefault(true);
|
showMapAttribution_.SetDefault(true);
|
||||||
showMapCenter_.SetDefault(false);
|
showMapCenter_.SetDefault(false);
|
||||||
showMapLogo_.SetDefault(true);
|
showMapLogo_.SetDefault(true);
|
||||||
|
|
@ -83,6 +90,8 @@ public:
|
||||||
loopSpeed_.SetMaximum(99.99);
|
loopSpeed_.SetMaximum(99.99);
|
||||||
loopTime_.SetMinimum(1);
|
loopTime_.SetMinimum(1);
|
||||||
loopTime_.SetMaximum(1440);
|
loopTime_.SetMaximum(1440);
|
||||||
|
nmeaBaudRate_.SetMinimum(1);
|
||||||
|
nmeaBaudRate_.SetMaximum(999999999);
|
||||||
|
|
||||||
clockFormat_.SetValidator(
|
clockFormat_.SetValidator(
|
||||||
SCWX_SETTINGS_ENUM_VALIDATOR(scwx::util::ClockFormat,
|
SCWX_SETTINGS_ENUM_VALIDATOR(scwx::util::ClockFormat,
|
||||||
|
|
@ -104,6 +113,10 @@ public:
|
||||||
{ return !value.empty(); });
|
{ return !value.empty(); });
|
||||||
maptilerApiKey_.SetValidator([](const std::string& value)
|
maptilerApiKey_.SetValidator([](const std::string& value)
|
||||||
{ return !value.empty(); });
|
{ return !value.empty(); });
|
||||||
|
positioningPlugin_.SetValidator(
|
||||||
|
SCWX_SETTINGS_ENUM_VALIDATOR(types::PositioningPlugin,
|
||||||
|
types::PositioningPluginIterator(),
|
||||||
|
types::GetPositioningPluginName));
|
||||||
theme_.SetValidator( //
|
theme_.SetValidator( //
|
||||||
SCWX_SETTINGS_ENUM_VALIDATOR(types::UiStyle, //
|
SCWX_SETTINGS_ENUM_VALIDATOR(types::UiStyle, //
|
||||||
types::UiStyleIterator(),
|
types::UiStyleIterator(),
|
||||||
|
|
@ -130,6 +143,9 @@ 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<std::int64_t> nmeaBaudRate_ {"nmea_baud_rate"};
|
||||||
|
SettingsVariable<std::string> nmeaSource_ {"nmea_source"};
|
||||||
|
SettingsVariable<std::string> positioningPlugin_ {"positioning_plugin"};
|
||||||
SettingsVariable<bool> showMapAttribution_ {"show_map_attribution"};
|
SettingsVariable<bool> showMapAttribution_ {"show_map_attribution"};
|
||||||
SettingsVariable<bool> showMapCenter_ {"show_map_center"};
|
SettingsVariable<bool> showMapCenter_ {"show_map_center"};
|
||||||
SettingsVariable<bool> showMapLogo_ {"show_map_logo"};
|
SettingsVariable<bool> showMapLogo_ {"show_map_logo"};
|
||||||
|
|
@ -157,6 +173,9 @@ GeneralSettings::GeneralSettings() :
|
||||||
&p->mapProvider_,
|
&p->mapProvider_,
|
||||||
&p->mapboxApiKey_,
|
&p->mapboxApiKey_,
|
||||||
&p->maptilerApiKey_,
|
&p->maptilerApiKey_,
|
||||||
|
&p->nmeaBaudRate_,
|
||||||
|
&p->nmeaSource_,
|
||||||
|
&p->positioningPlugin_,
|
||||||
&p->showMapAttribution_,
|
&p->showMapAttribution_,
|
||||||
&p->showMapCenter_,
|
&p->showMapCenter_,
|
||||||
&p->showMapLogo_,
|
&p->showMapLogo_,
|
||||||
|
|
@ -248,6 +267,21 @@ SettingsVariable<std::string>& GeneralSettings::maptiler_api_key() const
|
||||||
return p->maptilerApiKey_;
|
return p->maptilerApiKey_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsVariable<std::int64_t>& GeneralSettings::nmea_baud_rate() const
|
||||||
|
{
|
||||||
|
return p->nmeaBaudRate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsVariable<std::string>& GeneralSettings::nmea_source() const
|
||||||
|
{
|
||||||
|
return p->nmeaSource_;
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsVariable<std::string>& GeneralSettings::positioning_plugin() const
|
||||||
|
{
|
||||||
|
return p->positioningPlugin_;
|
||||||
|
}
|
||||||
|
|
||||||
SettingsVariable<bool>& GeneralSettings::show_map_attribution() const
|
SettingsVariable<bool>& GeneralSettings::show_map_attribution() const
|
||||||
{
|
{
|
||||||
return p->showMapAttribution_;
|
return p->showMapAttribution_;
|
||||||
|
|
@ -319,6 +353,9 @@ 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->nmeaBaudRate_ == rhs.p->nmeaBaudRate_ &&
|
||||||
|
lhs.p->nmeaSource_ == rhs.p->nmeaSource_ &&
|
||||||
|
lhs.p->positioningPlugin_ == rhs.p->positioningPlugin_ &&
|
||||||
lhs.p->showMapAttribution_ == rhs.p->showMapAttribution_ &&
|
lhs.p->showMapAttribution_ == rhs.p->showMapAttribution_ &&
|
||||||
lhs.p->showMapCenter_ == rhs.p->showMapCenter_ &&
|
lhs.p->showMapCenter_ == rhs.p->showMapCenter_ &&
|
||||||
lhs.p->showMapLogo_ == rhs.p->showMapLogo_ &&
|
lhs.p->showMapLogo_ == rhs.p->showMapLogo_ &&
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,9 @@ 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<std::int64_t>& nmea_baud_rate() const;
|
||||||
|
SettingsVariable<std::string>& nmea_source() const;
|
||||||
|
SettingsVariable<std::string>& positioning_plugin() const;
|
||||||
SettingsVariable<bool>& show_map_attribution() const;
|
SettingsVariable<bool>& show_map_attribution() const;
|
||||||
SettingsVariable<bool>& show_map_center() const;
|
SettingsVariable<bool>& show_map_center() const;
|
||||||
SettingsVariable<bool>& show_map_logo() const;
|
SettingsVariable<bool>& show_map_logo() const;
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,24 @@ static const std::unordered_map<LocationMethod, std::string>
|
||||||
{LocationMethod::All, "All"},
|
{LocationMethod::All, "All"},
|
||||||
{LocationMethod::Unknown, "?"}};
|
{LocationMethod::Unknown, "?"}};
|
||||||
|
|
||||||
|
static const std::unordered_map<PositioningPlugin, std::string>
|
||||||
|
positioningPluginName_ {{PositioningPlugin::Default, "Default"},
|
||||||
|
{PositioningPlugin::Nmea, "NMEA"},
|
||||||
|
{PositioningPlugin::Unknown, "?"}};
|
||||||
|
|
||||||
SCWX_GET_ENUM(LocationMethod, GetLocationMethod, locationMethodName_)
|
SCWX_GET_ENUM(LocationMethod, GetLocationMethod, locationMethodName_)
|
||||||
|
SCWX_GET_ENUM(PositioningPlugin, GetPositioningPlugin, positioningPluginName_)
|
||||||
|
|
||||||
const std::string& GetLocationMethodName(LocationMethod locationMethod)
|
const std::string& GetLocationMethodName(LocationMethod locationMethod)
|
||||||
{
|
{
|
||||||
return locationMethodName_.at(locationMethod);
|
return locationMethodName_.at(locationMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& GetPositioningPluginName(PositioningPlugin positioningPlugin)
|
||||||
|
{
|
||||||
|
return positioningPluginName_.at(positioningPlugin);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace types
|
} // namespace types
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,24 @@ typedef scwx::util::
|
||||||
Iterator<LocationMethod, LocationMethod::Fixed, LocationMethod::All>
|
Iterator<LocationMethod, LocationMethod::Fixed, LocationMethod::All>
|
||||||
LocationMethodIterator;
|
LocationMethodIterator;
|
||||||
|
|
||||||
|
enum class PositioningPlugin
|
||||||
|
{
|
||||||
|
Default,
|
||||||
|
Nmea,
|
||||||
|
Unknown
|
||||||
|
};
|
||||||
|
typedef scwx::util::Iterator<PositioningPlugin,
|
||||||
|
PositioningPlugin::Default,
|
||||||
|
PositioningPlugin::Nmea>
|
||||||
|
PositioningPluginIterator;
|
||||||
|
|
||||||
LocationMethod GetLocationMethod(const std::string& name);
|
LocationMethod GetLocationMethod(const std::string& name);
|
||||||
const std::string& GetLocationMethodName(LocationMethod locationMethod);
|
const std::string& GetLocationMethodName(LocationMethod locationMethod);
|
||||||
|
|
||||||
|
PositioningPlugin GetPositioningPlugin(const std::string& name);
|
||||||
|
const std::string&
|
||||||
|
GetPositioningPluginName(PositioningPlugin positioningPlugin);
|
||||||
|
|
||||||
} // namespace types
|
} // namespace types
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit af115273844804d29c502b5ecbb94eee2b4b02f4
|
Subproject commit 35e3e40d63bc020dfdc50c438c700c368fdf32fc
|
||||||
Loading…
Add table
Add a link
Reference in a new issue