This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
dasschmalter/DasSchmalterApp/Qt-Code/appsettings.cpp
dorian 6cf67334c5 - cleanup
- fixed bug in AppSettings class
2019-03-16 19:57:03 +01:00

38 lines
1,009 B
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+"/settings.ini", QSettings::IniFormat);
}
QString AppSettings::read(QString key)
{
this->settingsManager->beginGroup("AppSettings");
QString value = this->settingsManager->value(key , false).toString();
this->settingsManager->endGroup();
return(value);
}
void AppSettings::write(QString key, QVariant variant)
{
this->settingsManager->beginGroup("AppSettings");
this->settingsManager->setValue(key , variant);
this->settingsManager->endGroup();
}
AppSettings::~AppSettings()
{
qDebug("+----- AppSettings destruktor -----+");
delete settingsManager;
}