mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #15484 from Chocobo1/perference
Clean up Preferences class
This commit is contained in:
commit
d23935a269
@ -61,12 +61,14 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
QString makeProfileID(const QString &profilePath, const QString &profileName)
|
QString makeProfileID(const QString &profilePath, const QString &profileName)
|
||||||
{
|
{
|
||||||
return profilePath.isEmpty()
|
return profilePath.isEmpty()
|
||||||
? profileName
|
? profileName
|
||||||
: profileName + QLatin1Char('@') + Utils::Fs::toValidFileSystemName(profilePath, false, {});
|
: profileName + QLatin1Char('@') + Utils::Fs::toValidFileSystemName(profilePath, false, {});
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Preferences *Preferences::m_instance = nullptr;
|
Preferences *Preferences::m_instance = nullptr;
|
||||||
@ -90,7 +92,7 @@ void Preferences::freeInstance()
|
|||||||
m_instance = nullptr;
|
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);
|
return SettingsStorage::instance()->loadValue(key, defaultValue);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtContainerFwd>
|
#include <QtContainerFwd>
|
||||||
|
#include <QtGlobal>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include "base/utils/net.h"
|
#include "base/utils/net.h"
|
||||||
@ -80,7 +81,7 @@ class Preferences : public QObject
|
|||||||
|
|
||||||
Preferences();
|
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);
|
void setValue(const QString &key, const QVariant &value);
|
||||||
|
|
||||||
static Preferences *m_instance;
|
static Preferences *m_instance;
|
||||||
|
Loading…
Reference in New Issue
Block a user