mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06:00
Replace QVariantMap by QVariantHash
This commit is contained in:
@@ -95,7 +95,7 @@ void AppController::preferencesAction()
|
||||
{
|
||||
const Preferences *const pref = Preferences::instance();
|
||||
const auto *session = BitTorrent::Session::instance();
|
||||
QVariantMap data;
|
||||
QVariantHash data;
|
||||
|
||||
// Downloads
|
||||
// When adding a torrent
|
||||
@@ -116,7 +116,7 @@ void AppController::preferencesAction()
|
||||
data["export_dir_fin"] = Utils::Fs::toNativePath(session->finishedTorrentExportDirectory());
|
||||
// Automatically add torrents from
|
||||
const QVariantHash dirs = pref->getScanDirs();
|
||||
QVariantMap nativeDirs;
|
||||
QVariantHash nativeDirs;
|
||||
for (auto i = dirs.cbegin(); i != dirs.cend(); ++i) {
|
||||
if (i.value().type() == QVariant::Int)
|
||||
nativeDirs.insert(Utils::Fs::toNativePath(i.key()), i.value().toInt());
|
||||
@@ -311,7 +311,7 @@ void AppController::preferencesAction()
|
||||
data["announce_to_all_tiers"] = session->announceToAllTiers();
|
||||
data["announce_ip"] = session->announceIP();
|
||||
|
||||
setResult(QJsonObject::fromVariantMap(data));
|
||||
setResult(QJsonObject::fromVariantHash(data));
|
||||
}
|
||||
|
||||
void AppController::setPreferencesAction()
|
||||
@@ -320,9 +320,9 @@ void AppController::setPreferencesAction()
|
||||
|
||||
Preferences *const pref = Preferences::instance();
|
||||
auto session = BitTorrent::Session::instance();
|
||||
const QVariantMap m = QJsonDocument::fromJson(params()["json"].toUtf8()).toVariant().toMap();
|
||||
const QVariantHash m = QJsonDocument::fromJson(params()["json"].toUtf8()).toVariant().toHash();
|
||||
|
||||
QVariantMap::ConstIterator it;
|
||||
QVariantHash::ConstIterator it;
|
||||
const auto hasKey = [&it, &m](const char *key) -> bool
|
||||
{
|
||||
it = m.find(QLatin1String(key));
|
||||
@@ -364,7 +364,7 @@ void AppController::setPreferencesAction()
|
||||
session->setFinishedTorrentExportDirectory(it.value().toString());
|
||||
// Automatically add torrents from
|
||||
if (hasKey("scan_dirs")) {
|
||||
const QVariantMap nativeDirs = it.value().toMap();
|
||||
const QVariantHash nativeDirs = it.value().toHash();
|
||||
QVariantHash oldScanDirs = pref->getScanDirs();
|
||||
QVariantHash scanDirs;
|
||||
ScanFoldersModel *model = ScanFoldersModel::instance();
|
||||
@@ -648,7 +648,7 @@ void AppController::setPreferencesAction()
|
||||
return (!iface.addressEntries().isEmpty()) && (iface.name() == ifaceValue);
|
||||
});
|
||||
const QString ifaceName = (ifacesIter != ifaces.cend()) ? ifacesIter->humanReadableName() : QString {};
|
||||
|
||||
|
||||
session->setNetworkInterface(ifaceValue);
|
||||
session->setNetworkInterfaceName(ifaceName);
|
||||
}
|
||||
@@ -669,7 +669,7 @@ void AppController::setPreferencesAction()
|
||||
// Resolve peer countries
|
||||
if (hasKey("resolve_peer_countries"))
|
||||
pref->resolvePeerCountries(it.value().toBool());
|
||||
|
||||
|
||||
// libtorrent preferences
|
||||
// Async IO threads
|
||||
if (hasKey("async_io_threads"))
|
||||
@@ -750,7 +750,7 @@ void AppController::networkInterfaceListAction()
|
||||
QVariantList ifaceList;
|
||||
for (const QNetworkInterface &iface : asConst(QNetworkInterface::allInterfaces())) {
|
||||
if (!iface.addressEntries().isEmpty()) {
|
||||
ifaceList.append(QVariantMap {
|
||||
ifaceList.append(QVariantHash {
|
||||
{"name", iface.humanReadableName()},
|
||||
{"value", iface.name()}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user