mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 21:35:24 +00:00
Move SettingsPage settings related functions to anonymous namespace
This commit is contained in:
parent
c39083ba7e
commit
121b75212f
@ -10,8 +10,52 @@
|
||||
|
||||
#include <components/config/gamesettings.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "utils/openalutil.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
void loadSettingBool(QCheckBox* checkbox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
if (Settings::Manager::getBool(setting, group))
|
||||
checkbox->setCheckState(Qt::Checked);
|
||||
}
|
||||
|
||||
void saveSettingBool(QCheckBox* checkbox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
const bool cValue = checkbox->checkState();
|
||||
if (cValue != Settings::Manager::getBool(setting, group))
|
||||
Settings::Manager::setBool(setting, group, cValue);
|
||||
}
|
||||
|
||||
void loadSettingInt(QComboBox* comboBox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
const int currentIndex = Settings::Manager::getInt(setting, group);
|
||||
comboBox->setCurrentIndex(currentIndex);
|
||||
}
|
||||
|
||||
void saveSettingInt(QComboBox* comboBox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
const int currentIndex = comboBox->currentIndex();
|
||||
if (currentIndex != Settings::Manager::getInt(setting, group))
|
||||
Settings::Manager::setInt(setting, group, currentIndex);
|
||||
}
|
||||
|
||||
void loadSettingInt(QSpinBox* spinBox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
const int value = Settings::Manager::getInt(setting, group);
|
||||
spinBox->setValue(value);
|
||||
}
|
||||
|
||||
void saveSettingInt(QSpinBox* spinBox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
const int value = spinBox->value();
|
||||
if (value != Settings::Manager::getInt(setting, group))
|
||||
Settings::Manager::setInt(setting, group, value);
|
||||
}
|
||||
}
|
||||
|
||||
Launcher::SettingsPage::SettingsPage(Config::GameSettings& gameSettings, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, mGameSettings(gameSettings)
|
||||
@ -421,45 +465,6 @@ void Launcher::SettingsPage::saveSettings()
|
||||
}
|
||||
}
|
||||
|
||||
void Launcher::SettingsPage::loadSettingBool(QCheckBox* checkbox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
if (Settings::Manager::getBool(setting, group))
|
||||
checkbox->setCheckState(Qt::Checked);
|
||||
}
|
||||
|
||||
void Launcher::SettingsPage::saveSettingBool(QCheckBox* checkbox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
bool cValue = checkbox->checkState();
|
||||
if (cValue != Settings::Manager::getBool(setting, group))
|
||||
Settings::Manager::setBool(setting, group, cValue);
|
||||
}
|
||||
|
||||
void Launcher::SettingsPage::loadSettingInt(QComboBox* comboBox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
int currentIndex = Settings::Manager::getInt(setting, group);
|
||||
comboBox->setCurrentIndex(currentIndex);
|
||||
}
|
||||
|
||||
void Launcher::SettingsPage::saveSettingInt(QComboBox* comboBox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
int currentIndex = comboBox->currentIndex();
|
||||
if (currentIndex != Settings::Manager::getInt(setting, group))
|
||||
Settings::Manager::setInt(setting, group, currentIndex);
|
||||
}
|
||||
|
||||
void Launcher::SettingsPage::loadSettingInt(QSpinBox* spinBox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
int value = Settings::Manager::getInt(setting, group);
|
||||
spinBox->setValue(value);
|
||||
}
|
||||
|
||||
void Launcher::SettingsPage::saveSettingInt(QSpinBox* spinBox, const std::string& setting, const std::string& group)
|
||||
{
|
||||
int value = spinBox->value();
|
||||
if (value != Settings::Manager::getInt(setting, group))
|
||||
Settings::Manager::setInt(setting, group, value);
|
||||
}
|
||||
|
||||
void Launcher::SettingsPage::slotLoadedCellsChanged(QStringList cellNames)
|
||||
{
|
||||
loadCellsForAutocomplete(cellNames);
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include "ui_settingspage.h"
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
class GameSettings;
|
||||
@ -45,12 +43,6 @@ namespace Launcher
|
||||
* @param filePaths the file paths of the content files to be examined
|
||||
*/
|
||||
void loadCellsForAutocomplete(QStringList filePaths);
|
||||
static void loadSettingBool(QCheckBox* checkbox, const std::string& setting, const std::string& group);
|
||||
static void saveSettingBool(QCheckBox* checkbox, const std::string& setting, const std::string& group);
|
||||
static void loadSettingInt(QComboBox* comboBox, const std::string& setting, const std::string& group);
|
||||
static void saveSettingInt(QComboBox* comboBox, const std::string& setting, const std::string& group);
|
||||
static void loadSettingInt(QSpinBox* spinBox, const std::string& setting, const std::string& group);
|
||||
static void saveSettingInt(QSpinBox* spinBox, const std::string& setting, const std::string& group);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user