From a65cd5c39cf2fc5f64de52060be2a5c0fdf2cf7b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 28 Sep 2008 10:07:00 +0000 Subject: [PATCH] - some more Web Ui fixes --- src/eventmanager.cpp | 17 ++++++++++------- src/webui/scripts/client.js | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/eventmanager.cpp b/src/eventmanager.cpp index 31041b401..c015b5af0 100644 --- a/src/eventmanager.cpp +++ b/src/eventmanager.cpp @@ -73,6 +73,12 @@ void EventManager::addedTorrent(QTorrentHandle& h) event["hash"] = QVariant(hash); event["name"] = QVariant(h.name()); event["seed"] = QVariant(h.is_seed()); + event["size"] = QVariant((qlonglong)h.actual_size()); + if(!h.is_seed()) { + event["progress"] = QVariant(h.progress()); + event["dlspeed"] = QVariant(h.download_payload_rate()); + } + event["upspeed"] = QVariant(h.upload_payload_rate()); if(h.is_paused()) { if(BTSession->isQueueingEnabled() && (BTSession->isDownloadQueued(hash) || BTSession->isUploadQueued(hash))) event["state"] = QVariant("queued"); @@ -267,6 +273,9 @@ void EventManager::modifiedTorrent(QTorrentHandle h) if(modify(hash, "state", v)) event["state"] = v; + v = QVariant(h.name()); + if(modify(hash, "name", v)) + event["name"] = v; v = QVariant((qlonglong)h.actual_size()); if(modify(hash, "size", v)) event["size"] = v; @@ -280,14 +289,8 @@ void EventManager::modifiedTorrent(QTorrentHandle h) event["dlspeed"] = v; } v = QVariant(h.upload_payload_rate()); - if(modify(hash, "upspeed", v)) { + if(modify(hash, "upspeed", v)) event["upspeed"] = v; - if(h.is_seed()) - qDebug("upspeed changed for seed"); - } else { - if(h.is_seed()) - qDebug("upspeed did not change for seed"); - } v = QVariant(h.is_seed()); event["seed"] = v; diff --git a/src/webui/scripts/client.js b/src/webui/scripts/client.js index 0b1ef1ff7..c37f9ba52 100644 --- a/src/webui/scripts/client.js +++ b/src/webui/scripts/client.js @@ -88,6 +88,20 @@ window.addEvent('domready', function(){ break; } row[1] = event.name; + row[2] = fsize(event.size); + if(!event.seed) { + if($defined(event.progress)) + { + row[3] = round1(event.progress*100) + ' %'; + } + if($defined(event.dlspeed)) + row[4] = fspeed(event.dlspeed); + if($defined(event.upspeed)) + row[5] = fspeed(event.upspeed); + } else { + if($defined(event.upspeed)) + row[3] = fspeed(event.upspeed); + } if(event.seed) myTableUP.insertRow(event.hash, row); else @@ -122,6 +136,9 @@ window.addEvent('domready', function(){ break; } } + if($defined(event.name)) { + row[1] = event.name; + } if($defined(event.size)){ row[2] = fsize(event.size); }