Browse Source

- some more Web Ui fixes

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
a65cd5c39c
  1. 17
      src/eventmanager.cpp
  2. 17
      src/webui/scripts/client.js

17
src/eventmanager.cpp

@ -73,6 +73,12 @@ void EventManager::addedTorrent(QTorrentHandle& h)
event["hash"] = QVariant(hash); event["hash"] = QVariant(hash);
event["name"] = QVariant(h.name()); event["name"] = QVariant(h.name());
event["seed"] = QVariant(h.is_seed()); 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(h.is_paused()) {
if(BTSession->isQueueingEnabled() && (BTSession->isDownloadQueued(hash) || BTSession->isUploadQueued(hash))) if(BTSession->isQueueingEnabled() && (BTSession->isDownloadQueued(hash) || BTSession->isUploadQueued(hash)))
event["state"] = QVariant("queued"); event["state"] = QVariant("queued");
@ -267,6 +273,9 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
if(modify(hash, "state", v)) if(modify(hash, "state", v))
event["state"] = v; event["state"] = v;
v = QVariant(h.name());
if(modify(hash, "name", v))
event["name"] = v;
v = QVariant((qlonglong)h.actual_size()); v = QVariant((qlonglong)h.actual_size());
if(modify(hash, "size", v)) if(modify(hash, "size", v))
event["size"] = v; event["size"] = v;
@ -280,14 +289,8 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
event["dlspeed"] = v; event["dlspeed"] = v;
} }
v = QVariant(h.upload_payload_rate()); v = QVariant(h.upload_payload_rate());
if(modify(hash, "upspeed", v)) { if(modify(hash, "upspeed", v))
event["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()); v = QVariant(h.is_seed());
event["seed"] = v; event["seed"] = v;

17
src/webui/scripts/client.js

@ -88,6 +88,20 @@ window.addEvent('domready', function(){
break; break;
} }
row[1] = event.name; 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) if(event.seed)
myTableUP.insertRow(event.hash, row); myTableUP.insertRow(event.hash, row);
else else
@ -122,6 +136,9 @@ window.addEvent('domready', function(){
break; break;
} }
} }
if($defined(event.name)) {
row[1] = event.name;
}
if($defined(event.size)){ if($defined(event.size)){
row[2] = fsize(event.size); row[2] = fsize(event.size);
} }

Loading…
Cancel
Save