Browse Source

WebUI: Convert torrent list from QVariantHash to QVariantMap

Currently QJsonDocument::fromVariant() does not support QVariantHash,
so convert the torrent list to QVariantMap.

Closes #2849.
adaptive-webui-19844
Gabriele 10 years ago
parent
commit
fff1436e26
  1. 11
      src/webui/btjson.cpp

11
src/webui/btjson.cpp

@ -736,6 +736,17 @@ QVariantMap generateSyncData(int acceptedResponseId, QVariantMap data, QVariantM @@ -736,6 +736,17 @@ QVariantMap generateSyncData(int acceptedResponseId, QVariantMap data, QVariantM
if (fullUpdate) {
lastAcceptedData.clear();
syncData = data;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && QT_VERSION < QT_VERSION_CHECK(5, 5, 0))
// QJsonDocument::fromVariant() supports QVariantHash only
// since Qt5.5, so manually convert data["torrents"]
QVariantMap torrentsMap;
QVariantHash torrents = data["torrents"].toHash();
foreach (const QString &key, torrents.keys())
torrentsMap[key] = torrents[key];
syncData["torrents"] = torrentsMap;
#endif
syncData[KEY_FULL_UPDATE] = true;
}

Loading…
Cancel
Save