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

39 lines
1,009 B
C++
Raw Normal View History

2019-02-23 21:49:41 +01:00
#include "appsettings.h"
AppSettings * pGlobalAppSettings = nullptr;
AppSettings::AppSettings(QObject* parent)
:QObject(parent)
{
qDebug() << "+ --- AppSettings konstruktor --- +";
2019-02-23 21:49:41 +01:00
pGlobalAppSettings = this;
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
qDebug() << "+ --- Settings Path:" << path << " --- +";
2019-02-23 21:49:41 +01:00
this->settingsManager = new QSettings(path+"/settings.ini", QSettings::IniFormat);
2019-02-23 21:49:41 +01:00
}
QString AppSettings::read(QString key)
2019-02-23 21:49:41 +01:00
{
this->settingsManager->beginGroup("AppSettings");
QString value = this->settingsManager->value(key , false).toString();
this->settingsManager->endGroup();
return(value);
}
void AppSettings::write(QString key, QVariant variant)
2019-02-23 21:49:41 +01:00
{
this->settingsManager->beginGroup("AppSettings");
this->settingsManager->setValue(key , variant);
this->settingsManager->endGroup();
}
AppSettings::~AppSettings()
{
qDebug("+----- AppSettings destruktor -----+");
delete settingsManager;
}