1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 03:59:56 +00:00

Merge branch 'editor_string_settings' into 'master'

Use settings values to declare string settings (#6876)

See merge request OpenMW/openmw!3695
This commit is contained in:
jvoisin 2023-12-28 14:51:09 +00:00
commit c9d4ca5320
4 changed files with 9 additions and 10 deletions

View file

@ -440,13 +440,12 @@ void CSMPrefs::State::declare()
declareShortcut("script-editor-uncomment", "Uncomment Selection", QKeySequence());
declareCategory("Models");
declareString("baseanim", "base animations", "meshes/base_anim.nif")
.setTooltip("3rd person base model with textkeys-data");
declareString("baseanimkna", "base animations, kna", "meshes/base_animkna.nif")
declareString(mValues->mModels.mBaseanim, "base animations").setTooltip("3rd person base model with textkeys-data");
declareString(mValues->mModels.mBaseanimkna, "base animations, kna")
.setTooltip("3rd person beast race base model with textkeys-data");
declareString("baseanimfemale", "base animations, female", "meshes/base_anim_female.nif")
declareString(mValues->mModels.mBaseanimfemale, "base animations, female")
.setTooltip("3rd person female base model with textkeys-data");
declareString("wolfskin", "base animations, wolf", "meshes/wolf/skin.nif").setTooltip("3rd person werewolf skin");
declareString(mValues->mModels.mWolfskin, "base animations, wolf").setTooltip("3rd person werewolf skin");
}
void CSMPrefs::State::declareCategory(const std::string& key)
@ -547,13 +546,13 @@ CSMPrefs::ShortcutSetting& CSMPrefs::State::declareShortcut(
}
CSMPrefs::StringSetting& CSMPrefs::State::declareString(
const std::string& key, const QString& label, const std::string& default_)
Settings::SettingValue<std::string>& value, const QString& label)
{
if (mCurrentCategory == mCategories.end())
throw std::logic_error("no category for setting");
CSMPrefs::StringSetting* setting
= new CSMPrefs::StringSetting(&mCurrentCategory->second, &mMutex, key, label, *mIndex);
= new CSMPrefs::StringSetting(&mCurrentCategory->second, &mMutex, value.mName, label, *mIndex);
mCurrentCategory->second.addSetting(setting);

View file

@ -75,7 +75,7 @@ namespace CSMPrefs
ShortcutSetting& declareShortcut(const std::string& key, const QString& label, const QKeySequence& default_);
StringSetting& declareString(const std::string& key, const QString& label, const std::string& default_);
StringSetting& declareString(Settings::SettingValue<std::string>& value, const QString& label);
ModifierSetting& declareModifier(Settings::SettingValue<std::string>& value, const QString& label);

View file

@ -12,7 +12,7 @@
#include "state.hpp"
CSMPrefs::StringSetting::StringSetting(
Category* parent, QMutex* mutex, const std::string& key, const QString& label, Settings::Index& index)
Category* parent, QMutex* mutex, std::string_view key, const QString& label, Settings::Index& index)
: TypedSetting(parent, mutex, key, label, index)
, mWidget(nullptr)
{

View file

@ -24,7 +24,7 @@ namespace CSMPrefs
public:
explicit StringSetting(
Category* parent, QMutex* mutex, const std::string& key, const QString& label, Settings::Index& index);
Category* parent, QMutex* mutex, std::string_view key, const QString& label, Settings::Index& index);
StringSetting& setTooltip(const std::string& tooltip);