diff --git a/scwx-qt/source/scwx/qt/manager/marker_manager.cpp b/scwx-qt/source/scwx/qt/manager/marker_manager.cpp index fd7bee13..952dea44 100644 --- a/scwx-qt/source/scwx/qt/manager/marker_manager.cpp +++ b/scwx-qt/source/scwx/qt/manager/marker_manager.cpp @@ -60,6 +60,8 @@ public: void WriteMarkerSettings(); std::shared_ptr 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_); diff --git a/scwx-qt/source/scwx/qt/manager/placefile_manager.cpp b/scwx-qt/source/scwx/qt/manager/placefile_manager.cpp index df412e24..a6158773 100644 --- a/scwx-qt/source/scwx/qt/manager/placefile_manager.cpp +++ b/scwx-qt/source/scwx/qt/manager/placefile_manager.cpp @@ -70,6 +70,8 @@ public: boost::unordered_flat_map> 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_}; diff --git a/scwx-qt/source/scwx/qt/manager/settings_manager.cpp b/scwx-qt/source/scwx/qt/manager/settings_manager.cpp index 056799ae..5b2e9cbb 100644 --- a/scwx-qt/source/scwx/qt/manager/settings_manager.cpp +++ b/scwx-qt/source/scwx/qt/manager/settings_manager.cpp @@ -67,9 +67,10 @@ void SettingsManager::Initialize() } p->settingsPath_ = appDataPath + "/settings.json"; - p->initialized_ = true; ReadSettings(p->settingsPath_); + + p->initialized_ = true; p->ValidateSettings(); } diff --git a/scwx-qt/source/scwx/qt/model/layer_model.cpp b/scwx-qt/source/scwx/qt/model/layer_model.cpp index 014acb42..2f1b8a9d 100644 --- a/scwx-qt/source/scwx/qt/model/layer_model.cpp +++ b/scwx-qt/source/scwx/qt/model/layer_model.cpp @@ -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_); diff --git a/scwx-qt/source/scwx/qt/model/radar_site_model.cpp b/scwx-qt/source/scwx/qt/model/radar_site_model.cpp index 482c9828..e1a593d7 100644 --- a/scwx-qt/source/scwx/qt/model/radar_site_model.cpp +++ b/scwx-qt/source/scwx/qt/model/radar_site_model.cpp @@ -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_); diff --git a/scwx-qt/source/scwx/qt/settings/alert_palette_settings.cpp b/scwx-qt/source/scwx/qt/settings/alert_palette_settings.cpp index c684e1ed..1c7aca31 100644 --- a/scwx-qt/source/scwx/qt/settings/alert_palette_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/alert_palette_settings.cpp @@ -7,11 +7,7 @@ #include #include -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 diff --git a/scwx-qt/source/scwx/qt/settings/alert_palette_settings.hpp b/scwx-qt/source/scwx/qt/settings/alert_palette_settings.hpp index 152a6351..c4a12e58 100644 --- a/scwx-qt/source/scwx/qt/settings/alert_palette_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/alert_palette_settings.hpp @@ -8,18 +8,14 @@ #include #include -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 p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/audio_settings.cpp b/scwx-qt/source/scwx/qt/settings/audio_settings.cpp index a799793b..c4b07ff8 100644 --- a/scwx-qt/source/scwx/qt/settings/audio_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/audio_settings.cpp @@ -9,11 +9,7 @@ #include #include -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 {"alert_disabled"}); } - ~Impl() {} + ~Impl() = default; + Impl(const Impl&) = delete; + Impl& operator=(const Impl&) = delete; + Impl(const Impl&&) = delete; + Impl& operator=(const Impl&&) = delete; SettingsVariable alertSoundFile_ {"alert_sound_file"}; SettingsVariable 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 diff --git a/scwx-qt/source/scwx/qt/settings/audio_settings.hpp b/scwx-qt/source/scwx/qt/settings/audio_settings.hpp index 579d3599..50606001 100644 --- a/scwx-qt/source/scwx/qt/settings/audio_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/audio_settings.hpp @@ -7,18 +7,14 @@ #include #include -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& alert_sound_file() const; - SettingsVariable& alert_location_method() const; - SettingsVariable& alert_latitude() const; - SettingsVariable& alert_longitude() const; - SettingsVariable& alert_radius() const; - SettingsVariable& alert_radar_site() const; - SettingsVariable& alert_county() const; - SettingsVariable& alert_wfo() const; - SettingsVariable& alert_enabled(awips::Phenomenon phenomenon) const; - SettingsVariable& ignore_missing_codecs() const; + [[nodiscard]] SettingsVariable& alert_sound_file() const; + [[nodiscard]] SettingsVariable& alert_location_method() const; + [[nodiscard]] SettingsVariable& alert_latitude() const; + [[nodiscard]] SettingsVariable& alert_longitude() const; + [[nodiscard]] SettingsVariable& alert_radius() const; + [[nodiscard]] SettingsVariable& alert_radar_site() const; + [[nodiscard]] SettingsVariable& alert_county() const; + [[nodiscard]] SettingsVariable& alert_wfo() const; + [[nodiscard]] SettingsVariable& + alert_enabled(awips::Phenomenon phenomenon) const; + [[nodiscard]] SettingsVariable& ignore_missing_codecs() const; static AudioSettings& Instance(); @@ -46,6 +43,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/general_settings.cpp b/scwx-qt/source/scwx/qt/settings/general_settings.cpp index 6f254c6b..c6e93c76 100644 --- a/scwx-qt/source/scwx/qt/settings/general_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/general_settings.cpp @@ -8,16 +8,10 @@ #include #include -#include - #include #include -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 antiAliasingEnabled_ {"anti_aliasing_enabled"}; SettingsVariable 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 diff --git a/scwx-qt/source/scwx/qt/settings/general_settings.hpp b/scwx-qt/source/scwx/qt/settings/general_settings.hpp index 074b956e..ad49761b 100644 --- a/scwx-qt/source/scwx/qt/settings/general_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/general_settings.hpp @@ -6,18 +6,14 @@ #include #include -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& anti_aliasing_enabled() const; - SettingsVariable& clock_format() const; - SettingsVariable& custom_style_draw_layer() const; - SettingsVariable& custom_style_url() const; - SettingsVariable& debug_enabled() const; - SettingsVariable& default_alert_action() const; - SettingsVariable& default_radar_site() const; - SettingsVariable& default_time_zone() const; - SettingsContainer>& font_sizes() const; - SettingsVariable& grid_height() const; - SettingsVariable& grid_width() const; - SettingsVariable& loop_delay() const; - SettingsVariable& loop_speed() const; - SettingsVariable& loop_time() const; - SettingsVariable& map_provider() const; - SettingsVariable& mapbox_api_key() const; - SettingsVariable& maptiler_api_key() const; - SettingsVariable& nmea_baud_rate() const; - SettingsVariable& nmea_source() const; - SettingsVariable& positioning_plugin() const; - SettingsVariable& process_module_warnings_enabled() const; - SettingsVariable& show_map_attribution() const; - SettingsVariable& show_map_center() const; - SettingsVariable& show_map_logo() const; - SettingsVariable& theme() const; - SettingsVariable& theme_file() const; - SettingsVariable& track_location() const; - SettingsVariable& update_notifications_enabled() const; - SettingsVariable& warnings_provider() const; - SettingsVariable& cursor_icon_always_on() const; - SettingsVariable& radar_site_threshold() const; - SettingsVariable& high_privilege_warning_enabled() const; + [[nodiscard]] SettingsVariable& anti_aliasing_enabled() const; + [[nodiscard]] SettingsVariable& clock_format() const; + [[nodiscard]] SettingsVariable& custom_style_draw_layer() const; + [[nodiscard]] SettingsVariable& custom_style_url() const; + [[nodiscard]] SettingsVariable& debug_enabled() const; + [[nodiscard]] SettingsVariable& default_alert_action() const; + [[nodiscard]] SettingsVariable& default_radar_site() const; + [[nodiscard]] SettingsVariable& default_time_zone() const; + [[nodiscard]] SettingsContainer>& + font_sizes() const; + [[nodiscard]] SettingsVariable& grid_height() const; + [[nodiscard]] SettingsVariable& grid_width() const; + [[nodiscard]] SettingsVariable& loop_delay() const; + [[nodiscard]] SettingsVariable& loop_speed() const; + [[nodiscard]] SettingsVariable& loop_time() const; + [[nodiscard]] SettingsVariable& map_provider() const; + [[nodiscard]] SettingsVariable& mapbox_api_key() const; + [[nodiscard]] SettingsVariable& maptiler_api_key() const; + [[nodiscard]] SettingsVariable& nmea_baud_rate() const; + [[nodiscard]] SettingsVariable& nmea_source() const; + [[nodiscard]] SettingsVariable& positioning_plugin() const; + [[nodiscard]] SettingsVariable& + process_module_warnings_enabled() const; + [[nodiscard]] SettingsVariable& show_map_attribution() const; + [[nodiscard]] SettingsVariable& show_map_center() const; + [[nodiscard]] SettingsVariable& show_map_logo() const; + [[nodiscard]] SettingsVariable& theme() const; + [[nodiscard]] SettingsVariable& theme_file() const; + [[nodiscard]] SettingsVariable& track_location() const; + [[nodiscard]] SettingsVariable& update_notifications_enabled() const; + [[nodiscard]] SettingsVariable& warnings_provider() const; + [[nodiscard]] SettingsVariable& cursor_icon_always_on() const; + [[nodiscard]] SettingsVariable& radar_site_threshold() const; + [[nodiscard]] SettingsVariable& high_privilege_warning_enabled() const; static GeneralSettings& Instance(); @@ -70,6 +68,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/hotkey_settings.cpp b/scwx-qt/source/scwx/qt/settings/hotkey_settings.cpp index e9c6b007..ba5b4e3e 100644 --- a/scwx-qt/source/scwx/qt/settings/hotkey_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/hotkey_settings.cpp @@ -2,11 +2,7 @@ #include -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 {"?"}); } - ~Impl() {} + ~Impl() = default; + Impl(const Impl&) = delete; + Impl& operator=(const Impl&) = delete; + Impl(const Impl&&) = delete; + Impl& operator=(const Impl&&) = delete; std::unordered_map> hotkey_ {}; std::vector variables_ {}; @@ -142,6 +142,4 @@ static bool IsHotkeyValid(const std::string& value) .toStdString() == value; } -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/hotkey_settings.hpp b/scwx-qt/source/scwx/qt/settings/hotkey_settings.hpp index 9fa56cc4..13e56b7d 100644 --- a/scwx-qt/source/scwx/qt/settings/hotkey_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/hotkey_settings.hpp @@ -7,18 +7,14 @@ #include #include -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& hotkey(scwx::qt::types::Hotkey hotkey) const; + [[nodiscard]] SettingsVariable& + hotkey(scwx::qt::types::Hotkey hotkey) const; static HotkeySettings& Instance(); @@ -37,6 +34,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/line_settings.cpp b/scwx-qt/source/scwx/qt/settings/line_settings.cpp index 45337fa2..2b013105 100644 --- a/scwx-qt/source/scwx/qt/settings/line_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/line_settings.cpp @@ -1,11 +1,7 @@ #include #include -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 lineColor_ {"line_color"}; SettingsVariable 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 diff --git a/scwx-qt/source/scwx/qt/settings/line_settings.hpp b/scwx-qt/source/scwx/qt/settings/line_settings.hpp index 6f6988a2..3f13c601 100644 --- a/scwx-qt/source/scwx/qt/settings/line_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/line_settings.hpp @@ -8,18 +8,14 @@ #include -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& border_color() const; - SettingsVariable& highlight_color() const; - SettingsVariable& line_color() const; + [[nodiscard]] SettingsVariable& border_color() const; + [[nodiscard]] SettingsVariable& highlight_color() const; + [[nodiscard]] SettingsVariable& line_color() const; - SettingsVariable& border_width() const; - SettingsVariable& highlight_width() const; - SettingsVariable& line_width() const; + [[nodiscard]] SettingsVariable& border_width() const; + [[nodiscard]] SettingsVariable& highlight_width() const; + [[nodiscard]] SettingsVariable& 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 p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/map_settings.cpp b/scwx-qt/source/scwx/qt/settings/map_settings.cpp index e1c8276e..416c0a6d 100644 --- a/scwx-qt/source/scwx/qt/settings/map_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/map_settings.cpp @@ -9,11 +9,7 @@ #include -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 diff --git a/scwx-qt/source/scwx/qt/settings/map_settings.hpp b/scwx-qt/source/scwx/qt/settings/map_settings.hpp index 36ce6464..9ffb3540 100644 --- a/scwx-qt/source/scwx/qt/settings/map_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/map_settings.hpp @@ -6,18 +6,14 @@ #include #include -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& map_style(std::size_t i); SettingsVariable& radar_site(std::size_t i); SettingsVariable& radar_product_group(std::size_t i); @@ -60,6 +56,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/palette_settings.cpp b/scwx-qt/source/scwx/qt/settings/palette_settings.cpp index c5902fb3..0b88b687 100644 --- a/scwx-qt/source/scwx/qt/settings/palette_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/palette_settings.cpp @@ -6,11 +6,7 @@ #include #include -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 diff --git a/scwx-qt/source/scwx/qt/settings/palette_settings.hpp b/scwx-qt/source/scwx/qt/settings/palette_settings.hpp index eb52e600..c7147a30 100644 --- a/scwx-qt/source/scwx/qt/settings/palette_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/palette_settings.hpp @@ -9,18 +9,14 @@ #include #include -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& palette(const std::string& name) const; - SettingsVariable& alert_color(awips::Phenomenon phenomenon, - bool active) const; + [[nodiscard]] SettingsVariable& + palette(const std::string& name) const; + [[nodiscard]] SettingsVariable& + alert_color(awips::Phenomenon phenomenon, bool active) const; AlertPaletteSettings& alert_palette(awips::Phenomenon); static const std::vector& alert_phenomena(); @@ -45,6 +42,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/product_settings.cpp b/scwx-qt/source/scwx/qt/settings/product_settings.cpp index b9287474..1221d717 100644 --- a/scwx-qt/source/scwx/qt/settings/product_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/product_settings.cpp @@ -1,11 +1,9 @@ #include #include -namespace scwx -{ -namespace qt -{ -namespace settings +#include + +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 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 diff --git a/scwx-qt/source/scwx/qt/settings/product_settings.hpp b/scwx-qt/source/scwx/qt/settings/product_settings.hpp index 570c6b15..d267b127 100644 --- a/scwx-qt/source/scwx/qt/settings/product_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/product_settings.hpp @@ -4,20 +4,15 @@ #include #include -#include -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 p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_category.cpp b/scwx-qt/source/scwx/qt/settings/settings_category.cpp index 75a46bf8..b0e1b416 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_category.cpp +++ b/scwx-qt/source/scwx/qt/settings/settings_category.cpp @@ -4,11 +4,7 @@ #include -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 diff --git a/scwx-qt/source/scwx/qt/settings/settings_category.hpp b/scwx-qt/source/scwx/qt/settings/settings_category.hpp index 167af06a..c47bfdeb 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_category.hpp +++ b/scwx-qt/source/scwx/qt/settings/settings_category.hpp @@ -8,11 +8,7 @@ #include #include -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 p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_container.cpp b/scwx-qt/source/scwx/qt/settings/settings_container.cpp index cf8f9c18..df0d7e41 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_container.cpp +++ b/scwx-qt/source/scwx/qt/settings/settings_container.cpp @@ -1,11 +1,7 @@ #include #include -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 SettingsContainer::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 elementMinimum_ {}; @@ -172,6 +172,4 @@ bool SettingsContainer::Equals(const SettingsVariableBase& o) const template class SettingsContainer>; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_container.hpp b/scwx-qt/source/scwx/qt/settings/settings_container.hpp index 9c2ea487..0e378a81 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_container.hpp +++ b/scwx-qt/source/scwx/qt/settings/settings_container.hpp @@ -2,11 +2,7 @@ #include -namespace scwx -{ -namespace qt -{ -namespace settings +namespace scwx::qt::settings { template @@ -92,13 +88,12 @@ public: void SetElementValidator(std::function 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 p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_interface.cpp b/scwx-qt/source/scwx/qt/settings/settings_interface.cpp index 4d491563..ab36ebd9 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_interface.cpp +++ b/scwx-qt/source/scwx/qt/settings/settings_interface.cpp @@ -12,12 +12,9 @@ #include #include #include +#include -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 void SetWidgetText(U* widget, const T& currentValue); @@ -633,6 +634,4 @@ template class SettingsInterface; // Containers are not to be used directly template class SettingsInterface>; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_interface.hpp b/scwx-qt/source/scwx/qt/settings/settings_interface.hpp index a0005098..3d7d9d85 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_interface.hpp +++ b/scwx-qt/source/scwx/qt/settings/settings_interface.hpp @@ -5,15 +5,10 @@ #include #include #include -#include class QLabel; -namespace scwx -{ -namespace qt -{ -namespace settings +namespace scwx::qt::settings { template @@ -140,6 +135,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_interface_base.cpp b/scwx-qt/source/scwx/qt/settings/settings_interface_base.cpp index 37e1ec25..e7060573 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_interface_base.cpp +++ b/scwx-qt/source/scwx/qt/settings/settings_interface_base.cpp @@ -2,11 +2,7 @@ #include -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()) {} @@ -29,6 +29,4 @@ SettingsInterfaceBase::SettingsInterfaceBase(SettingsInterfaceBase&&) noexcept = SettingsInterfaceBase& SettingsInterfaceBase::operator=(SettingsInterfaceBase&&) noexcept = default; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_interface_base.hpp b/scwx-qt/source/scwx/qt/settings/settings_interface_base.hpp index d0dc2ff2..16e89469 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_interface_base.hpp +++ b/scwx-qt/source/scwx/qt/settings/settings_interface_base.hpp @@ -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 p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_variable.cpp b/scwx-qt/source/scwx/qt/settings/settings_variable.cpp index 6eda8437..9682cbe4 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_variable.cpp +++ b/scwx-qt/source/scwx/qt/settings/settings_variable.cpp @@ -7,11 +7,7 @@ #include #include -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 SettingsVariable::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; // Containers are not to be used directly template class SettingsVariable>; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_variable.hpp b/scwx-qt/source/scwx/qt/settings/settings_variable.hpp index 2c3b2a07..3fc0b81d 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_variable.hpp +++ b/scwx-qt/source/scwx/qt/settings/settings_variable.hpp @@ -10,11 +10,7 @@ class QAbstractButton; class QWidget; -namespace scwx -{ -namespace qt -{ -namespace settings +namespace scwx::qt::settings { template @@ -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 p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/settings_variable_base.cpp b/scwx-qt/source/scwx/qt/settings/settings_variable_base.cpp index 7e31fb5f..f2941b9a 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_variable_base.cpp +++ b/scwx-qt/source/scwx/qt/settings/settings_variable_base.cpp @@ -1,10 +1,6 @@ #include -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 diff --git a/scwx-qt/source/scwx/qt/settings/settings_variable_base.hpp b/scwx-qt/source/scwx/qt/settings/settings_variable_base.hpp index f4e48934..d613da91 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_variable_base.hpp +++ b/scwx-qt/source/scwx/qt/settings/settings_variable_base.hpp @@ -6,11 +6,7 @@ #include #include -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 diff --git a/scwx-qt/source/scwx/qt/settings/text_settings.cpp b/scwx-qt/source/scwx/qt/settings/text_settings.cpp index 942ad4f8..b66268e0 100644 --- a/scwx-qt/source/scwx/qt/settings/text_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/text_settings.cpp @@ -3,11 +3,7 @@ #include -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 diff --git a/scwx-qt/source/scwx/qt/settings/text_settings.hpp b/scwx-qt/source/scwx/qt/settings/text_settings.hpp index 2be5ab13..593702fe 100644 --- a/scwx-qt/source/scwx/qt/settings/text_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/text_settings.hpp @@ -7,18 +7,14 @@ #include #include -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& + [[nodiscard]] SettingsVariable& font_family(types::FontCategory fontCategory) const; - SettingsVariable& + [[nodiscard]] SettingsVariable& font_style(types::FontCategory fontCategory) const; - SettingsVariable& + [[nodiscard]] SettingsVariable& font_point_size(types::FontCategory fontCategory) const; - SettingsVariable& hover_text_wrap() const; - SettingsVariable& placefile_text_drop_shadow_enabled() const; - SettingsVariable& radar_site_hover_text_enabled() const; - SettingsVariable& tooltip_method() const; + [[nodiscard]] SettingsVariable& hover_text_wrap() const; + [[nodiscard]] SettingsVariable& + placefile_text_drop_shadow_enabled() const; + [[nodiscard]] SettingsVariable& radar_site_hover_text_enabled() const; + [[nodiscard]] SettingsVariable& tooltip_method() const; static TextSettings& Instance(); @@ -48,6 +45,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/ui_settings.cpp b/scwx-qt/source/scwx/qt/settings/ui_settings.cpp index eca2c8e1..e4689120 100644 --- a/scwx-qt/source/scwx/qt/settings/ui_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/ui_settings.cpp @@ -1,10 +1,6 @@ #include -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 level2ProductsExpanded_ {"level2_products_expanded"}; SettingsVariable 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 diff --git a/scwx-qt/source/scwx/qt/settings/ui_settings.hpp b/scwx-qt/source/scwx/qt/settings/ui_settings.hpp index 0a9f95ef..d8970c73 100644 --- a/scwx-qt/source/scwx/qt/settings/ui_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/ui_settings.hpp @@ -6,11 +6,7 @@ #include #include -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& level2_products_expanded() const; - SettingsVariable& level2_settings_expanded() const; - SettingsVariable& level3_products_expanded() const; - SettingsVariable& map_settings_expanded() const; - SettingsVariable& timeline_expanded() const; - SettingsVariable& main_ui_state() const; - SettingsVariable& main_ui_geometry() const; + [[nodiscard]] SettingsVariable& level2_products_expanded() const; + [[nodiscard]] SettingsVariable& level2_settings_expanded() const; + [[nodiscard]] SettingsVariable& level3_products_expanded() const; + [[nodiscard]] SettingsVariable& map_settings_expanded() const; + [[nodiscard]] SettingsVariable& timeline_expanded() const; + [[nodiscard]] SettingsVariable& main_ui_state() const; + [[nodiscard]] SettingsVariable& main_ui_geometry() const; bool Shutdown(); @@ -45,6 +41,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings diff --git a/scwx-qt/source/scwx/qt/settings/unit_settings.cpp b/scwx-qt/source/scwx/qt/settings/unit_settings.cpp index c2cb0f11..542ae153 100644 --- a/scwx-qt/source/scwx/qt/settings/unit_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/unit_settings.cpp @@ -4,11 +4,7 @@ #include -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 accumulationUnits_ {"accumulation_units"}; SettingsVariable 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 diff --git a/scwx-qt/source/scwx/qt/settings/unit_settings.hpp b/scwx-qt/source/scwx/qt/settings/unit_settings.hpp index 15518492..a7d06eed 100644 --- a/scwx-qt/source/scwx/qt/settings/unit_settings.hpp +++ b/scwx-qt/source/scwx/qt/settings/unit_settings.hpp @@ -6,18 +6,14 @@ #include #include -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& accumulation_units() const; - SettingsVariable& echo_tops_units() const; - SettingsVariable& other_units() const; - SettingsVariable& speed_units() const; - SettingsVariable& distance_units() const; + [[nodiscard]] SettingsVariable& accumulation_units() const; + [[nodiscard]] SettingsVariable& echo_tops_units() const; + [[nodiscard]] SettingsVariable& other_units() const; + [[nodiscard]] SettingsVariable& speed_units() const; + [[nodiscard]] SettingsVariable& distance_units() const; static UnitSettings& Instance(); @@ -40,6 +36,4 @@ private: std::unique_ptr p; }; -} // namespace settings -} // namespace qt -} // namespace scwx +} // namespace scwx::qt::settings