openmw-tes3coop/apps/opencs/model/prefs/state.hpp

62 lines
1.3 KiB
C++
Raw Normal View History

#ifndef CSV_PREFS_STATE_H
#define CSM_PREFS_STATE_H
2015-12-06 11:06:28 +00:00
#include <map>
#include <string>
#include <QObject>
#ifndef Q_MOC_RUN
#include <components/files/configurationmanager.hpp>
#endif
#include <components/settings/settings.hpp>
2015-12-06 11:06:28 +00:00
#include "category.hpp"
namespace CSMPrefs
{
class State : public QObject
{
Q_OBJECT
static State *sThis;
const std::string mConfigFile;
const Files::ConfigurationManager& mConfigurationManager;
Settings::Manager mSettings;
2015-12-06 11:06:28 +00:00
std::map<std::string, Category> mCategories;
std::map<std::string, Category>::iterator mCurrentCategory;
// not implemented
State (const State&);
State& operator= (const State&);
private:
void load();
void declare();
2015-12-06 11:06:28 +00:00
void declareCategory (const std::string& key, const std::string& name);
public:
State (const Files::ConfigurationManager& configurationManager);
~State();
void save();
2015-12-06 11:06:28 +00:00
/// \return collection of name, key pairs (sorted)
std::vector<std::pair<std::string, std::string> > listCategories() const;
static State& get();
};
// convenience function
State& get();
}
#endif