mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
- Display trackers in torrent properties in Web UI
This commit is contained in:
parent
f04b19ddfa
commit
11a41a1652
10 changed files with 255 additions and 61 deletions
|
@ -102,7 +102,7 @@ void HttpConnection::write()
|
|||
}
|
||||
|
||||
QString HttpConnection::translateDocument(QString data) {
|
||||
std::string contexts[] = {"TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "GUI", "MainWindow", "HttpServer", "confirmDeletionDlg"};
|
||||
std::string contexts[] = {"TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "GUI", "MainWindow", "HttpServer", "confirmDeletionDlg", "TrackerList"};
|
||||
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 < 7);
|
||||
}while(translation == word && context_index < 8);
|
||||
//qDebug("Translation is %s", translation.toUtf8().data());
|
||||
data = data.replace(i, regex.matchedLength(), translation);
|
||||
i += translation.length();
|
||||
|
@ -162,6 +162,12 @@ void HttpConnection::respond()
|
|||
respondGenPropertiesJson(hash);
|
||||
return;
|
||||
}
|
||||
if(list[1] == "propertiesTrackers") {
|
||||
qDebug("Web UI asked for trackers");
|
||||
QString hash = list[2];
|
||||
respondTrackersPropertiesJson(hash);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (list[0] == "command")
|
||||
|
@ -226,6 +232,16 @@ void HttpConnection::respondGenPropertiesJson(QString hash) {
|
|||
write();
|
||||
}
|
||||
|
||||
void HttpConnection::respondTrackersPropertiesJson(QString hash) {
|
||||
EventManager* manager = parent->eventManager();
|
||||
QString string = json::toJson(manager->getPropTrackersInfo(hash));
|
||||
generator.setStatusLine(200, "OK");
|
||||
generator.setContentTypeByExt("js");
|
||||
generator.setMessage(string);
|
||||
write();
|
||||
}
|
||||
|
||||
|
||||
void HttpConnection::respondCommand(QString command)
|
||||
{
|
||||
if(command == "download")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue