2015-12-06 10:18:31 +00:00
|
|
|
#ifndef CSV_PREFS_STATE_H
|
|
|
|
#define CSM_PREFS_STATE_H
|
|
|
|
|
2015-12-06 11:06:28 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
2015-12-06 10:18:31 +00:00
|
|
|
#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"
|
|
|
|
|
2015-12-06 10:18:31 +00:00
|
|
|
namespace CSMPrefs
|
|
|
|
{
|
|
|
|
class State : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
static State *sThis;
|
|
|
|
|
2015-12-08 08:56:42 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
typedef std::map<std::string, Category> Collection;
|
|
|
|
typedef Collection::iterator Iterator;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2015-12-06 10:18:31 +00:00
|
|
|
const std::string mConfigFile;
|
|
|
|
const Files::ConfigurationManager& mConfigurationManager;
|
|
|
|
Settings::Manager mSettings;
|
2015-12-08 08:56:42 +00:00
|
|
|
Collection mCategories;
|
|
|
|
Iterator mCurrentCategory;
|
2015-12-06 10:18:31 +00:00
|
|
|
|
|
|
|
// not implemented
|
|
|
|
State (const State&);
|
|
|
|
State& operator= (const State&);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void load();
|
|
|
|
|
|
|
|
void declare();
|
|
|
|
|
2015-12-08 08:56:42 +00:00
|
|
|
void declareCategory (const std::string& key);
|
2015-12-06 11:06:28 +00:00
|
|
|
|
2015-12-06 10:18:31 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
State (const Files::ConfigurationManager& configurationManager);
|
|
|
|
|
|
|
|
~State();
|
|
|
|
|
|
|
|
void save();
|
|
|
|
|
2015-12-08 08:56:42 +00:00
|
|
|
Iterator begin();
|
|
|
|
|
|
|
|
Iterator end();
|
2015-12-06 11:06:28 +00:00
|
|
|
|
2015-12-06 10:18:31 +00:00
|
|
|
static State& get();
|
|
|
|
};
|
|
|
|
|
|
|
|
// convenience function
|
|
|
|
State& get();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|