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>
|
|
|
|
|
2014-04-23 03:19:53 +00:00
|
|
|
#include "settingmanager.hpp"
|
2013-05-08 01:33:42 +00:00
|
|
|
|
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;
|
2014-05-05 10:56:03 +00:00
|
|
|
class QSettings;
|
2013-05-08 01:33:42 +00:00
|
|
|
|
2013-05-11 10:55:46 +00:00
|
|
|
namespace CSMSettings {
|
2013-05-08 01:33:42 +00:00
|
|
|
|
2014-04-23 03:19:53 +00:00
|
|
|
class UserSettings: public SettingManager
|
2013-05-08 01:33:42 +00:00
|
|
|
{
|
2013-05-12 20:15:57 +00:00
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
2013-06-20 23:06:25 +00:00
|
|
|
static UserSettings *mUserSettingsInstance;
|
2013-06-26 00:32:36 +00:00
|
|
|
QString mUserFilePath;
|
2013-06-15 11:40:18 +00:00
|
|
|
Files::ConfigurationManager mCfgMgr;
|
2014-04-23 03:19:53 +00:00
|
|
|
|
2013-06-15 11:40:18 +00:00
|
|
|
QString mReadOnlyMessage;
|
|
|
|
QString mReadWriteMessage;
|
2014-05-05 10:56:03 +00:00
|
|
|
QSettings *mSettings;
|
|
|
|
|
2013-06-15 11:40:18 +00:00
|
|
|
|
2013-05-08 01:33:42 +00:00
|
|
|
public:
|
2013-05-12 01:55:36 +00:00
|
|
|
|
2013-06-20 23:06:25 +00:00
|
|
|
/// Singleton implementation
|
|
|
|
static UserSettings& instance();
|
|
|
|
|
2013-06-12 10:36:35 +00:00
|
|
|
UserSettings();
|
|
|
|
~UserSettings();
|
2013-05-12 01:55:36 +00:00
|
|
|
|
2013-06-20 23:06:25 +00:00
|
|
|
UserSettings (UserSettings const &); //not implemented
|
|
|
|
void operator= (UserSettings const &); //not implemented
|
2013-05-08 01:33:42 +00:00
|
|
|
|
2013-06-20 23:06:25 +00:00
|
|
|
/// Writes settings to the last loaded settings file
|
2014-04-23 03:19:53 +00:00
|
|
|
bool writeSettings();
|
2013-06-20 23:06:25 +00:00
|
|
|
|
|
|
|
/// Retrieves the settings file at all three levels (global, local and user).
|
2013-06-15 11:40:18 +00:00
|
|
|
void loadSettings (const QString &fileName);
|
2013-05-08 01:33:42 +00:00
|
|
|
|
2014-04-23 03:19:53 +00:00
|
|
|
/// Writes settings to the user's config file path
|
|
|
|
void saveSettings (const QMap <QString, QStringList > &settingMap);
|
2013-05-12 01:55:36 +00:00
|
|
|
|
2014-04-25 12:16:40 +00:00
|
|
|
QString settingValue (const QString &settingKey);
|
2013-05-08 01:33:42 +00:00
|
|
|
|
|
|
|
private:
|
2013-05-12 01:55:36 +00:00
|
|
|
|
2014-04-23 03:19:53 +00:00
|
|
|
void buildSettingModelDefaults();
|
2013-05-08 01:33:42 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // USERSETTINGS_HPP
|