2014-01-05 17:22:29 +00:00
|
|
|
#ifndef COMPONENTS_SETTINGS_H
|
|
|
|
#define COMPONENTS_SETTINGS_H
|
2012-03-30 16:38:33 +00:00
|
|
|
|
2019-09-29 14:16:19 +00:00
|
|
|
#include "categories.hpp"
|
|
|
|
|
2015-02-02 23:53:30 +00:00
|
|
|
#include <set>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2020-07-24 19:47:49 +00:00
|
|
|
#include <osg/Vec2f>
|
|
|
|
#include <osg/Vec3f>
|
2012-03-30 16:38:33 +00:00
|
|
|
|
|
|
|
namespace Settings
|
|
|
|
{
|
|
|
|
///
|
|
|
|
/// \brief Settings management (can change during runtime)
|
|
|
|
///
|
|
|
|
class Manager
|
|
|
|
{
|
|
|
|
public:
|
2015-02-02 23:53:30 +00:00
|
|
|
static CategorySettingValueMap mDefaultSettings;
|
|
|
|
static CategorySettingValueMap mUserSettings;
|
2021-02-25 21:52:57 +00:00
|
|
|
static CategorySettingValueMap mSettingsOverrides;
|
2012-03-30 16:38:33 +00:00
|
|
|
|
2012-04-01 16:48:37 +00:00
|
|
|
static CategorySettingVector mChangedSettings;
|
2012-04-01 14:26:42 +00:00
|
|
|
///< tracks all the settings that were changed since the last apply() call
|
|
|
|
|
2015-11-27 19:32:45 +00:00
|
|
|
void clear();
|
|
|
|
///< clears all settings and default settings
|
|
|
|
|
2021-05-21 14:00:09 +00:00
|
|
|
/*
|
|
|
|
Start of tes3mp change (major)
|
|
|
|
|
|
|
|
Add a base64encoded argument to this function to allow unencoded files to still be opened
|
|
|
|
*/
|
|
|
|
void loadDefault (const std::string& file, bool base64encoded = true);
|
2012-03-30 16:38:33 +00:00
|
|
|
///< load file as the default settings (can be overridden by user settings)
|
2021-05-21 14:00:09 +00:00
|
|
|
/*
|
|
|
|
End of tes3mp change (major)
|
|
|
|
*/
|
2012-03-30 16:38:33 +00:00
|
|
|
|
2012-03-31 11:35:40 +00:00
|
|
|
void loadUser (const std::string& file);
|
2012-03-30 16:38:33 +00:00
|
|
|
///< load file as user settings
|
|
|
|
|
2021-02-25 21:52:57 +00:00
|
|
|
void loadOverrides (const std::string& file);
|
|
|
|
///< load file as settings overrides
|
|
|
|
|
2012-03-31 11:35:40 +00:00
|
|
|
void saveUser (const std::string& file);
|
|
|
|
///< save user settings to file
|
2012-03-30 16:38:33 +00:00
|
|
|
|
2019-05-04 17:38:36 +00:00
|
|
|
static void resetPendingChange(const std::string &setting, const std::string &category);
|
2019-05-02 15:00:47 +00:00
|
|
|
|
2019-05-04 17:38:36 +00:00
|
|
|
static void resetPendingChanges();
|
|
|
|
|
|
|
|
static const CategorySettingVector getPendingChanges();
|
2012-04-01 14:26:42 +00:00
|
|
|
///< returns the list of changed settings and then clears it
|
|
|
|
|
2014-08-14 17:18:30 +00:00
|
|
|
static int getInt (const std::string& setting, const std::string& category);
|
|
|
|
static float getFloat (const std::string& setting, const std::string& category);
|
2021-06-19 00:20:29 +00:00
|
|
|
static double getDouble (const std::string& setting, const std::string& category);
|
2014-08-14 17:18:30 +00:00
|
|
|
static std::string getString (const std::string& setting, const std::string& category);
|
|
|
|
static bool getBool (const std::string& setting, const std::string& category);
|
2020-07-24 19:47:49 +00:00
|
|
|
static osg::Vec2f getVector2 (const std::string& setting, const std::string& category);
|
|
|
|
static osg::Vec3f getVector3 (const std::string& setting, const std::string& category);
|
2012-03-31 11:35:40 +00:00
|
|
|
|
|
|
|
static void setInt (const std::string& setting, const std::string& category, const int value);
|
|
|
|
static void setFloat (const std::string& setting, const std::string& category, const float value);
|
2021-06-19 00:20:29 +00:00
|
|
|
static void setDouble (const std::string& setting, const std::string& category, const double value);
|
2012-03-31 11:35:40 +00:00
|
|
|
static void setString (const std::string& setting, const std::string& category, const std::string& value);
|
|
|
|
static void setBool (const std::string& setting, const std::string& category, const bool value);
|
2020-07-24 19:47:49 +00:00
|
|
|
static void setVector2 (const std::string& setting, const std::string& category, const osg::Vec2f value);
|
|
|
|
static void setVector3 (const std::string& setting, const std::string& category, const osg::Vec3f value);
|
2021-02-25 21:52:57 +00:00
|
|
|
|
|
|
|
static void overrideInt(const std::string& setting, const std::string& category, const int value);
|
|
|
|
static void overrideFloat(const std::string& setting, const std::string& category, const float value);
|
|
|
|
static void overrideString(const std::string& setting, const std::string& category, const std::string& value);
|
|
|
|
static void overrideBool(const std::string& setting, const std::string& category, const bool value);
|
|
|
|
static void overrideVector2(const std::string& setting, const std::string& category, const osg::Vec2f value);
|
|
|
|
static void overrideVector3(const std::string& setting, const std::string& category, const osg::Vec3f value);
|
2012-03-30 16:38:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _COMPONENTS_SETTINGS_H
|