diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index 582371c5a..89b21217b 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -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()} }); diff --git a/src/webui/api/logcontroller.cpp b/src/webui/api/logcontroller.cpp index b512941ec..9637e788c 100644 --- a/src/webui/api/logcontroller.cpp +++ b/src/webui/api/logcontroller.cpp @@ -79,7 +79,7 @@ void LogController::mainAction() || (msg.type == Log::CRITICAL && isCritical))) continue; - msgList.append(QVariantMap { + msgList.append(QVariantHash { {KEY_LOG_ID, msg.id}, {KEY_LOG_TIMESTAMP, msg.timestamp}, {KEY_LOG_MSG_TYPE, msg.type}, @@ -113,7 +113,7 @@ void LogController::peersAction() QVariantList peerList; for (const Log::Peer &peer : asConst(logger->getPeers(lastKnownId))) { - peerList.append(QVariantMap { + peerList.append(QVariantHash { {KEY_LOG_ID, peer.id}, {KEY_LOG_TIMESTAMP, peer.timestamp}, {KEY_LOG_PEER_IP, peer.ip}, diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 741687833..bb4ec9ea4 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -161,7 +161,7 @@ namespace const QString privateMsg {QCoreApplication::translate("TrackerListWidget", "This torrent is private")}; const bool isTorrentPrivate = torrent->isPrivate(); - const QVariantMap dht { + const QVariantHash dht { {KEY_TRACKER_URL, "** [DHT] **"}, {KEY_TRACKER_TIER, ""}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, @@ -172,7 +172,7 @@ namespace {KEY_TRACKER_LEECHES_COUNT, leechesDHT} }; - const QVariantMap pex { + const QVariantHash pex { {KEY_TRACKER_URL, "** [PeX] **"}, {KEY_TRACKER_TIER, ""}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, @@ -183,7 +183,7 @@ namespace {KEY_TRACKER_LEECHES_COUNT, leechesPeX} }; - const QVariantMap lsd { + const QVariantHash lsd { {KEY_TRACKER_URL, "** [LSD] **"}, {KEY_TRACKER_TIER, ""}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, @@ -309,7 +309,7 @@ void TorrentsController::propertiesAction() checkParams({"hash"}); const QString hash {params()["hash"]}; - QVariantMap dataDict; + QVariantHash dataDict; BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); if (!torrent) throw APIError(APIErrorType::NotFound); @@ -358,7 +358,7 @@ void TorrentsController::propertiesAction() dataDict[KEY_PROP_SAVE_PATH] = Utils::Fs::toNativePath(torrent->savePath()); dataDict[KEY_PROP_COMMENT] = torrent->comment(); - setResult(QJsonObject::fromVariantMap(dataDict)); + setResult(QJsonObject::fromVariantHash(dataDict)); } // Returns the trackers for a torrent in JSON format. @@ -387,7 +387,7 @@ void TorrentsController::trackersAction() for (const BitTorrent::TrackerEntry &tracker : asConst(torrent->trackers())) { const BitTorrent::TrackerInfo data = trackersData.value(tracker.url()); - trackerList << QVariantMap { + trackerList << QVariantHash { {KEY_TRACKER_URL, tracker.url()}, {KEY_TRACKER_TIER, tracker.tier()}, {KEY_TRACKER_STATUS, static_cast(tracker.status())}, @@ -417,7 +417,7 @@ void TorrentsController::webseedsAction() throw APIError(APIErrorType::NotFound); for (const QUrl &webseed : asConst(torrent->urlSeeds())) { - webSeedList.append(QVariantMap { + webSeedList.append(QVariantHash { {KEY_WEBSEED_URL, webseed.toString()} }); } @@ -451,7 +451,7 @@ void TorrentsController::filesAction() const QVector fileAvailability = torrent->availableFileFractions(); const BitTorrent::TorrentInfo info = torrent->info(); for (int i = 0; i < torrent->filesCount(); ++i) { - QVariantMap fileDict = { + QVariantHash fileDict = { {KEY_FILE_PROGRESS, fp[i]}, {KEY_FILE_PRIORITY, static_cast(priorities[i])}, {KEY_FILE_SIZE, torrent->fileSize(i)}, @@ -743,7 +743,7 @@ void TorrentsController::uploadLimitAction() checkParams({"hashes"}); const QStringList hashes {params()["hashes"].split('|')}; - QVariantMap map; + QVariantHash map; for (const QString &hash : hashes) { int limit = -1; const BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); @@ -752,7 +752,7 @@ void TorrentsController::uploadLimitAction() map[hash] = limit; } - setResult(QJsonObject::fromVariantMap(map)); + setResult(QJsonObject::fromVariantHash(map)); } void TorrentsController::downloadLimitAction() @@ -760,7 +760,7 @@ void TorrentsController::downloadLimitAction() checkParams({"hashes"}); const QStringList hashes {params()["hashes"].split('|')}; - QVariantMap map; + QVariantHash map; for (const QString &hash : hashes) { int limit = -1; const BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); @@ -769,7 +769,7 @@ void TorrentsController::downloadLimitAction() map[hash] = limit; } - setResult(QJsonObject::fromVariantMap(map)); + setResult(QJsonObject::fromVariantHash(map)); } void TorrentsController::setUploadLimitAction()