mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:30:04 +00:00
Merge pull request #359 from AdenKoperczak/settings_tidy_and_checks
Settings tidy and checks
This commit is contained in:
commit
4038fb2c43
39 changed files with 323 additions and 397 deletions
|
|
@ -60,6 +60,8 @@ public:
|
|||
void WriteMarkerSettings();
|
||||
std::shared_ptr<MarkerRecord> GetMarkerByName(const std::string& name);
|
||||
|
||||
bool markerFileRead_ {false};
|
||||
|
||||
void InitalizeIds();
|
||||
types::MarkerId NewId();
|
||||
types::MarkerId lastId_ {0};
|
||||
|
|
@ -209,11 +211,16 @@ void MarkerManager::Impl::ReadMarkerSettings()
|
|||
}
|
||||
}
|
||||
|
||||
markerFileRead_ = true;
|
||||
Q_EMIT self_->MarkersUpdated();
|
||||
}
|
||||
|
||||
void MarkerManager::Impl::WriteMarkerSettings()
|
||||
{
|
||||
if (!markerFileRead_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger_->info("Saving location marker settings");
|
||||
|
||||
const std::shared_lock lock(markerRecordLock_);
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ public:
|
|||
boost::unordered_flat_map<std::string, std::shared_ptr<PlacefileRecord>>
|
||||
placefileRecordMap_ {};
|
||||
std::shared_mutex placefileRecordLock_ {};
|
||||
|
||||
bool placefileSettingsRead_ {false};
|
||||
};
|
||||
|
||||
class PlacefileManager::Impl::PlacefileRecord
|
||||
|
|
@ -413,10 +415,15 @@ void PlacefileManager::Impl::ReadPlacefileSettings()
|
|||
}
|
||||
}
|
||||
}
|
||||
placefileSettingsRead_ = true;
|
||||
}
|
||||
|
||||
void PlacefileManager::Impl::WritePlacefileSettings()
|
||||
{
|
||||
if (!placefileSettingsRead_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger_->info("Saving placefile settings");
|
||||
|
||||
std::shared_lock lock {placefileRecordLock_};
|
||||
|
|
|
|||
|
|
@ -67,9 +67,10 @@ void SettingsManager::Initialize()
|
|||
}
|
||||
|
||||
p->settingsPath_ = appDataPath + "/settings.json";
|
||||
p->initialized_ = true;
|
||||
|
||||
ReadSettings(p->settingsPath_);
|
||||
|
||||
p->initialized_ = true;
|
||||
p->ValidateSettings();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ public:
|
|||
manager::PlacefileManager::Instance()};
|
||||
|
||||
types::LayerVector layers_ {};
|
||||
|
||||
bool fileRead_ {false};
|
||||
};
|
||||
|
||||
LayerModel::LayerModel(QObject* parent) :
|
||||
|
|
@ -201,6 +203,8 @@ void LayerModel::Impl::ReadLayerSettings()
|
|||
// Assign read layers
|
||||
layers_.swap(newLayers);
|
||||
}
|
||||
|
||||
fileRead_ = true;
|
||||
}
|
||||
|
||||
void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers)
|
||||
|
|
@ -314,6 +318,10 @@ void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers)
|
|||
|
||||
void LayerModel::Impl::WriteLayerSettings()
|
||||
{
|
||||
if (!fileRead_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger_->info("Saving layer settings");
|
||||
|
||||
auto layerJson = boost::json::value_from(layers_);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ public:
|
|||
scwx::common::Coordinate previousPosition_;
|
||||
|
||||
QIcon starIcon_ {":/res/icons/font-awesome-6/star-solid.svg"};
|
||||
|
||||
bool presetsRead_ {false};
|
||||
};
|
||||
|
||||
RadarSiteModel::RadarSiteModel(QObject* parent) :
|
||||
|
|
@ -146,10 +148,15 @@ void RadarSiteModelImpl::ReadPresets()
|
|||
}
|
||||
}
|
||||
}
|
||||
presetsRead_ = true;
|
||||
}
|
||||
|
||||
void RadarSiteModelImpl::WritePresets()
|
||||
{
|
||||
if (!presetsRead_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger_->info("Saving presets");
|
||||
|
||||
auto presetsJson = boost::json::value_from(presets_);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@
|
|||
#include <boost/gil.hpp>
|
||||
#include <boost/unordered/unordered_flat_map.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
|
|
@ -139,7 +135,12 @@ public:
|
|||
|
||||
SetDefaultLineData(inactive_, kInactivePalettes_.at(phenomenon));
|
||||
}
|
||||
~Impl() {}
|
||||
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
static void SetDefaultLineData(LineSettings& lineSettings,
|
||||
const LineData& lineData);
|
||||
|
|
@ -236,6 +237,4 @@ bool operator==(const AlertPaletteSettings& lhs,
|
|||
lhs.p->tornadoPossible_ == rhs.p->tornadoPossible_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -8,18 +8,14 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class AlertPaletteSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit AlertPaletteSettings(awips::Phenomenon phenomenon);
|
||||
~AlertPaletteSettings();
|
||||
~AlertPaletteSettings() override;
|
||||
|
||||
AlertPaletteSettings(const AlertPaletteSettings&) = delete;
|
||||
AlertPaletteSettings& operator=(const AlertPaletteSettings&) = delete;
|
||||
|
|
@ -27,11 +23,11 @@ public:
|
|||
AlertPaletteSettings(AlertPaletteSettings&&) noexcept;
|
||||
AlertPaletteSettings& operator=(AlertPaletteSettings&&) noexcept;
|
||||
|
||||
LineSettings&
|
||||
[[nodiscard]] LineSettings&
|
||||
threat_category(awips::ibw::ThreatCategory threatCategory) const;
|
||||
LineSettings& inactive() const;
|
||||
LineSettings& observed() const;
|
||||
LineSettings& tornado_possible() const;
|
||||
[[nodiscard]] LineSettings& inactive() const;
|
||||
[[nodiscard]] LineSettings& observed() const;
|
||||
[[nodiscard]] LineSettings& tornado_possible() const;
|
||||
|
||||
friend bool operator==(const AlertPaletteSettings& lhs,
|
||||
const AlertPaletteSettings& rhs);
|
||||
|
|
@ -41,6 +37,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::audio_settings";
|
||||
|
|
@ -33,6 +29,8 @@ public:
|
|||
|
||||
boost::to_lower(defaultAlertLocationMethodValue);
|
||||
|
||||
// SetDefault, SetMinimum and SetMaximum are descriptive
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
alertSoundFile_.SetDefault(defaultAlertSoundFileValue);
|
||||
alertLocationMethod_.SetDefault(defaultAlertLocationMethodValue);
|
||||
alertLatitude_.SetDefault(0.0);
|
||||
|
|
@ -48,7 +46,7 @@ public:
|
|||
alertLongitude_.SetMaximum(180.0);
|
||||
alertRadius_.SetMinimum(0.0);
|
||||
alertRadius_.SetMaximum(9999999999);
|
||||
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
alertLocationMethod_.SetValidator(
|
||||
SCWX_SETTINGS_ENUM_VALIDATOR(types::LocationMethod,
|
||||
|
|
@ -94,7 +92,11 @@ public:
|
|||
SettingsVariable<bool> {"alert_disabled"});
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
SettingsVariable<std::string> alertSoundFile_ {"alert_sound_file"};
|
||||
SettingsVariable<std::string> alertLocationMethod_ {"alert_location_method"};
|
||||
|
|
@ -208,6 +210,4 @@ bool operator==(const AudioSettings& lhs, const AudioSettings& rhs)
|
|||
lhs.p->alertEnabled_ == rhs.p->alertEnabled_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -7,18 +7,14 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class AudioSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit AudioSettings();
|
||||
~AudioSettings();
|
||||
~AudioSettings() override;
|
||||
|
||||
AudioSettings(const AudioSettings&) = delete;
|
||||
AudioSettings& operator=(const AudioSettings&) = delete;
|
||||
|
|
@ -26,16 +22,17 @@ public:
|
|||
AudioSettings(AudioSettings&&) noexcept;
|
||||
AudioSettings& operator=(AudioSettings&&) noexcept;
|
||||
|
||||
SettingsVariable<std::string>& alert_sound_file() const;
|
||||
SettingsVariable<std::string>& alert_location_method() const;
|
||||
SettingsVariable<double>& alert_latitude() const;
|
||||
SettingsVariable<double>& alert_longitude() const;
|
||||
SettingsVariable<double>& alert_radius() const;
|
||||
SettingsVariable<std::string>& alert_radar_site() const;
|
||||
SettingsVariable<std::string>& alert_county() const;
|
||||
SettingsVariable<std::string>& alert_wfo() const;
|
||||
SettingsVariable<bool>& alert_enabled(awips::Phenomenon phenomenon) const;
|
||||
SettingsVariable<bool>& ignore_missing_codecs() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& alert_sound_file() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& alert_location_method() const;
|
||||
[[nodiscard]] SettingsVariable<double>& alert_latitude() const;
|
||||
[[nodiscard]] SettingsVariable<double>& alert_longitude() const;
|
||||
[[nodiscard]] SettingsVariable<double>& alert_radius() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& alert_radar_site() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& alert_county() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& alert_wfo() const;
|
||||
[[nodiscard]] SettingsVariable<bool>&
|
||||
alert_enabled(awips::Phenomenon phenomenon) const;
|
||||
[[nodiscard]] SettingsVariable<bool>& ignore_missing_codecs() const;
|
||||
|
||||
static AudioSettings& Instance();
|
||||
|
||||
|
|
@ -46,6 +43,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -8,16 +8,10 @@
|
|||
#include <scwx/qt/types/time_types.hpp>
|
||||
#include <scwx/util/time.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <QUrl>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::general_settings";
|
||||
|
|
@ -50,6 +44,8 @@ public:
|
|||
boost::to_lower(defaultPositioningPlugin);
|
||||
boost::to_lower(defaultThemeValue);
|
||||
|
||||
// SetDefault, SetMinimum, and SetMaximum are descriptive
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
antiAliasingEnabled_.SetDefault(true);
|
||||
clockFormat_.SetDefault(defaultClockFormatValue);
|
||||
customStyleDrawLayer_.SetDefault(".*\\.annotations\\.points");
|
||||
|
|
@ -100,6 +96,7 @@ public:
|
|||
nmeaBaudRate_.SetMaximum(999999999);
|
||||
radarSiteThreshold_.SetMinimum(-10000);
|
||||
radarSiteThreshold_.SetMaximum(10000);
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
customStyleDrawLayer_.SetTransform([](const std::string& value)
|
||||
{ return boost::trim_copy(value); });
|
||||
|
|
@ -141,7 +138,11 @@ public:
|
|||
{ return QUrl {QString::fromStdString(value)}.isValid(); });
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
SettingsVariable<bool> antiAliasingEnabled_ {"anti_aliasing_enabled"};
|
||||
SettingsVariable<std::string> clockFormat_ {"clock_format"};
|
||||
|
|
@ -444,6 +445,4 @@ bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs)
|
|||
rhs.p->highPrivilegeWarningEnabled_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -6,18 +6,14 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class GeneralSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit GeneralSettings();
|
||||
~GeneralSettings();
|
||||
~GeneralSettings() override;
|
||||
|
||||
GeneralSettings(const GeneralSettings&) = delete;
|
||||
GeneralSettings& operator=(const GeneralSettings&) = delete;
|
||||
|
|
@ -25,38 +21,40 @@ public:
|
|||
GeneralSettings(GeneralSettings&&) noexcept;
|
||||
GeneralSettings& operator=(GeneralSettings&&) noexcept;
|
||||
|
||||
SettingsVariable<bool>& anti_aliasing_enabled() const;
|
||||
SettingsVariable<std::string>& clock_format() const;
|
||||
SettingsVariable<std::string>& custom_style_draw_layer() const;
|
||||
SettingsVariable<std::string>& custom_style_url() const;
|
||||
SettingsVariable<bool>& debug_enabled() const;
|
||||
SettingsVariable<std::string>& default_alert_action() const;
|
||||
SettingsVariable<std::string>& default_radar_site() const;
|
||||
SettingsVariable<std::string>& default_time_zone() const;
|
||||
SettingsContainer<std::vector<std::int64_t>>& font_sizes() const;
|
||||
SettingsVariable<std::int64_t>& grid_height() const;
|
||||
SettingsVariable<std::int64_t>& grid_width() const;
|
||||
SettingsVariable<std::int64_t>& loop_delay() const;
|
||||
SettingsVariable<double>& loop_speed() const;
|
||||
SettingsVariable<std::int64_t>& loop_time() const;
|
||||
SettingsVariable<std::string>& map_provider() const;
|
||||
SettingsVariable<std::string>& mapbox_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>& process_module_warnings_enabled() const;
|
||||
SettingsVariable<bool>& show_map_attribution() const;
|
||||
SettingsVariable<bool>& show_map_center() const;
|
||||
SettingsVariable<bool>& show_map_logo() const;
|
||||
SettingsVariable<std::string>& theme() const;
|
||||
SettingsVariable<std::string>& theme_file() const;
|
||||
SettingsVariable<bool>& track_location() const;
|
||||
SettingsVariable<bool>& update_notifications_enabled() const;
|
||||
SettingsVariable<std::string>& warnings_provider() const;
|
||||
SettingsVariable<bool>& cursor_icon_always_on() const;
|
||||
SettingsVariable<double>& radar_site_threshold() const;
|
||||
SettingsVariable<bool>& high_privilege_warning_enabled() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& anti_aliasing_enabled() 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;
|
||||
[[nodiscard]] SettingsVariable<bool>& debug_enabled() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& default_alert_action() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& default_radar_site() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& default_time_zone() const;
|
||||
[[nodiscard]] SettingsContainer<std::vector<std::int64_t>>&
|
||||
font_sizes() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& grid_height() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& grid_width() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& loop_delay() const;
|
||||
[[nodiscard]] SettingsVariable<double>& loop_speed() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& loop_time() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& map_provider() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& mapbox_api_key() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& maptiler_api_key() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& nmea_baud_rate() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& nmea_source() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& positioning_plugin() const;
|
||||
[[nodiscard]] SettingsVariable<bool>&
|
||||
process_module_warnings_enabled() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& show_map_attribution() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& show_map_center() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& show_map_logo() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& theme() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& theme_file() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& track_location() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& update_notifications_enabled() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& warnings_provider() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& cursor_icon_always_on() const;
|
||||
[[nodiscard]] SettingsVariable<double>& radar_site_threshold() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& high_privilege_warning_enabled() const;
|
||||
|
||||
static GeneralSettings& Instance();
|
||||
|
||||
|
|
@ -70,6 +68,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <QKeySequence>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::hotkey_settings";
|
||||
|
|
@ -94,7 +90,11 @@ public:
|
|||
SettingsVariable<std::string> {"?"});
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
std::unordered_map<types::Hotkey, SettingsVariable<std::string>> hotkey_ {};
|
||||
std::vector<SettingsVariableBase*> variables_ {};
|
||||
|
|
@ -142,6 +142,4 @@ static bool IsHotkeyValid(const std::string& value)
|
|||
.toStdString() == value;
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -7,18 +7,14 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class HotkeySettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit HotkeySettings();
|
||||
~HotkeySettings();
|
||||
~HotkeySettings() override;
|
||||
|
||||
HotkeySettings(const HotkeySettings&) = delete;
|
||||
HotkeySettings& operator=(const HotkeySettings&) = delete;
|
||||
|
|
@ -26,7 +22,8 @@ public:
|
|||
HotkeySettings(HotkeySettings&&) noexcept;
|
||||
HotkeySettings& operator=(HotkeySettings&&) noexcept;
|
||||
|
||||
SettingsVariable<std::string>& hotkey(scwx::qt::types::Hotkey hotkey) const;
|
||||
[[nodiscard]] SettingsVariable<std::string>&
|
||||
hotkey(scwx::qt::types::Hotkey hotkey) const;
|
||||
|
||||
static HotkeySettings& Instance();
|
||||
|
||||
|
|
@ -37,6 +34,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#include <scwx/qt/settings/line_settings.hpp>
|
||||
#include <scwx/qt/util/color.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::line_settings";
|
||||
|
|
@ -27,6 +23,8 @@ class LineSettings::Impl
|
|||
public:
|
||||
explicit Impl()
|
||||
{
|
||||
// SetDefault, SetMinimum, and SetMaximum are descriptive
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
lineColor_.SetDefault(kWhiteColorString_);
|
||||
highlightColor_.SetDefault(kTransparentColorString_);
|
||||
borderColor_.SetDefault(kBlackColorString_);
|
||||
|
|
@ -42,12 +40,18 @@ public:
|
|||
lineWidth_.SetMaximum(9);
|
||||
highlightWidth_.SetMaximum(9);
|
||||
borderWidth_.SetMaximum(9);
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
lineColor_.SetValidator(&util::color::ValidateArgbString);
|
||||
highlightColor_.SetValidator(&util::color::ValidateArgbString);
|
||||
borderColor_.SetValidator(&util::color::ValidateArgbString);
|
||||
}
|
||||
~Impl() {}
|
||||
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
SettingsVariable<std::string> lineColor_ {"line_color"};
|
||||
SettingsVariable<std::string> highlightColor_ {"highlight_color"};
|
||||
|
|
@ -150,6 +154,4 @@ bool operator==(const LineSettings& lhs, const LineSettings& rhs)
|
|||
lhs.p->lineWidth_ == rhs.p->lineWidth_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -8,18 +8,14 @@
|
|||
|
||||
#include <boost/gil/typedefs.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class LineSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit LineSettings(const std::string& name);
|
||||
~LineSettings();
|
||||
~LineSettings() override;
|
||||
|
||||
LineSettings(const LineSettings&) = delete;
|
||||
LineSettings& operator=(const LineSettings&) = delete;
|
||||
|
|
@ -27,17 +23,17 @@ public:
|
|||
LineSettings(LineSettings&&) noexcept;
|
||||
LineSettings& operator=(LineSettings&&) noexcept;
|
||||
|
||||
SettingsVariable<std::string>& border_color() const;
|
||||
SettingsVariable<std::string>& highlight_color() const;
|
||||
SettingsVariable<std::string>& line_color() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& border_color() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& highlight_color() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& line_color() const;
|
||||
|
||||
SettingsVariable<std::int64_t>& border_width() const;
|
||||
SettingsVariable<std::int64_t>& highlight_width() const;
|
||||
SettingsVariable<std::int64_t>& line_width() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& border_width() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& highlight_width() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& line_width() const;
|
||||
|
||||
boost::gil::rgba32f_pixel_t GetBorderColorRgba32f() const;
|
||||
boost::gil::rgba32f_pixel_t GetHighlightColorRgba32f() const;
|
||||
boost::gil::rgba32f_pixel_t GetLineColorRgba32f() const;
|
||||
[[nodiscard]] boost::gil::rgba32f_pixel_t GetBorderColorRgba32f() const;
|
||||
[[nodiscard]] boost::gil::rgba32f_pixel_t GetHighlightColorRgba32f() const;
|
||||
[[nodiscard]] boost::gil::rgba32f_pixel_t GetLineColorRgba32f() const;
|
||||
|
||||
void StageValues(boost::gil::rgba8_pixel_t borderColor,
|
||||
boost::gil::rgba8_pixel_t highlightColor,
|
||||
|
|
@ -53,6 +49,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
|
||||
#include <boost/json.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::map_settings";
|
||||
|
|
@ -104,7 +100,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
void SetDefaults(std::size_t i)
|
||||
{
|
||||
|
|
@ -276,6 +276,4 @@ bool operator==(const MapSettings& lhs, const MapSettings& rhs)
|
|||
return (lhs.p->map_ == rhs.p->map_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -6,18 +6,14 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class MapSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit MapSettings();
|
||||
~MapSettings();
|
||||
~MapSettings() override;
|
||||
|
||||
MapSettings(const MapSettings&) = delete;
|
||||
MapSettings& operator=(const MapSettings&) = delete;
|
||||
|
|
@ -25,7 +21,7 @@ public:
|
|||
MapSettings(MapSettings&&) noexcept;
|
||||
MapSettings& operator=(MapSettings&&) noexcept;
|
||||
|
||||
std::size_t count() const;
|
||||
[[nodiscard]] std::size_t count() const;
|
||||
SettingsVariable<std::string>& map_style(std::size_t i);
|
||||
SettingsVariable<std::string>& radar_site(std::size_t i);
|
||||
SettingsVariable<std::string>& radar_product_group(std::size_t i);
|
||||
|
|
@ -60,6 +56,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@
|
|||
#include <boost/gil.hpp>
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::palette_settings";
|
||||
|
|
@ -83,7 +79,11 @@ public:
|
|||
InitializeAlerts();
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
void InitializeColorTables();
|
||||
void InitializeLegacyAlerts();
|
||||
|
|
@ -252,6 +252,4 @@ bool operator==(const PaletteSettings& lhs, const PaletteSettings& rhs)
|
|||
lhs.p->inactiveAlertColor_ == rhs.p->inactiveAlertColor_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -9,18 +9,14 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class PaletteSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit PaletteSettings();
|
||||
~PaletteSettings();
|
||||
~PaletteSettings() override;
|
||||
|
||||
PaletteSettings(const PaletteSettings&) = delete;
|
||||
PaletteSettings& operator=(const PaletteSettings&) = delete;
|
||||
|
|
@ -28,9 +24,10 @@ public:
|
|||
PaletteSettings(PaletteSettings&&) noexcept;
|
||||
PaletteSettings& operator=(PaletteSettings&&) noexcept;
|
||||
|
||||
SettingsVariable<std::string>& palette(const std::string& name) const;
|
||||
SettingsVariable<std::string>& alert_color(awips::Phenomenon phenomenon,
|
||||
bool active) const;
|
||||
[[nodiscard]] SettingsVariable<std::string>&
|
||||
palette(const std::string& name) const;
|
||||
[[nodiscard]] SettingsVariable<std::string>&
|
||||
alert_color(awips::Phenomenon phenomenon, bool active) const;
|
||||
AlertPaletteSettings& alert_palette(awips::Phenomenon);
|
||||
|
||||
static const std::vector<awips::Phenomenon>& alert_phenomena();
|
||||
|
|
@ -45,6 +42,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
#include <scwx/qt/settings/product_settings.hpp>
|
||||
#include <scwx/qt/settings/settings_container.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
#include <string>
|
||||
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::product_settings";
|
||||
|
|
@ -15,12 +13,19 @@ class ProductSettings::Impl
|
|||
public:
|
||||
explicit Impl()
|
||||
{
|
||||
// SetDefault, SetMinimum and SetMaximum are descriptive
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
showSmoothedRangeFolding_.SetDefault(false);
|
||||
stiForecastEnabled_.SetDefault(true);
|
||||
stiPastEnabled_.SetDefault(true);
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
SettingsVariable<bool> showSmoothedRangeFolding_ {
|
||||
"show_smoothed_range_folding"};
|
||||
|
|
@ -82,6 +87,4 @@ bool operator==(const ProductSettings& lhs, const ProductSettings& rhs)
|
|||
lhs.p->stiPastEnabled_ == rhs.p->stiPastEnabled_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -4,20 +4,15 @@
|
|||
#include <scwx/qt/settings/settings_variable.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class ProductSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit ProductSettings();
|
||||
~ProductSettings();
|
||||
~ProductSettings() override;
|
||||
|
||||
ProductSettings(const ProductSettings&) = delete;
|
||||
ProductSettings& operator=(const ProductSettings&) = delete;
|
||||
|
|
@ -41,6 +36,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::settings_category";
|
||||
|
|
@ -19,7 +15,11 @@ class SettingsCategory::Impl
|
|||
public:
|
||||
explicit Impl(const std::string& name) : name_ {name} {}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
void ConnectSubcategory(SettingsCategory& category);
|
||||
void ConnectVariable(SettingsVariableBase* variable);
|
||||
|
|
@ -479,6 +479,4 @@ void SettingsCategory::Impl::ConnectVariable(SettingsVariableBase* variable)
|
|||
}));
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
#include <boost/json/object.hpp>
|
||||
#include <boost/signals2/signal.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class SettingsCategory
|
||||
|
|
@ -27,7 +23,7 @@ public:
|
|||
SettingsCategory(SettingsCategory&&) noexcept;
|
||||
SettingsCategory& operator=(SettingsCategory&&) noexcept;
|
||||
|
||||
std::string name() const;
|
||||
[[nodiscard]] std::string name() const;
|
||||
|
||||
/**
|
||||
* Gets the signal invoked when a variable within the category is changed.
|
||||
|
|
@ -50,7 +46,7 @@ public:
|
|||
* @return true if all settings variables are currently set to default
|
||||
* values, otherwise false.
|
||||
*/
|
||||
bool IsDefault() const;
|
||||
[[nodiscard]] bool IsDefault() const;
|
||||
|
||||
/**
|
||||
* Gets whether or not all settings variables currently have staged values
|
||||
|
|
@ -59,7 +55,7 @@ public:
|
|||
* @return true if all settings variables currently have staged values set
|
||||
* to default, otherwise false.
|
||||
*/
|
||||
bool IsDefaultStaged() const;
|
||||
[[nodiscard]] bool IsDefaultStaged() const;
|
||||
|
||||
/**
|
||||
* Set all variables to their defaults.
|
||||
|
|
@ -118,6 +114,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#include <scwx/qt/settings/settings_container.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::settings_container";
|
||||
|
|
@ -15,9 +11,13 @@ template<class Container>
|
|||
class SettingsContainer<Container>::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl() {}
|
||||
explicit Impl() = default;
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
T elementDefault_ {};
|
||||
std::optional<T> elementMinimum_ {};
|
||||
|
|
@ -172,6 +172,4 @@ bool SettingsContainer<Container>::Equals(const SettingsVariableBase& o) const
|
|||
|
||||
template class SettingsContainer<std::vector<std::int64_t>>;
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <scwx/qt/settings/settings_variable.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
template<class Container>
|
||||
|
|
@ -92,13 +88,12 @@ public:
|
|||
void SetElementValidator(std::function<bool(const T&)> validator);
|
||||
|
||||
protected:
|
||||
virtual bool Equals(const SettingsVariableBase& o) const override;
|
||||
[[nodiscard]] virtual bool
|
||||
Equals(const SettingsVariableBase& o) const override;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -12,12 +12,9 @@
|
|||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QWidget>
|
||||
#include <vector>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::settings_interface";
|
||||
|
|
@ -31,7 +28,11 @@ public:
|
|||
context_->moveToThread(QCoreApplication::instance()->thread());
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
template<class U>
|
||||
void SetWidgetText(U* widget, const T& currentValue);
|
||||
|
|
@ -633,6 +634,4 @@ template class SettingsInterface<std::string>;
|
|||
// Containers are not to be used directly
|
||||
template class SettingsInterface<std::vector<std::int64_t>>;
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -5,15 +5,10 @@
|
|||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
template<class T>
|
||||
|
|
@ -140,6 +135,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
|
|
@ -15,8 +11,12 @@ static const std::string logPrefix_ =
|
|||
class SettingsInterfaceBase::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl() {}
|
||||
~Impl() {}
|
||||
explicit Impl() = default;
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
};
|
||||
|
||||
SettingsInterfaceBase::SettingsInterfaceBase() : p(std::make_unique<Impl>()) {}
|
||||
|
|
@ -29,6 +29,4 @@ SettingsInterfaceBase::SettingsInterfaceBase(SettingsInterfaceBase&&) noexcept =
|
|||
SettingsInterfaceBase&
|
||||
SettingsInterfaceBase::operator=(SettingsInterfaceBase&&) noexcept = default;
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -5,11 +5,7 @@
|
|||
class QAbstractButton;
|
||||
class QWidget;
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class SettingsInterfaceBase
|
||||
|
|
@ -70,6 +66,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@
|
|||
#include <fmt/ostream.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::settings_variable";
|
||||
|
|
@ -21,8 +17,12 @@ template<class T>
|
|||
class SettingsVariable<T>::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl() {}
|
||||
~Impl() {}
|
||||
explicit Impl() = default;
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
T value_ {};
|
||||
T default_ {};
|
||||
|
|
@ -439,6 +439,4 @@ template class SettingsVariable<std::string>;
|
|||
// Containers are not to be used directly
|
||||
template class SettingsVariable<std::vector<std::int64_t>>;
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -10,11 +10,7 @@
|
|||
class QAbstractButton;
|
||||
class QWidget;
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
template<class T>
|
||||
|
|
@ -250,13 +246,12 @@ public:
|
|||
void UnregisterValueStagedCallback(boost::uuids::uuid uuid);
|
||||
|
||||
protected:
|
||||
virtual bool Equals(const SettingsVariableBase& o) const override;
|
||||
[[nodiscard]] virtual bool
|
||||
Equals(const SettingsVariableBase& o) const override;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
#include <scwx/qt/settings/settings_variable_base.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
|
|
@ -15,7 +11,11 @@ class SettingsVariableBase::Impl
|
|||
public:
|
||||
explicit Impl(const std::string& name) : name_ {name} {}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
const std::string name_;
|
||||
|
||||
|
|
@ -62,6 +62,4 @@ bool operator==(const SettingsVariableBase& lhs,
|
|||
return typeid(lhs) == typeid(rhs) && lhs.Equals(rhs);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@
|
|||
#include <boost/json/object.hpp>
|
||||
#include <boost/signals2/signal.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +25,7 @@ public:
|
|||
SettingsVariableBase(SettingsVariableBase&&) noexcept;
|
||||
SettingsVariableBase& operator=(SettingsVariableBase&&) noexcept;
|
||||
|
||||
std::string name() const;
|
||||
[[nodiscard]] std::string name() const;
|
||||
|
||||
/**
|
||||
* Gets the signal invoked when the settings variable is changed.
|
||||
|
|
@ -52,7 +48,7 @@ public:
|
|||
* @return true if the settings variable is currently set to its default
|
||||
* value, otherwise false.
|
||||
*/
|
||||
virtual bool IsDefault() const = 0;
|
||||
[[nodiscard]] virtual bool IsDefault() const = 0;
|
||||
|
||||
/**
|
||||
* Gets whether or not the settings variable currently has its staged value
|
||||
|
|
@ -61,7 +57,7 @@ public:
|
|||
* @return true if the settings variable currently has its staged value set
|
||||
* to default, otherwise false.
|
||||
*/
|
||||
virtual bool IsDefaultStaged() const = 0;
|
||||
[[nodiscard]] virtual bool IsDefaultStaged() const = 0;
|
||||
|
||||
/**
|
||||
* Sets the current value of the settings variable to default.
|
||||
|
|
@ -107,7 +103,7 @@ public:
|
|||
protected:
|
||||
friend bool operator==(const SettingsVariableBase& lhs,
|
||||
const SettingsVariableBase& rhs);
|
||||
virtual bool Equals(const SettingsVariableBase& o) const;
|
||||
[[nodiscard]] virtual bool Equals(const SettingsVariableBase& o) const;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
|
@ -117,6 +113,4 @@ private:
|
|||
bool operator==(const SettingsVariableBase& lhs,
|
||||
const SettingsVariableBase& rhs);
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -3,11 +3,7 @@
|
|||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::text_settings";
|
||||
|
|
@ -50,12 +46,15 @@ public:
|
|||
|
||||
boost::to_lower(defaultTooltipMethodValue);
|
||||
|
||||
// SetDefault, SetMinimum and SetMaximum are descriptive
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
hoverTextWrap_.SetDefault(80);
|
||||
hoverTextWrap_.SetMinimum(0);
|
||||
hoverTextWrap_.SetMaximum(999);
|
||||
placefileTextDropShadowEnabled_.SetDefault(true);
|
||||
radarSiteHoverTextEnabled_.SetDefault(true);
|
||||
tooltipMethod_.SetDefault(defaultTooltipMethodValue);
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
tooltipMethod_.SetValidator(
|
||||
[](const std::string& value)
|
||||
|
|
@ -81,7 +80,11 @@ public:
|
|||
InitializeFontVariables();
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
void InitializeFontVariables();
|
||||
|
||||
|
|
@ -141,8 +144,11 @@ void TextSettings::Impl::InitializeFontVariables()
|
|||
{ return !value.empty(); });
|
||||
|
||||
// Font point size must be between 6 and 72
|
||||
// SetDefault, SetMinimum and SetMaximum are descriptive
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
font.fontPointSize_.SetMinimum(6.0);
|
||||
font.fontPointSize_.SetMaximum(72.0);
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
// Variable registration
|
||||
auto& settings = fontSettings_.emplace_back(
|
||||
|
|
@ -210,6 +216,4 @@ bool operator==(const TextSettings& lhs, const TextSettings& rhs)
|
|||
lhs.p->tooltipMethod_ == rhs.p->tooltipMethod_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -7,18 +7,14 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class TextSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit TextSettings();
|
||||
~TextSettings();
|
||||
~TextSettings() override;
|
||||
|
||||
TextSettings(const TextSettings&) = delete;
|
||||
TextSettings& operator=(const TextSettings&) = delete;
|
||||
|
|
@ -26,17 +22,18 @@ public:
|
|||
TextSettings(TextSettings&&) noexcept;
|
||||
TextSettings& operator=(TextSettings&&) noexcept;
|
||||
|
||||
SettingsVariable<std::string>&
|
||||
[[nodiscard]] SettingsVariable<std::string>&
|
||||
font_family(types::FontCategory fontCategory) const;
|
||||
SettingsVariable<std::string>&
|
||||
[[nodiscard]] SettingsVariable<std::string>&
|
||||
font_style(types::FontCategory fontCategory) const;
|
||||
SettingsVariable<double>&
|
||||
[[nodiscard]] SettingsVariable<double>&
|
||||
font_point_size(types::FontCategory fontCategory) const;
|
||||
|
||||
SettingsVariable<std::int64_t>& hover_text_wrap() const;
|
||||
SettingsVariable<bool>& placefile_text_drop_shadow_enabled() const;
|
||||
SettingsVariable<bool>& radar_site_hover_text_enabled() const;
|
||||
SettingsVariable<std::string>& tooltip_method() const;
|
||||
[[nodiscard]] SettingsVariable<std::int64_t>& hover_text_wrap() const;
|
||||
[[nodiscard]] SettingsVariable<bool>&
|
||||
placefile_text_drop_shadow_enabled() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& radar_site_hover_text_enabled() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& tooltip_method() const;
|
||||
|
||||
static TextSettings& Instance();
|
||||
|
||||
|
|
@ -48,6 +45,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
#include <scwx/qt/settings/ui_settings.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::ui_settings";
|
||||
|
|
@ -14,6 +10,8 @@ class UiSettingsImpl
|
|||
public:
|
||||
explicit UiSettingsImpl()
|
||||
{
|
||||
// SetDefault, SetMinimum and SetMaximum are descriptive
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
level2ProductsExpanded_.SetDefault(false);
|
||||
level2SettingsExpanded_.SetDefault(true);
|
||||
level3ProductsExpanded_.SetDefault(true);
|
||||
|
|
@ -21,9 +19,14 @@ public:
|
|||
timelineExpanded_.SetDefault(true);
|
||||
mainUIState_.SetDefault("");
|
||||
mainUIGeometry_.SetDefault("");
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
}
|
||||
|
||||
~UiSettingsImpl() {}
|
||||
~UiSettingsImpl() = default;
|
||||
UiSettingsImpl(const UiSettingsImpl&) = delete;
|
||||
UiSettingsImpl& operator=(const UiSettingsImpl&) = delete;
|
||||
UiSettingsImpl(const UiSettingsImpl&&) = delete;
|
||||
UiSettingsImpl& operator=(const UiSettingsImpl&&) = delete;
|
||||
|
||||
SettingsVariable<bool> level2ProductsExpanded_ {"level2_products_expanded"};
|
||||
SettingsVariable<bool> level2SettingsExpanded_ {"level2_settings_expanded"};
|
||||
|
|
@ -119,6 +122,4 @@ bool operator==(const UiSettings& lhs, const UiSettings& rhs)
|
|||
lhs.p->mainUIGeometry_ == rhs.p->mainUIGeometry_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class UiSettingsImpl;
|
||||
|
|
@ -19,7 +15,7 @@ class UiSettings : public SettingsCategory
|
|||
{
|
||||
public:
|
||||
explicit UiSettings();
|
||||
~UiSettings();
|
||||
~UiSettings() override;
|
||||
|
||||
UiSettings(const UiSettings&) = delete;
|
||||
UiSettings& operator=(const UiSettings&) = delete;
|
||||
|
|
@ -27,13 +23,13 @@ public:
|
|||
UiSettings(UiSettings&&) noexcept;
|
||||
UiSettings& operator=(UiSettings&&) noexcept;
|
||||
|
||||
SettingsVariable<bool>& level2_products_expanded() const;
|
||||
SettingsVariable<bool>& level2_settings_expanded() const;
|
||||
SettingsVariable<bool>& level3_products_expanded() const;
|
||||
SettingsVariable<bool>& map_settings_expanded() const;
|
||||
SettingsVariable<bool>& timeline_expanded() const;
|
||||
SettingsVariable<std::string>& main_ui_state() const;
|
||||
SettingsVariable<std::string>& main_ui_geometry() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& level2_products_expanded() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& level2_settings_expanded() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& level3_products_expanded() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& map_settings_expanded() const;
|
||||
[[nodiscard]] SettingsVariable<bool>& timeline_expanded() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& main_ui_state() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& main_ui_geometry() const;
|
||||
|
||||
bool Shutdown();
|
||||
|
||||
|
|
@ -45,6 +41,4 @@ private:
|
|||
std::unique_ptr<UiSettingsImpl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::settings::unit_settings";
|
||||
|
|
@ -35,11 +31,14 @@ public:
|
|||
boost::to_lower(defaultSpeedUnitsValue);
|
||||
boost::to_lower(defaultDistanceUnitsValue);
|
||||
|
||||
// SetDefault, SetMinimum and SetMaximum are descriptive
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||
accumulationUnits_.SetDefault(defaultAccumulationUnitsValue);
|
||||
echoTopsUnits_.SetDefault(defaultEchoTopsUnitsValue);
|
||||
otherUnits_.SetDefault(defaultOtherUnitsValue);
|
||||
speedUnits_.SetDefault(defaultSpeedUnitsValue);
|
||||
distanceUnits_.SetDefault(defaultDistanceUnitsValue);
|
||||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||
|
||||
accumulationUnits_.SetValidator(
|
||||
SCWX_SETTINGS_ENUM_VALIDATOR(types::AccumulationUnits,
|
||||
|
|
@ -63,7 +62,11 @@ public:
|
|||
types::GetDistanceUnitsName));
|
||||
}
|
||||
|
||||
~Impl() {}
|
||||
~Impl() = default;
|
||||
Impl(const Impl&) = delete;
|
||||
Impl& operator=(const Impl&) = delete;
|
||||
Impl(const Impl&&) = delete;
|
||||
Impl& operator=(const Impl&&) = delete;
|
||||
|
||||
SettingsVariable<std::string> accumulationUnits_ {"accumulation_units"};
|
||||
SettingsVariable<std::string> echoTopsUnits_ {"echo_tops_units"};
|
||||
|
|
@ -127,6 +130,4 @@ bool operator==(const UnitSettings& lhs, const UnitSettings& rhs)
|
|||
lhs.p->distanceUnits_ == rhs.p->distanceUnits_);
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
|
|
@ -6,18 +6,14 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
namespace scwx::qt::settings
|
||||
{
|
||||
|
||||
class UnitSettings : public SettingsCategory
|
||||
{
|
||||
public:
|
||||
explicit UnitSettings();
|
||||
~UnitSettings();
|
||||
~UnitSettings() override;
|
||||
|
||||
UnitSettings(const UnitSettings&) = delete;
|
||||
UnitSettings& operator=(const UnitSettings&) = delete;
|
||||
|
|
@ -25,11 +21,11 @@ public:
|
|||
UnitSettings(UnitSettings&&) noexcept;
|
||||
UnitSettings& operator=(UnitSettings&&) noexcept;
|
||||
|
||||
SettingsVariable<std::string>& accumulation_units() const;
|
||||
SettingsVariable<std::string>& echo_tops_units() const;
|
||||
SettingsVariable<std::string>& other_units() const;
|
||||
SettingsVariable<std::string>& speed_units() const;
|
||||
SettingsVariable<std::string>& distance_units() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& accumulation_units() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& echo_tops_units() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& other_units() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& speed_units() const;
|
||||
[[nodiscard]] SettingsVariable<std::string>& distance_units() const;
|
||||
|
||||
static UnitSettings& Instance();
|
||||
|
||||
|
|
@ -40,6 +36,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::settings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue