Aufgrund einer Wartung wird GitLab am 29.10. zwischen 9:00 und 10:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 29.10. between 9:00 and 10:00 am.

settings.cpp 1.33 KB
Newer Older
1 2
#include "settings.h"

3
Settings::Settings(QObject *parent) : QObject(parent), settings(OrganisationName, ApplicationName) {
4
    if(localSettingsFile.exists()){
5 6
        localSettings.emplace(localSettingsFile.filePath(),QSettings::IniFormat);
        localSettings->setIniCodec("UTF-8");
7
    }
8 9 10 11
    Modules::Compiler::compilerCmd = value(QStringLiteral("compilerCmd"),Modules::Compiler::compilerCmd).toString();
    Modules::Compiler::compilerFlags = value(QStringLiteral("compilerFlags"),Modules::Compiler::compilerFlags).toString();
    Modules::Compiler::compilerLibraryFlags = value(QStringLiteral("compilerLibraryFlags"),Modules::Compiler::compilerLibraryFlags).toString();
    Modules::Compiler::includePath = value(QStringLiteral("includePath"),Modules::Compiler::includePath).toString();
12
    jsonSettingsFileSavePath = getJsonSettingsFilePath();
13 14
}

15
void Settings::setValue(const QString &key, const QVariant &value){
16 17 18
    if(localSettings){
        if(localSettings->contains(key)){
            localSettings->setValue(key,value);
19 20 21 22 23
        }
    }
    settings.setValue(key,value);
}
QVariant Settings::value(const QString &key, const QVariant &defaultValue) const{
24 25 26
    if(localSettings){
        if(localSettings->contains(key)){
            return localSettings->value(key,defaultValue);
27 28 29 30
        }
    }
    return settings.value(key,defaultValue);
}