- Display torrent files in Web UI

This commit is contained in:
Christophe Dumez 2009-11-24 13:10:17 +00:00
parent 33d77ccf39
commit a9b49ea3e0
52 changed files with 1949 additions and 183 deletions

View file

@ -102,7 +102,7 @@ void HttpConnection::write()
}
QString HttpConnection::translateDocument(QString data) {
std::string contexts[] = {"TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "GUI", "MainWindow", "HttpServer", "confirmDeletionDlg", "TrackerList"};
std::string contexts[] = {"TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "GUI", "MainWindow", "HttpServer", "confirmDeletionDlg", "TrackerList", "TorrentFilesModel"};
int i=0;
bool found = false;
do {
@ -117,7 +117,7 @@ QString HttpConnection::translateDocument(QString data) {
do {
translation = qApp->translate(contexts[context_index].c_str(), word.toLocal8Bit().data(), 0, QCoreApplication::UnicodeUTF8, 1);
++context_index;
}while(translation == word && context_index < 8);
}while(translation == word && context_index < 9);
//qDebug("Translation is %s", translation.toUtf8().data());
data = data.replace(i, regex.matchedLength(), translation);
i += translation.length();
@ -163,11 +163,15 @@ void HttpConnection::respond()
return;
}
if(list[1] == "propertiesTrackers") {
qDebug("Web UI asked for trackers");
QString hash = list[2];
respondTrackersPropertiesJson(hash);
return;
}
if(list[1] == "propertiesFiles") {
QString hash = list[2];
respondFilesPropertiesJson(hash);
return;
}
}
}
if (list[0] == "command")
@ -241,6 +245,15 @@ void HttpConnection::respondTrackersPropertiesJson(QString hash) {
write();
}
void HttpConnection::respondFilesPropertiesJson(QString hash) {
EventManager* manager = parent->eventManager();
QString string = json::toJson(manager->getPropFilesInfo(hash));
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");
generator.setMessage(string);
write();
}
void HttpConnection::respondCommand(QString command)
{