mathtrainingstuff/headers/appsettings.h
2018-12-19 20:30:50 +01:00

42 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 our themes
signals:
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 from 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 hasn't been created yet
Q_INVOKABLE QString theme(QString key);
// function to get style settings from a theme file
};
#endif // APPSETTINGS_H