34 lines
769 B
C
34 lines
769 B
C
|
|
#ifndef SETTINGS_H
|
||
|
|
#define SETTINGS_H
|
||
|
|
|
||
|
|
#include <QObject>
|
||
|
|
#include <QSettings>
|
||
|
|
|
||
|
|
class Settings
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
static Settings& instance();
|
||
|
|
|
||
|
|
public:
|
||
|
|
void setValue(const QString& group, const QString& name, const QVariant& value);
|
||
|
|
QVariant value(const QString& group, const QString& name);
|
||
|
|
void clearValue(const QString& group, const QString& name);
|
||
|
|
bool contains(const QString& group, const QString& name);
|
||
|
|
|
||
|
|
private:
|
||
|
|
QVariant getDefaultValue(const QString& group, const QString& name);
|
||
|
|
|
||
|
|
private:
|
||
|
|
explicit Settings();
|
||
|
|
~Settings();
|
||
|
|
Settings(const Settings&) = delete;
|
||
|
|
Settings& operator=(const Settings&) = delete;
|
||
|
|
|
||
|
|
private:
|
||
|
|
QSettings* m_settings;
|
||
|
|
QString m_settingsFile;
|
||
|
|
bool m_isVaildSettingsFile;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // SETTINGS_H
|