mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-04 10:54:35 +00:00
Revise SettingsStorage store/load value interface
This commit is contained in:
parent
b1020c599f
commit
be5af2796d
@ -214,7 +214,7 @@ const QBtCommandLineParameters &Application::commandLineArgs() const
|
||||
|
||||
bool Application::isFileLoggerEnabled() const
|
||||
{
|
||||
return settings()->loadValue(KEY_FILELOGGER_ENABLED, true).toBool();
|
||||
return settings()->loadValue(KEY_FILELOGGER_ENABLED, true);
|
||||
}
|
||||
|
||||
void Application::setFileLoggerEnabled(const bool value)
|
||||
@ -228,8 +228,8 @@ void Application::setFileLoggerEnabled(const bool value)
|
||||
|
||||
QString Application::fileLoggerPath() const
|
||||
{
|
||||
return settings()->loadValue(KEY_FILELOGGER_PATH,
|
||||
{specialFolderLocation(SpecialFolder::Data) + LOG_FOLDER}).toString();
|
||||
return settings()->loadValue(KEY_FILELOGGER_PATH
|
||||
, QString {specialFolderLocation(SpecialFolder::Data) + LOG_FOLDER});
|
||||
}
|
||||
|
||||
void Application::setFileLoggerPath(const QString &path)
|
||||
@ -241,7 +241,7 @@ void Application::setFileLoggerPath(const QString &path)
|
||||
|
||||
bool Application::isFileLoggerBackup() const
|
||||
{
|
||||
return settings()->loadValue(KEY_FILELOGGER_BACKUP, true).toBool();
|
||||
return settings()->loadValue(KEY_FILELOGGER_BACKUP, true);
|
||||
}
|
||||
|
||||
void Application::setFileLoggerBackup(const bool value)
|
||||
@ -253,7 +253,7 @@ void Application::setFileLoggerBackup(const bool value)
|
||||
|
||||
bool Application::isFileLoggerDeleteOld() const
|
||||
{
|
||||
return settings()->loadValue(KEY_FILELOGGER_DELETEOLD, true).toBool();
|
||||
return settings()->loadValue(KEY_FILELOGGER_DELETEOLD, true);
|
||||
}
|
||||
|
||||
void Application::setFileLoggerDeleteOld(const bool value)
|
||||
@ -265,7 +265,7 @@ void Application::setFileLoggerDeleteOld(const bool value)
|
||||
|
||||
int Application::fileLoggerMaxSize() const
|
||||
{
|
||||
const int val = settings()->loadValue(KEY_FILELOGGER_MAXSIZEBYTES, DEFAULT_FILELOG_SIZE).toInt();
|
||||
const int val = settings()->loadValue(KEY_FILELOGGER_MAXSIZEBYTES, DEFAULT_FILELOG_SIZE);
|
||||
return std::min(std::max(val, MIN_FILELOG_SIZE), MAX_FILELOG_SIZE);
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ void Application::setFileLoggerMaxSize(const int bytes)
|
||||
|
||||
int Application::fileLoggerAge() const
|
||||
{
|
||||
const int val = settings()->loadValue(KEY_FILELOGGER_AGE, 1).toInt();
|
||||
const int val = settings()->loadValue(KEY_FILELOGGER_AGE, 1);
|
||||
return std::min(std::max(val, 1), 365);
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ void Application::setFileLoggerAge(const int value)
|
||||
|
||||
int Application::fileLoggerAgeType() const
|
||||
{
|
||||
const int val = settings()->loadValue(KEY_FILELOGGER_AGETYPE, 1).toInt();
|
||||
const int val = settings()->loadValue(KEY_FILELOGGER_AGETYPE, 1);
|
||||
return ((val < 0) || (val > 2)) ? 1 : val;
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,8 @@ namespace
|
||||
const auto migrate = [](const QString &oldKey, const QString &newKey, const QString &savePath)
|
||||
{
|
||||
SettingsStorage *settingsStorage {SettingsStorage::instance()};
|
||||
const QByteArray oldData {settingsStorage->loadValue(oldKey).toByteArray()};
|
||||
const QString newData {settingsStorage->loadValue(newKey).toString()};
|
||||
const auto oldData {settingsStorage->loadValue<QByteArray>(oldKey)};
|
||||
const auto newData {settingsStorage->loadValue<QString>(newKey)};
|
||||
const QString errorMsgFormat {QObject::tr("Migrate preferences failed: WebUI https, file: \"%1\", error: \"%2\"")};
|
||||
|
||||
if (!newData.isEmpty() || oldData.isEmpty())
|
||||
@ -89,8 +89,8 @@ namespace
|
||||
const QString newKey {QLatin1String {"BitTorrent/Session/TorrentContentLayout"}};
|
||||
|
||||
SettingsStorage *settingsStorage {SettingsStorage::instance()};
|
||||
const QVariant oldData {settingsStorage->loadValue(oldKey)};
|
||||
const QString newData {settingsStorage->loadValue(newKey).toString()};
|
||||
const auto oldData {settingsStorage->loadValue<QVariant>(oldKey)};
|
||||
const auto newData {settingsStorage->loadValue<QString>(newKey)};
|
||||
|
||||
if (!newData.isEmpty() || !oldData.isValid())
|
||||
return;
|
||||
@ -128,7 +128,7 @@ void handleChangedDefaults(const DefaultPreferencesMode mode)
|
||||
SettingsStorage *settingsStorage {SettingsStorage::instance()};
|
||||
for (auto it = changedDefaults.cbegin(); it != changedDefaults.cend(); ++it)
|
||||
{
|
||||
if (settingsStorage->loadValue(it->name).isNull())
|
||||
if (settingsStorage->loadValue<QVariant>(it->name).isNull())
|
||||
settingsStorage->storeValue(it->name, (mode == DefaultPreferencesMode::Legacy ? it->legacy : it->current));
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ const QString KEY_ENABLED = QStringLiteral("Network/PortForwardingEnabled");
|
||||
|
||||
PortForwarderImpl::PortForwarderImpl(lt::session *provider, QObject *parent)
|
||||
: Net::PortForwarder {parent}
|
||||
, m_active {SettingsStorage::instance()->loadValue(KEY_ENABLED, true).toBool()}
|
||||
, m_active {SettingsStorage::instance()->loadValue(KEY_ENABLED, true)}
|
||||
, m_provider {provider}
|
||||
{
|
||||
if (m_active)
|
||||
|
@ -64,15 +64,15 @@ ProxyConfigurationManager *ProxyConfigurationManager::m_instance = nullptr;
|
||||
ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_isProxyOnlyForTorrents = settings()->loadValue(KEY_ONLY_FOR_TORRENTS, false).toBool();
|
||||
m_isProxyOnlyForTorrents = settings()->loadValue(KEY_ONLY_FOR_TORRENTS, false);
|
||||
m_config.type = static_cast<ProxyType>(
|
||||
settings()->loadValue(KEY_TYPE, static_cast<int>(ProxyType::None)).toInt());
|
||||
settings()->loadValue(KEY_TYPE, static_cast<int>(ProxyType::None)));
|
||||
if ((m_config.type < ProxyType::None) || (m_config.type > ProxyType::SOCKS4))
|
||||
m_config.type = ProxyType::None;
|
||||
m_config.ip = settings()->loadValue(KEY_IP, "0.0.0.0").toString();
|
||||
m_config.port = static_cast<ushort>(settings()->loadValue(KEY_PORT, 8080).toUInt());
|
||||
m_config.username = settings()->loadValue(KEY_USERNAME).toString();
|
||||
m_config.password = settings()->loadValue(KEY_PASSWORD).toString();
|
||||
m_config.ip = settings()->loadValue<QString>(KEY_IP, "0.0.0.0");
|
||||
m_config.port = settings()->loadValue<ushort>(KEY_PORT, 8080);
|
||||
m_config.username = settings()->loadValue<QString>(KEY_USERNAME);
|
||||
m_config.password = settings()->loadValue<QString>(KEY_PASSWORD);
|
||||
configureProxy();
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ QString computeSmartFilterRegex(const QStringList &filters)
|
||||
}
|
||||
|
||||
AutoDownloader::AutoDownloader()
|
||||
: m_processingEnabled(SettingsStorage::instance()->loadValue(SettingsKey_ProcessingEnabled, false).toBool())
|
||||
: m_processingEnabled(SettingsStorage::instance()->loadValue(SettingsKey_ProcessingEnabled, false))
|
||||
, m_processingTimer(new QTimer(this))
|
||||
, m_ioThread(new QThread(this))
|
||||
{
|
||||
@ -290,7 +290,7 @@ void AutoDownloader::importRulesFromLegacyFormat(const QByteArray &data)
|
||||
|
||||
QStringList AutoDownloader::smartEpisodeFilters() const
|
||||
{
|
||||
const QVariant filtersSetting = SettingsStorage::instance()->loadValue(SettingsKey_SmartEpisodeFilter);
|
||||
const auto filtersSetting = SettingsStorage::instance()->loadValue<QVariant>(SettingsKey_SmartEpisodeFilter);
|
||||
|
||||
if (filtersSetting.isNull())
|
||||
{
|
||||
@ -323,7 +323,7 @@ void AutoDownloader::setSmartEpisodeFilters(const QStringList &filters)
|
||||
|
||||
bool AutoDownloader::downloadRepacks() const
|
||||
{
|
||||
return SettingsStorage::instance()->loadValue(SettingsKey_DownloadRepacks, true).toBool();
|
||||
return SettingsStorage::instance()->loadValue(SettingsKey_DownloadRepacks, true);
|
||||
}
|
||||
|
||||
void AutoDownloader::setDownloadRepacks(const bool downloadRepacks)
|
||||
|
@ -63,10 +63,10 @@ using namespace RSS;
|
||||
QPointer<Session> Session::m_instance = nullptr;
|
||||
|
||||
Session::Session()
|
||||
: m_processingEnabled(SettingsStorage::instance()->loadValue(SettingsKey_ProcessingEnabled, false).toBool())
|
||||
: m_processingEnabled(SettingsStorage::instance()->loadValue(SettingsKey_ProcessingEnabled, false))
|
||||
, m_workingThread(new QThread(this))
|
||||
, m_refreshInterval(SettingsStorage::instance()->loadValue(SettingsKey_RefreshInterval, 30).toInt())
|
||||
, m_maxArticlesPerFeed(SettingsStorage::instance()->loadValue(SettingsKey_MaxArticlesPerFeed, 50).toInt())
|
||||
, m_refreshInterval(SettingsStorage::instance()->loadValue(SettingsKey_RefreshInterval, 30))
|
||||
, m_maxArticlesPerFeed(SettingsStorage::instance()->loadValue(SettingsKey_MaxArticlesPerFeed, 50))
|
||||
{
|
||||
Q_ASSERT(!m_instance); // only one instance is allowed
|
||||
m_instance = this;
|
||||
@ -362,8 +362,8 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
|
||||
|
||||
void Session::loadLegacy()
|
||||
{
|
||||
const QStringList legacyFeedPaths = SettingsStorage::instance()->loadValue("Rss/streamList").toStringList();
|
||||
const QStringList feedAliases = SettingsStorage::instance()->loadValue("Rss/streamAlias").toStringList();
|
||||
const auto legacyFeedPaths = SettingsStorage::instance()->loadValue<QStringList>("Rss/streamList");
|
||||
const auto feedAliases = SettingsStorage::instance()->loadValue<QStringList>("Rss/streamAlias");
|
||||
if (legacyFeedPaths.size() != feedAliases.size())
|
||||
{
|
||||
Logger::instance()->addMessage("Corrupted RSS list, not loading it.", Log::WARNING);
|
||||
|
@ -153,8 +153,7 @@ namespace
|
||||
SettingsStorage *SettingsStorage::m_instance = nullptr;
|
||||
|
||||
SettingsStorage::SettingsStorage()
|
||||
: m_data{TransactionalSettings(QLatin1String("qBittorrent")).read()}
|
||||
, m_dirty(false)
|
||||
: m_data {TransactionalSettings(QLatin1String("qBittorrent")).read()}
|
||||
{
|
||||
m_timer.setSingleShot(true);
|
||||
m_timer.setInterval(5 * 1000);
|
||||
@ -200,14 +199,14 @@ bool SettingsStorage::save()
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant SettingsStorage::loadValue(const QString &key, const QVariant &defaultValue) const
|
||||
QVariant SettingsStorage::loadValueImpl(const QString &key, const QVariant &defaultValue) const
|
||||
{
|
||||
const QString realKey = mapKey(key);
|
||||
const QReadLocker locker(&m_lock);
|
||||
return m_data.value(realKey, defaultValue);
|
||||
}
|
||||
|
||||
void SettingsStorage::storeValue(const QString &key, const QVariant &value)
|
||||
void SettingsStorage::storeValueImpl(const QString &key, const QVariant &value)
|
||||
{
|
||||
const QString realKey = mapKey(key);
|
||||
const QWriteLocker locker(&m_lock);
|
||||
|
@ -29,11 +29,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <QObject>
|
||||
#include <QReadWriteLock>
|
||||
#include <QTimer>
|
||||
#include <QVariantHash>
|
||||
|
||||
#include "utils/string.h"
|
||||
|
||||
class SettingsStorage : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -45,18 +49,48 @@ public:
|
||||
static void freeInstance();
|
||||
static SettingsStorage *instance();
|
||||
|
||||
QVariant loadValue(const QString &key, const QVariant &defaultValue = {}) const;
|
||||
void storeValue(const QString &key, const QVariant &value);
|
||||
template <typename T>
|
||||
T loadValue(const QString &key, const T &defaultValue = {}) const
|
||||
{
|
||||
if constexpr (std::is_enum_v<T>)
|
||||
{
|
||||
const auto value = loadValueImpl(key).toString();
|
||||
return Utils::String::toEnum(value, defaultValue);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, QVariant>)
|
||||
{
|
||||
return loadValueImpl(key, defaultValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QVariant value = loadValueImpl(key);
|
||||
// check if retrieved value is convertible to T
|
||||
return value.template canConvert<T>() ? value.template value<T>() : defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void storeValue(const QString &key, const T &value)
|
||||
{
|
||||
if constexpr (std::is_enum_v<T>)
|
||||
storeValueImpl(key, Utils::String::fromEnum(value));
|
||||
else
|
||||
storeValueImpl(key, value);
|
||||
}
|
||||
|
||||
void removeValue(const QString &key);
|
||||
|
||||
public slots:
|
||||
bool save();
|
||||
|
||||
private:
|
||||
QVariant loadValueImpl(const QString &key, const QVariant &defaultValue = {}) const;
|
||||
void storeValueImpl(const QString &key, const QVariant &value);
|
||||
|
||||
static SettingsStorage *m_instance;
|
||||
|
||||
bool m_dirty = false;
|
||||
QVariantHash m_data;
|
||||
bool m_dirty;
|
||||
QTimer m_timer;
|
||||
mutable QReadWriteLock m_lock;
|
||||
};
|
||||
|
@ -28,12 +28,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "settingsstorage.h"
|
||||
#include "utils/string.h"
|
||||
|
||||
// This is a thin/handy wrapper over `SettingsStorage`. Use it when store/load value
|
||||
// rarely occurs, otherwise use `CachedSettingValue`.
|
||||
@ -48,17 +45,7 @@ public:
|
||||
|
||||
T get(const T &defaultValue = {}) const
|
||||
{
|
||||
if constexpr (std::is_enum_v<T>)
|
||||
{
|
||||
const auto value = SettingsStorage::instance()->loadValue(m_keyName, {}).toString();
|
||||
return Utils::String::toEnum(value, defaultValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QVariant value = SettingsStorage::instance()->loadValue(m_keyName);
|
||||
// check if retrieved value is convertible to T
|
||||
return value.template canConvert<T>() ? value.template value<T>() : defaultValue;
|
||||
}
|
||||
return SettingsStorage::instance()->loadValue(m_keyName, defaultValue);
|
||||
}
|
||||
|
||||
operator T() const
|
||||
@ -68,10 +55,7 @@ public:
|
||||
|
||||
SettingValue<T> &operator=(const T &value)
|
||||
{
|
||||
if constexpr (std::is_enum_v<T>)
|
||||
SettingsStorage::instance()->storeValue(m_keyName, Utils::String::fromEnum(value));
|
||||
else
|
||||
SettingsStorage::instance()->storeValue(m_keyName, value);
|
||||
SettingsStorage::instance()->storeValue(m_keyName, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
||||
populateSavePathComboBox();
|
||||
connect(m_ui->savePath, &FileSystemPathEdit::selectedPathChanged, this, &AddNewTorrentDialog::onSavePathChanged);
|
||||
|
||||
const bool rememberLastSavePath = settings()->loadValue(KEY_REMEMBERLASTSAVEPATH, false).toBool();
|
||||
const bool rememberLastSavePath = settings()->loadValue(KEY_REMEMBERLASTSAVEPATH, false);
|
||||
m_ui->checkBoxRememberLastSavePath->setChecked(rememberLastSavePath);
|
||||
|
||||
m_ui->contentLayoutComboBox->setCurrentIndex(
|
||||
@ -135,7 +135,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
||||
// Load categories
|
||||
QStringList categories = session->categories().keys();
|
||||
std::sort(categories.begin(), categories.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
|
||||
QString defaultCategory = settings()->loadValue(KEY_DEFAULTCATEGORY).toString();
|
||||
auto defaultCategory = settings()->loadValue<QString>(KEY_DEFAULTCATEGORY);
|
||||
|
||||
if (!m_torrentParams.category.isEmpty())
|
||||
m_ui->categoryComboBox->addItem(m_torrentParams.category);
|
||||
@ -170,7 +170,7 @@ AddNewTorrentDialog::~AddNewTorrentDialog()
|
||||
|
||||
bool AddNewTorrentDialog::isEnabled()
|
||||
{
|
||||
return SettingsStorage::instance()->loadValue(KEY_ENABLED, true).toBool();
|
||||
return SettingsStorage::instance()->loadValue(KEY_ENABLED, true);
|
||||
}
|
||||
|
||||
void AddNewTorrentDialog::setEnabled(bool value)
|
||||
@ -180,7 +180,7 @@ void AddNewTorrentDialog::setEnabled(bool value)
|
||||
|
||||
bool AddNewTorrentDialog::isTopLevel()
|
||||
{
|
||||
return SettingsStorage::instance()->loadValue(KEY_TOPLEVEL, true).toBool();
|
||||
return SettingsStorage::instance()->loadValue(KEY_TOPLEVEL, true);
|
||||
}
|
||||
|
||||
void AddNewTorrentDialog::setTopLevel(bool value)
|
||||
@ -191,7 +191,7 @@ void AddNewTorrentDialog::setTopLevel(bool value)
|
||||
int AddNewTorrentDialog::savePathHistoryLength()
|
||||
{
|
||||
const int defaultHistoryLength = 8;
|
||||
const int value = settings()->loadValue(KEY_SAVEPATHHISTORYLENGTH, defaultHistoryLength).toInt();
|
||||
const int value = settings()->loadValue(KEY_SAVEPATHHISTORYLENGTH, defaultHistoryLength);
|
||||
return qBound(minPathHistoryLength, value, maxPathHistoryLength);
|
||||
}
|
||||
|
||||
@ -204,14 +204,14 @@ void AddNewTorrentDialog::setSavePathHistoryLength(int value)
|
||||
|
||||
settings()->storeValue(KEY_SAVEPATHHISTORYLENGTH, clampedValue);
|
||||
settings()->storeValue(KEY_SAVEPATHHISTORY
|
||||
, QStringList(settings()->loadValue(KEY_SAVEPATHHISTORY).toStringList().mid(0, clampedValue)));
|
||||
, QStringList(settings()->loadValue<QStringList>(KEY_SAVEPATHHISTORY).mid(0, clampedValue)));
|
||||
}
|
||||
|
||||
void AddNewTorrentDialog::loadState()
|
||||
{
|
||||
Utils::Gui::resize(this, m_storeDialogSize);
|
||||
m_ui->splitter->restoreState(m_storeSplitterState);
|
||||
m_headerState = settings()->loadValue(KEY_TREEHEADERSTATE).toByteArray();
|
||||
m_headerState = settings()->loadValue<QByteArray>(KEY_TREEHEADERSTATE);
|
||||
}
|
||||
|
||||
void AddNewTorrentDialog::saveState()
|
||||
@ -371,7 +371,7 @@ void AddNewTorrentDialog::showEvent(QShowEvent *event)
|
||||
void AddNewTorrentDialog::saveSavePathHistory() const
|
||||
{
|
||||
// Get current history
|
||||
QStringList history = settings()->loadValue(KEY_SAVEPATHHISTORY).toStringList();
|
||||
auto history = settings()->loadValue<QStringList>(KEY_SAVEPATHHISTORY);
|
||||
QVector<QDir> historyDirs;
|
||||
for (const QString &path : asConst(history))
|
||||
historyDirs << QDir {path};
|
||||
@ -489,11 +489,11 @@ void AddNewTorrentDialog::populateSavePathComboBox()
|
||||
m_ui->savePath->clear();
|
||||
|
||||
// Load save path history
|
||||
const QStringList savePathHistory {settings()->loadValue(KEY_SAVEPATHHISTORY).toStringList()};
|
||||
const auto savePathHistory {settings()->loadValue<QStringList>(KEY_SAVEPATHHISTORY)};
|
||||
for (const QString &savePath : savePathHistory)
|
||||
m_ui->savePath->addItem(savePath);
|
||||
|
||||
const bool rememberLastSavePath {settings()->loadValue(KEY_REMEMBERLASTSAVEPATH, false).toBool()};
|
||||
const bool rememberLastSavePath {settings()->loadValue(KEY_REMEMBERLASTSAVEPATH, false)};
|
||||
const QString defSavePath {BitTorrent::Session::instance()->defaultSavePath()};
|
||||
|
||||
if (!m_torrentParams.savePath.isEmpty())
|
||||
|
@ -61,9 +61,9 @@ CookiesDialog::CookiesDialog(QWidget *parent)
|
||||
m_cookiesModel->index(0, 0),
|
||||
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
|
||||
Utils::Gui::resize(this, SettingsStorage::instance()->loadValue(KEY_SIZE).toSize());
|
||||
Utils::Gui::resize(this, SettingsStorage::instance()->loadValue<QSize>(KEY_SIZE));
|
||||
m_ui->treeView->header()->restoreState(
|
||||
SettingsStorage::instance()->loadValue(KEY_COOKIESVIEWSTATE).toByteArray());
|
||||
SettingsStorage::instance()->loadValue<QByteArray>(KEY_COOKIESVIEWSTATE));
|
||||
}
|
||||
|
||||
CookiesDialog::~CookiesDialog()
|
||||
|
@ -491,7 +491,7 @@ MainWindow::~MainWindow()
|
||||
|
||||
bool MainWindow::isExecutionLogEnabled() const
|
||||
{
|
||||
return settings()->loadValue(KEY_EXECUTIONLOG_ENABLED, false).toBool();
|
||||
return settings()->loadValue(KEY_EXECUTIONLOG_ENABLED, false);
|
||||
}
|
||||
|
||||
void MainWindow::setExecutionLogEnabled(bool value)
|
||||
@ -503,7 +503,7 @@ int MainWindow::executionLogMsgTypes() const
|
||||
{
|
||||
// as default value we need all the bits set
|
||||
// -1 is considered the portable way to achieve that
|
||||
return settings()->loadValue(KEY_EXECUTIONLOG_TYPES, -1).toInt();
|
||||
return settings()->loadValue(KEY_EXECUTIONLOG_TYPES, -1);
|
||||
}
|
||||
|
||||
void MainWindow::setExecutionLogMsgTypes(const int value)
|
||||
@ -514,7 +514,7 @@ void MainWindow::setExecutionLogMsgTypes(const int value)
|
||||
|
||||
bool MainWindow::isNotificationsEnabled() const
|
||||
{
|
||||
return settings()->loadValue(KEY_NOTIFICATIONS_ENABLED, true).toBool();
|
||||
return settings()->loadValue(KEY_NOTIFICATIONS_ENABLED, true);
|
||||
}
|
||||
|
||||
void MainWindow::setNotificationsEnabled(bool value)
|
||||
@ -524,7 +524,7 @@ void MainWindow::setNotificationsEnabled(bool value)
|
||||
|
||||
bool MainWindow::isTorrentAddedNotificationsEnabled() const
|
||||
{
|
||||
return settings()->loadValue(KEY_NOTIFICATIONS_TORRENTADDED, false).toBool();
|
||||
return settings()->loadValue(KEY_NOTIFICATIONS_TORRENTADDED, false);
|
||||
}
|
||||
|
||||
void MainWindow::setTorrentAddedNotificationsEnabled(bool value)
|
||||
@ -534,7 +534,7 @@ void MainWindow::setTorrentAddedNotificationsEnabled(bool value)
|
||||
|
||||
bool MainWindow::isDownloadTrackerFavicon() const
|
||||
{
|
||||
return settings()->loadValue(KEY_DOWNLOAD_TRACKER_FAVICON, false).toBool();
|
||||
return settings()->loadValue(KEY_DOWNLOAD_TRACKER_FAVICON, false);
|
||||
}
|
||||
|
||||
void MainWindow::setDownloadTrackerFavicon(bool value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user