4
0
mirror of https://github.com/QuasarApp/QuasarAppLib.git synced 2025-04-28 18:54:39 +00:00

42 lines
1.0 KiB
C++
Raw Normal View History

2018-09-29 15:56:04 +03:00
/*
* Copyright (C) 2021-2021 QuasarApp.
2018-09-29 15:56:04 +03:00
* Distributed under the lgplv3 software license, see the accompanying
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
2018-09-29 15:56:04 +03:00
#include "settings.h"
#include <QSettings>
#include <QCoreApplication>
2018-09-29 15:56:04 +03:00
namespace QuasarAppUtils {
2018-09-29 15:56:04 +03:00
Settings::Settings() {
auto name = QCoreApplication::applicationName();
2019-09-27 20:35:37 +03:00
auto company = QCoreApplication::organizationName();
if (name.isEmpty()) {
name = "QuasarAppUtils";
}
2019-09-27 20:35:37 +03:00
if (company.isEmpty()) {
company = "QuasarApp";
}
_settings = new QSettings(QSettings::IniFormat, QSettings::Scope::UserScope, company, name);
2018-09-29 15:56:04 +03:00
}
void Settings::syncImplementation() {
return _settings->sync();
2018-09-29 15:56:04 +03:00
}
QVariant Settings::getValueImplementation(const QString &key, const QVariant &def) {
2018-09-29 15:56:04 +03:00
return _settings->value(key, def);
}
void Settings::setValueImplementation(const QString key, const QVariant &value) {
return _settings->setValue(key, value);
2018-09-29 15:56:04 +03:00
}
}