2019-06-23 10:55:08 +02:00
|
|
|
#ifndef APPSETTINGS_H
|
|
|
|
#define APPSETTINGS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QtDebug>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QStandardPaths>
|
|
|
|
|
|
|
|
class AppSettings : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit AppSettings(QObject *parent = nullptr);
|
2021-06-05 21:18:21 +02:00
|
|
|
// This is the Constructor of the AppSettings class
|
2019-06-23 10:55:08 +02:00
|
|
|
|
|
|
|
~AppSettings();
|
2021-06-05 21:18:21 +02:00
|
|
|
// This is the Destructor of the AppSettings class
|
2019-06-23 10:55:08 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
QSettings *settingsManager;
|
2021-06-05 21:18:21 +02:00
|
|
|
// QSettings object which cares about our settings.ini file
|
2019-06-23 10:55:08 +02:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
Q_INVOKABLE QString read(const QString &key);
|
2021-06-05 21:18:21 +02:00
|
|
|
// function to read values from the settings file
|
2019-06-23 10:55:08 +02:00
|
|
|
|
|
|
|
Q_INVOKABLE void write(const QString &key, const QVariant &value);
|
2021-06-05 21:18:21 +02:00
|
|
|
// function to write values to the settings file
|
2019-06-23 10:55:08 +02:00
|
|
|
|
|
|
|
Q_INVOKABLE void setDefault(const QString &key, const QVariant &defaultValue);
|
2021-06-05 21:18:21 +02:00
|
|
|
// function to create a key (/ setting) with a default value if it hasnt been ceated yet
|
2019-06-23 10:55:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // APPSETTINGS_H
|