From b5a9fe71e1378706468f0a009874e7a2236ec656 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 29 Dec 2009 20:09:46 +0000 Subject: [PATCH] - Fix JSON communication between qBittorrent and Web UI --- src/eventmanager.cpp | 2 +- src/httpconnection.cpp | 1 + src/webui/preferences_content.html | 56 +++++++++++++++--------------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/eventmanager.cpp b/src/eventmanager.cpp index 6012d16d0..8389893ae 100644 --- a/src/eventmanager.cpp +++ b/src/eventmanager.cpp @@ -354,7 +354,7 @@ void EventManager::modifiedTorrent(QTorrentHandle h) } event["name"] = QVariant(h.name()); event["size"] = QVariant(misc::friendlyUnit(h.actual_size())); - event["progress"] = QVariant(h.progress()); + event["progress"] = QVariant((double)h.progress()); event["dlspeed"] = QVariant(tr("%1/s", "e.g. 120 KiB/s").arg(misc::friendlyUnit(h.download_payload_rate()))); if(BTSession->isQueueingEnabled()) { if(h.queue_position() >= 0) diff --git a/src/httpconnection.cpp b/src/httpconnection.cpp index 316ba4dcd..3f066620f 100644 --- a/src/httpconnection.cpp +++ b/src/httpconnection.cpp @@ -229,6 +229,7 @@ void HttpConnection::respondJson() QString string = json::toJson(manager->getEventList()); generator.setStatusLine(200, "OK"); generator.setContentTypeByExt("js"); + //qDebug("JSON: %s", string.toLocal8Bit().data()); generator.setMessage(string); write(); } diff --git a/src/webui/preferences_content.html b/src/webui/preferences_content.html index 54f897668..165250aed 100644 --- a/src/webui/preferences_content.html +++ b/src/webui/preferences_content.html @@ -148,34 +148,34 @@ _(Language:)