openmw-tes3coop/apps/opencs/model/settings/usersettings.hpp

85 lines
2.2 KiB
C++
Raw Normal View History

2013-05-08 01:33:42 +00:00
#ifndef USERSETTINGS_HPP
#define USERSETTINGS_HPP
#include <QTextStream>
#include <QStringList>
#include <QString>
#include <QMap>
#include <boost/filesystem/path.hpp>
#include "support.hpp"
#ifndef Q_MOC_RUN
#include <components/files/configurationmanager.hpp>
#endif
2013-05-08 01:33:42 +00:00
namespace Files { typedef std::vector<boost::filesystem::path> PathContainer;
struct ConfigurationManager;}
class QFile;
namespace CSMSettings {
2013-05-08 01:33:42 +00:00
struct UserSettings: public QObject
2013-05-08 01:33:42 +00:00
{
Q_OBJECT
SectionMap mSectionSettings;
UserSettings *mUserSettingsInstance;
QStringList mPaths;
Files::ConfigurationManager mCfgMgr;
QString mReadOnlyMessage;
QString mReadWriteMessage;
2013-05-08 01:33:42 +00:00
public:
2013-06-12 10:36:35 +00:00
UserSettings();
~UserSettings();
2013-06-12 10:36:35 +00:00
static const UserSettings& instance();
2013-05-08 01:33:42 +00:00
2013-06-12 10:36:35 +00:00
void readSettings();
void setSettingsFiles(QStringList files);
2013-05-08 01:33:42 +00:00
<<<<<<< HEAD
bool writeFile(QMap<QString, SettingList *> &sections);
const SectionMap &getSettings ();
void updateSettings (const QString &sectionName, const QString &settingName = "");
void loadSettings (const QString &fileName);
2013-05-08 01:33:42 +00:00
private:
UserSettings();
~UserSettings();
=======
2013-06-12 10:36:35 +00:00
QFile *openFile (const QString &) const;
bool writeFile(QFile *file, QMap<QString, SettingList *> &sections) const;
void getSettings (QTextStream &stream, SectionMap &settings) const;
QStringList getSettingsFiles () const;
CSMSettings::SectionMap getSettingsMap() const;
QString getSettingValue(QString section, QString setting) const;
2013-05-08 01:33:42 +00:00
private:
2013-06-12 10:36:35 +00:00
static UserSettings *mUserSettingsInstance;
CSMSettings::SectionMap mSectionMap;
QStringList mSettingsFiles;
>>>>>>> df1f1bd5c81d94a1ea2693000ec5dc589b069826
UserSettings (UserSettings const &); //not implemented
void operator= (UserSettings const &); //not implemented
2013-05-08 01:33:42 +00:00
QTextStream *openFileStream (const QString &filePath, bool isReadOnly = false);
void loadFromFile (const QString &filePath = "");
signals:
void signalUpdateEditorSetting (const QString &settingName, const QString &settingValue);
2013-05-08 01:33:42 +00:00
};
}
#endif // USERSETTINGS_HPP