app/headers/appsettings.h
2020-11-05 19:37:13 +01:00

43 lines
1.1 KiB
C++

#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);
// This is the Constructor of the AppSettings class
~AppSettings();
// This is the Destructor of the AppSettings class
private:
QSettings *settingsManager;
// QSettings object which cares about our settings.ini file
QSettings *themeSettingsManager;
// QSettings object which cares about the themes
signals:
void themeChanged();
public slots:
Q_INVOKABLE QString read(const QString &key);
// function to read values from the settings file
Q_INVOKABLE void write(const QString &key, const QVariant &value);
// function to write values to the settings file
Q_INVOKABLE void setDefault(const QString &key, const QVariant &defaultValue);
// function to create a key (/ setting) with a default value if it hasnt been ceated yet
};
#endif // APPSETTINGS_H