This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/sources/scstwappsettings.cpp

49 lines
1.8 KiB
C++
Raw Normal View History

2020-07-06 15:04:02 +02:00
/*
Speed Climbing Stopwatch - Simple Stopwatch for Climbers
Copyright (C) 2018 Itsblue Development - Dorian Zeder
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "headers/scstwappsettings.h"
ScStwAppSettings * pGlobalAppSettings = nullptr;
ScStwAppSettings::ScStwAppSettings(QObject* parent)
:ScStwSettings(parent)
{
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
this->settingsManager = new QSettings(path+"/settings.ini", QSettings::IniFormat, this);
pGlobalAppSettings = this;
}
QVariant ScStwAppSettings::readSetting(AppInternalSetting key) {
return ScStwSettings::readSetting(QMetaEnum::fromType<AppInternalSetting>().valueToKey(int(key)));
}
bool ScStwAppSettings::writeSetting(AppInternalSetting key, QVariant value) {
return ScStwSettings::writeSetting(QMetaEnum::fromType<AppInternalSetting>().valueToKey(int(key)), value, int(key), 1);
}
void ScStwAppSettings::setDefaultSetting(AppInternalSetting key, QVariant defaultVariant) {
ScStwSettings::setDefaultSetting(QMetaEnum::fromType<AppInternalSetting>().valueToKey(int(key)), defaultVariant, int(key), 1);
}
ScStwAppSettings::~ScStwAppSettings()
{
delete settingsManager;
}