mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-26 17:54:40 +00:00
79 lines
1.7 KiB
C++
79 lines
1.7 KiB
C++
/*
|
|
* Copyright (C) 2018-2019 QuasarApp.
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
|
|
#ifndef SETTINGS_H
|
|
#define SETTINGS_H
|
|
|
|
#include "quasarapp_global.h"
|
|
#include <QObject>
|
|
#include <QVariant>
|
|
|
|
class QSettings;
|
|
|
|
namespace QuasarAppUtils {
|
|
|
|
/**
|
|
* @brief The Settings class - singleton for QSettings
|
|
*/
|
|
class QUASARAPPSHARED_EXPORT Settings : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
explicit Settings();
|
|
QSettings *_settings;
|
|
|
|
public:
|
|
|
|
/**
|
|
* @brief get
|
|
* @return object of all settings app;
|
|
*/
|
|
static Settings* get();
|
|
|
|
/**
|
|
* @brief get
|
|
* @return const object of all settings app;
|
|
*/
|
|
static const Settings* getConst();
|
|
|
|
/**
|
|
* @brief getValue
|
|
* @param key - key of value
|
|
* @param def - default value if is value not finded
|
|
* @return value of key
|
|
*/
|
|
QVariant getValue(const QString &key, const QVariant& def);
|
|
|
|
/**
|
|
* @brief getStrValue some as getValue but work with QString
|
|
*/
|
|
QString getStrValue(const QString &key, const QString& def);
|
|
|
|
public slots:
|
|
/**
|
|
* @brief setValue - set new value of key
|
|
* @param key - key pf settings
|
|
* @param value - new value
|
|
*/
|
|
void setValue(const QString key, const QVariant& value);
|
|
|
|
/**
|
|
* @brief setStrValue - some as setValue< but use QString
|
|
*/
|
|
void setStrValue(const QString& key, const QString& value);
|
|
|
|
|
|
signals:
|
|
void valueChanged(QString key, QVariant value);
|
|
void valueStrChanged(QString key, QString value);
|
|
|
|
};
|
|
} ;
|
|
|
|
|
|
#endif // SETTINGS_H
|