- Web UI: Display generation information in torrent properties

This commit is contained in:
Christophe Dumez 2009-11-24 08:53:14 +00:00
parent ce6f665a7b
commit e35d100769
8 changed files with 210 additions and 53 deletions

View file

@ -147,7 +147,7 @@ void HttpConnection::respond()
}
if (list.size() == 0)
list.append("index.html");
if (list.size() == 2)
if (list.size() >= 2)
{
if (list[0] == "json")
{
@ -156,6 +156,14 @@ void HttpConnection::respond()
respondJson();
return;
}
if(list.size() > 2) {
if(list[1] == "propertiesGeneral") {
qDebug("Web UI Asked for general properties data");
QString hash = list[2];
respondGenPropertiesJson(hash);
return;
}
}
}
if (list[0] == "command")
{
@ -210,6 +218,17 @@ void HttpConnection::respondJson()
write();
}
void HttpConnection::respondGenPropertiesJson(QString hash) {
qDebug("Torrent hash is %s", hash.toLocal8Bit().data());
EventManager* manager = parent->eventManager();
QString string = json::toJson(manager->getPropGeneralInfo(hash));
qDebug("GenProperties JSON is %s", string.toLocal8Bit().data());
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");
generator.setMessage(string);
write();
}
void HttpConnection::respondCommand(QString command)
{
if(command == "download")