49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#ifndef APPSETTINGS_H
|
|
#define APPSETTINGS_H
|
|
|
|
#include <QObject>
|
|
#include <QtDebug>
|
|
#include <QSettings>
|
|
#include <QStandardPaths>
|
|
|
|
class AppSettings : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(NOTIFY themeChanged)
|
|
|
|
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(QString key);
|
|
// function to read values from the settings file
|
|
|
|
Q_INVOKABLE void write(QString key, 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
|
|
|
|
Q_INVOKABLE QString theme(QString key);
|
|
// function to get style settings from a theme file
|
|
|
|
Q_INVOKABLE void reloadTheme();
|
|
// function to reload the theme and tell all child that it has changed
|
|
};
|
|
|
|
#endif // APPSETTINGS_H
|