mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
- Display torrent files in Web UI
This commit is contained in:
parent
33d77ccf39
commit
a9b49ea3e0
52 changed files with 1949 additions and 183 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue