Merge pull request #15484 from Chocobo1/perference

Clean up Preferences class
This commit is contained in:
Chocobo1 2021-09-23 12:38:12 +08:00 committed by GitHub
commit d23935a269
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -61,12 +61,14 @@
namespace
{
#ifdef Q_OS_WIN
QString makeProfileID(const QString &profilePath, const QString &profileName)
{
return profilePath.isEmpty()
? profileName
: profileName + QLatin1Char('@') + Utils::Fs::toValidFileSystemName(profilePath, false, {});
}
#endif
}
Preferences *Preferences::m_instance = nullptr;
@ -90,7 +92,7 @@ void Preferences::freeInstance()
m_instance = nullptr;
}
const QVariant Preferences::value(const QString &key, const QVariant &defaultValue) const
QVariant Preferences::value(const QString &key, const QVariant &defaultValue) const
{
return SettingsStorage::instance()->loadValue(key, defaultValue);
}

View file

@ -30,6 +30,7 @@
#pragma once
#include <QtContainerFwd>
#include <QtGlobal>
#include <QVariant>
#include "base/utils/net.h"
@ -80,7 +81,7 @@ class Preferences : public QObject
Preferences();
const QVariant value(const QString &key, const QVariant &defaultValue = {}) const;
QVariant value(const QString &key, const QVariant &defaultValue = {}) const;
void setValue(const QString &key, const QVariant &value);
static Preferences *m_instance;