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"
|
|
|
|
|
2013-06-15 11:40:18 +00:00
|
|
|
#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;
|
|
|
|
|
2013-05-11 10:55:46 +00:00
|
|
|
namespace CSMSettings {
|
2013-05-08 01:33:42 +00:00
|
|
|
|
2013-05-12 20:15:57 +00:00
|
|
|
struct UserSettings: public QObject
|
2013-05-08 01:33:42 +00:00
|
|
|
{
|
2013-05-12 20:15:57 +00:00
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
2013-06-15 11:40:18 +00:00
|
|
|
SectionMap mSectionSettings;
|
|
|
|
UserSettings *mUserSettingsInstance;
|
|
|
|
QStringList mPaths;
|
|
|
|
Files::ConfigurationManager mCfgMgr;
|
|
|
|
|
|
|
|
QString mReadOnlyMessage;
|
|
|
|
QString mReadWriteMessage;
|
|
|
|
|
2013-05-08 01:33:42 +00:00
|
|
|
public:
|
2013-05-12 01:55:36 +00:00
|
|
|
|
2013-06-12 10:36:35 +00:00
|
|
|
UserSettings();
|
|
|
|
~UserSettings();
|
2013-05-12 01:55:36 +00:00
|
|
|
|
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
|
|
|
|
2013-06-17 11:45:44 +00:00
|
|
|
<<<<<<< HEAD
|
2013-06-15 11:40:18 +00:00
|
|
|
bool writeFile(QMap<QString, SettingList *> §ions);
|
|
|
|
const SectionMap &getSettings ();
|
|
|
|
void updateSettings (const QString §ionName, const QString &settingName = "");
|
|
|
|
void loadSettings (const QString &fileName);
|
2013-05-08 01:33:42 +00:00
|
|
|
|
|
|
|
private:
|
2013-05-12 01:55:36 +00:00
|
|
|
|
|
|
|
UserSettings();
|
|
|
|
~UserSettings();
|
2013-06-17 11:45:44 +00:00
|
|
|
=======
|
2013-06-12 10:36:35 +00:00
|
|
|
QFile *openFile (const QString &) const;
|
|
|
|
bool writeFile(QFile *file, QMap<QString, SettingList *> §ions) 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-05-12 01:55:36 +00:00
|
|
|
|
2013-06-12 10:36:35 +00:00
|
|
|
static UserSettings *mUserSettingsInstance;
|
|
|
|
|
|
|
|
CSMSettings::SectionMap mSectionMap;
|
|
|
|
QStringList mSettingsFiles;
|
2013-06-17 11:45:44 +00:00
|
|
|
>>>>>>> df1f1bd5c81d94a1ea2693000ec5dc589b069826
|
2013-05-12 01:55:36 +00:00
|
|
|
|
|
|
|
UserSettings (UserSettings const &); //not implemented
|
|
|
|
void operator= (UserSettings const &); //not implemented
|
2013-05-08 01:33:42 +00:00
|
|
|
|
2013-06-15 11:40:18 +00:00
|
|
|
QTextStream *openFileStream (const QString &filePath, bool isReadOnly = false);
|
|
|
|
void loadFromFile (const QString &filePath = "");
|
|
|
|
|
2013-05-12 20:15:57 +00:00
|
|
|
signals:
|
|
|
|
void signalUpdateEditorSetting (const QString &settingName, const QString &settingValue);
|
|
|
|
|
2013-05-08 01:33:42 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // USERSETTINGS_HPP
|