mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 06:57:24 -06:00
- Display torrent files in Web UI
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user