41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
|
#include "appsettings.h"
|
||
|
|
||
|
AppSettings * pGlobalAppSettings = nullptr;
|
||
|
|
||
|
AppSettings::AppSettings(QObject* parent)
|
||
|
:QObject(parent)
|
||
|
{
|
||
|
qDebug() << "+----- AppSettings konstruktor -----+";
|
||
|
|
||
|
pGlobalAppSettings = this;
|
||
|
|
||
|
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||
|
qDebug() << "+----- Settings Path:" << path << " -----+";
|
||
|
|
||
|
this->settingsManager = new QSettings(path+"/fannyapp/settings.ini", QSettings::IniFormat);
|
||
|
|
||
|
this->filtersFile = new QFile(path + "/fannyapp/filters.json");
|
||
|
}
|
||
|
|
||
|
QString AppSettings::loadSetting(const QString &key)
|
||
|
{
|
||
|
this->settingsManager->beginGroup("AppSettings");
|
||
|
QString value = this->settingsManager->value(key , false).toString();
|
||
|
this->settingsManager->endGroup();
|
||
|
return(value);
|
||
|
}
|
||
|
|
||
|
void AppSettings::writeSetting(const QString &key, const QVariant &variant)
|
||
|
{
|
||
|
this->settingsManager->beginGroup("AppSettings");
|
||
|
this->settingsManager->setValue(key , variant);
|
||
|
this->settingsManager->endGroup();
|
||
|
}
|
||
|
|
||
|
AppSettings::~AppSettings()
|
||
|
{
|
||
|
qDebug("+----- AppSettings destruktor -----+");
|
||
|
delete settingsManager;
|
||
|
}
|
||
|
|