mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:23:53 +00:00
Merge pull request #2365 from akortunov/guifixes
Refactor Settings::Manager::apply()
This commit is contained in:
commit
acae586765
4 changed files with 15 additions and 9 deletions
|
@ -478,12 +478,13 @@ namespace MWGui
|
||||||
|
|
||||||
void SettingsWindow::apply()
|
void SettingsWindow::apply()
|
||||||
{
|
{
|
||||||
const Settings::CategorySettingVector changed = Settings::Manager::apply();
|
const Settings::CategorySettingVector changed = Settings::Manager::getPendingChanges();
|
||||||
MWBase::Environment::get().getWorld()->processChangedSettings(changed);
|
MWBase::Environment::get().getWorld()->processChangedSettings(changed);
|
||||||
MWBase::Environment::get().getSoundManager()->processChangedSettings(changed);
|
MWBase::Environment::get().getSoundManager()->processChangedSettings(changed);
|
||||||
MWBase::Environment::get().getWindowManager()->processChangedSettings(changed);
|
MWBase::Environment::get().getWindowManager()->processChangedSettings(changed);
|
||||||
MWBase::Environment::get().getInputManager()->processChangedSettings(changed);
|
MWBase::Environment::get().getInputManager()->processChangedSettings(changed);
|
||||||
MWBase::Environment::get().getMechanicsManager()->processChangedSettings(changed);
|
MWBase::Environment::get().getMechanicsManager()->processChangedSettings(changed);
|
||||||
|
Settings::Manager::resetPendingChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWindow::onKeyboardSwitchClicked(MyGUI::Widget* _sender)
|
void SettingsWindow::onKeyboardSwitchClicked(MyGUI::Widget* _sender)
|
||||||
|
|
|
@ -1130,8 +1130,8 @@ namespace MWInput
|
||||||
// There is no need to track these changes.
|
// There is no need to track these changes.
|
||||||
Settings::Manager::setInt("resolution x", "Video", x);
|
Settings::Manager::setInt("resolution x", "Video", x);
|
||||||
Settings::Manager::setInt("resolution y", "Video", y);
|
Settings::Manager::setInt("resolution y", "Video", y);
|
||||||
Settings::Manager::apply("resolution x", "Video");
|
Settings::Manager::resetPendingChange("resolution x", "Video");
|
||||||
Settings::Manager::apply("resolution y", "Video");
|
Settings::Manager::resetPendingChange("resolution y", "Video");
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->windowResized(x, y);
|
MWBase::Environment::get().getWindowManager()->windowResized(x, y);
|
||||||
|
|
||||||
|
|
|
@ -414,17 +414,20 @@ void Manager::setBool(const std::string &setting, const std::string &category, c
|
||||||
setString(setting, category, value ? "true" : "false");
|
setString(setting, category, value ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::apply(const std::string &setting, const std::string &category)
|
void Manager::resetPendingChange(const std::string &setting, const std::string &category)
|
||||||
{
|
{
|
||||||
CategorySettingValueMap::key_type key = std::make_pair(category, setting);
|
CategorySettingValueMap::key_type key = std::make_pair(category, setting);
|
||||||
mChangedSettings.erase(key);
|
mChangedSettings.erase(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CategorySettingVector Manager::apply()
|
const CategorySettingVector Manager::getPendingChanges()
|
||||||
|
{
|
||||||
|
return mChangedSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Manager::resetPendingChanges()
|
||||||
{
|
{
|
||||||
CategorySettingVector vec = mChangedSettings;
|
|
||||||
mChangedSettings.clear();
|
mChangedSettings.clear();
|
||||||
return vec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,11 @@ namespace Settings
|
||||||
void saveUser (const std::string& file);
|
void saveUser (const std::string& file);
|
||||||
///< save user settings to file
|
///< save user settings to file
|
||||||
|
|
||||||
static void apply(const std::string &setting, const std::string &category);
|
static void resetPendingChange(const std::string &setting, const std::string &category);
|
||||||
|
|
||||||
static const CategorySettingVector apply();
|
static void resetPendingChanges();
|
||||||
|
|
||||||
|
static const CategorySettingVector getPendingChanges();
|
||||||
///< returns the list of changed settings and then clears it
|
///< returns the list of changed settings and then clears it
|
||||||
|
|
||||||
static int getInt (const std::string& setting, const std::string& category);
|
static int getInt (const std::string& setting, const std::string& category);
|
||||||
|
|
Loading…
Reference in a new issue