From 01316f15b8b3b3c6e46af3ec571e6b4c2d08b552 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 12 Nov 2023 16:20:57 +0100 Subject: [PATCH 1/3] Avoid redundant conversion to string --- apps/openmw/mwgui/windowmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 1d41bab34f..a9ae3bb55a 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1115,7 +1115,7 @@ namespace MWGui else { std::vector split; - Misc::StringUtils::split(std::string{ tag }, split, ":"); + Misc::StringUtils::split(tag, split, ":"); l10n::Manager& l10nManager = *MWBase::Environment::get().getL10nManager(); From 8f27178a0bc2f0a91b1583198b168d705ab9d9d8 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 12 Nov 2023 13:26:39 +0100 Subject: [PATCH 2/3] Use settings values for navigator in the launcher --- apps/launcher/datafilespage.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index b6192d3c02..4d3f0cc64f 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "utils/profilescombobox.hpp" @@ -123,7 +123,7 @@ namespace Launcher int getMaxNavMeshDbFileSizeMiB() { - return Settings::Manager::getUInt64("max navmeshdb file size", "Navigator") / (1024 * 1024); + return Settings::navigator().mMaxNavmeshdbFileSize / (1024 * 1024); } std::optional findFirstPath(const QStringList& directories, const QString& fileName) @@ -359,9 +359,8 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName) void Launcher::DataFilesPage::saveSettings(const QString& profile) { - if (const int value = ui.navMeshMaxSizeSpinBox->value(); value != getMaxNavMeshDbFileSizeMiB()) - Settings::Manager::setUInt64( - "max navmeshdb file size", "Navigator", static_cast(std::max(0, value)) * 1024 * 1024); + Settings::navigator().mMaxNavmeshdbFileSize.set( + static_cast(std::max(0, ui.navMeshMaxSizeSpinBox->value())) * 1024 * 1024); QString profileName = profile; From 1fa5d2ca9885c013aafe6320f166ec58f84cb09e Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 12 Nov 2023 13:26:39 +0100 Subject: [PATCH 3/3] Use settings values for GUI tags --- apps/openmw/mwgui/windowmanagerimp.cpp | 2 +- components/settings/categories/gui.hpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index a9ae3bb55a..d98b7472bb 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1100,7 +1100,7 @@ namespace MWGui std::string_view settingSection = tag.substr(0, comma_pos); std::string_view settingTag = tag.substr(comma_pos + 1, tag.length()); - _result = Settings::Manager::getString(settingTag, settingSection); + _result = Settings::get(settingSection, settingTag).get().print(); } else if (tag.starts_with(tokenToFind)) { diff --git a/components/settings/categories/gui.hpp b/components/settings/categories/gui.hpp index af438d5ddc..4a5e50fd8a 100644 --- a/components/settings/categories/gui.hpp +++ b/components/settings/categories/gui.hpp @@ -28,10 +28,8 @@ namespace Settings SettingValue mSubtitles{ mIndex, "GUI", "subtitles" }; SettingValue mHitFader{ mIndex, "GUI", "hit fader" }; SettingValue mWerewolfOverlay{ mIndex, "GUI", "werewolf overlay" }; - SettingValue mColorBackgroundOwned{ mIndex, "GUI", "color background owned", - makeClampSanitizerFloat(0, 1) }; - SettingValue mColorCrosshairOwned{ mIndex, "GUI", "color crosshair owned", - makeClampSanitizerFloat(0, 1) }; + SettingValue mColorBackgroundOwned{ mIndex, "GUI", "color background owned" }; + SettingValue mColorCrosshairOwned{ mIndex, "GUI", "color crosshair owned" }; SettingValue mKeyboardNavigation{ mIndex, "GUI", "keyboard navigation" }; SettingValue mColorTopicEnable{ mIndex, "GUI", "color topic enable" }; SettingValue mColorTopicSpecific{ mIndex, "GUI", "color topic specific" };