mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Fix lupdate errors
I suspect lupdate isn't smart enough to figure out what tr() is suppose to do, so just make it a static function in class. The error was: tr() cannot be called without context
This commit is contained in:
parent
d9461f348f
commit
6f2b1823ad
2 changed files with 50 additions and 59 deletions
|
@ -34,7 +34,6 @@
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkCookie>
|
#include <QNetworkCookie>
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
@ -46,9 +45,6 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
QString tr(const char *message);
|
|
||||||
QString errorCodeToString(QNetworkReply::NetworkError status);
|
|
||||||
|
|
||||||
bool saveToFile(const QByteArray &replyData, QString &filePath)
|
bool saveToFile(const QByteArray &replyData, QString &filePath)
|
||||||
{
|
{
|
||||||
QTemporaryFile tmpfile {Utils::Fs::tempPath() + "XXXXXX"};
|
QTemporaryFile tmpfile {Utils::Fs::tempPath() + "XXXXXX"};
|
||||||
|
@ -203,60 +199,52 @@ void Net::DownloadHandler::handleRedirection(QUrl newUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
QString Net::DownloadHandler::errorCodeToString(const QNetworkReply::NetworkError status)
|
||||||
{
|
{
|
||||||
QString tr(const char *message)
|
switch (status) {
|
||||||
{
|
case QNetworkReply::HostNotFoundError:
|
||||||
return QCoreApplication::translate("DownloadHandler", message);
|
return tr("The remote host name was not found (invalid hostname)");
|
||||||
}
|
case QNetworkReply::OperationCanceledError:
|
||||||
|
return tr("The operation was canceled");
|
||||||
QString errorCodeToString(QNetworkReply::NetworkError status)
|
case QNetworkReply::RemoteHostClosedError:
|
||||||
{
|
return tr("The remote server closed the connection prematurely, before the entire reply was received and processed");
|
||||||
switch (status) {
|
case QNetworkReply::TimeoutError:
|
||||||
case QNetworkReply::HostNotFoundError:
|
return tr("The connection to the remote server timed out");
|
||||||
return tr("The remote host name was not found (invalid hostname)");
|
case QNetworkReply::SslHandshakeFailedError:
|
||||||
case QNetworkReply::OperationCanceledError:
|
return tr("SSL/TLS handshake failed");
|
||||||
return tr("The operation was canceled");
|
case QNetworkReply::ConnectionRefusedError:
|
||||||
case QNetworkReply::RemoteHostClosedError:
|
return tr("The remote server refused the connection");
|
||||||
return tr("The remote server closed the connection prematurely, before the entire reply was received and processed");
|
case QNetworkReply::ProxyConnectionRefusedError:
|
||||||
case QNetworkReply::TimeoutError:
|
return tr("The connection to the proxy server was refused");
|
||||||
return tr("The connection to the remote server timed out");
|
case QNetworkReply::ProxyConnectionClosedError:
|
||||||
case QNetworkReply::SslHandshakeFailedError:
|
return tr("The proxy server closed the connection prematurely");
|
||||||
return tr("SSL/TLS handshake failed");
|
case QNetworkReply::ProxyNotFoundError:
|
||||||
case QNetworkReply::ConnectionRefusedError:
|
return tr("The proxy host name was not found");
|
||||||
return tr("The remote server refused the connection");
|
case QNetworkReply::ProxyTimeoutError:
|
||||||
case QNetworkReply::ProxyConnectionRefusedError:
|
return tr("The connection to the proxy timed out or the proxy did not reply in time to the request sent");
|
||||||
return tr("The connection to the proxy server was refused");
|
case QNetworkReply::ProxyAuthenticationRequiredError:
|
||||||
case QNetworkReply::ProxyConnectionClosedError:
|
return tr("The proxy requires authentication in order to honor the request but did not accept any credentials offered");
|
||||||
return tr("The proxy server closed the connection prematurely");
|
case QNetworkReply::ContentAccessDenied:
|
||||||
case QNetworkReply::ProxyNotFoundError:
|
return tr("The access to the remote content was denied (401)");
|
||||||
return tr("The proxy host name was not found");
|
case QNetworkReply::ContentOperationNotPermittedError:
|
||||||
case QNetworkReply::ProxyTimeoutError:
|
return tr("The operation requested on the remote content is not permitted");
|
||||||
return tr("The connection to the proxy timed out or the proxy did not reply in time to the request sent");
|
case QNetworkReply::ContentNotFoundError:
|
||||||
case QNetworkReply::ProxyAuthenticationRequiredError:
|
return tr("The remote content was not found at the server (404)");
|
||||||
return tr("The proxy requires authentication in order to honor the request but did not accept any credentials offered");
|
case QNetworkReply::AuthenticationRequiredError:
|
||||||
case QNetworkReply::ContentAccessDenied:
|
return tr("The remote server requires authentication to serve the content but the credentials provided were not accepted");
|
||||||
return tr("The access to the remote content was denied (401)");
|
case QNetworkReply::ProtocolUnknownError:
|
||||||
case QNetworkReply::ContentOperationNotPermittedError:
|
return tr("The Network Access API cannot honor the request because the protocol is not known");
|
||||||
return tr("The operation requested on the remote content is not permitted");
|
case QNetworkReply::ProtocolInvalidOperationError:
|
||||||
case QNetworkReply::ContentNotFoundError:
|
return tr("The requested operation is invalid for this protocol");
|
||||||
return tr("The remote content was not found at the server (404)");
|
case QNetworkReply::UnknownNetworkError:
|
||||||
case QNetworkReply::AuthenticationRequiredError:
|
return tr("An unknown network-related error was detected");
|
||||||
return tr("The remote server requires authentication to serve the content but the credentials provided were not accepted");
|
case QNetworkReply::UnknownProxyError:
|
||||||
case QNetworkReply::ProtocolUnknownError:
|
return tr("An unknown proxy-related error was detected");
|
||||||
return tr("The Network Access API cannot honor the request because the protocol is not known");
|
case QNetworkReply::UnknownContentError:
|
||||||
case QNetworkReply::ProtocolInvalidOperationError:
|
return tr("An unknown error related to the remote content was detected");
|
||||||
return tr("The requested operation is invalid for this protocol");
|
case QNetworkReply::ProtocolFailure:
|
||||||
case QNetworkReply::UnknownNetworkError:
|
return tr("A breakdown in protocol was detected");
|
||||||
return tr("An unknown network-related error was detected");
|
default:
|
||||||
case QNetworkReply::UnknownProxyError:
|
return tr("Unknown error");
|
||||||
return tr("An unknown proxy-related error was detected");
|
|
||||||
case QNetworkReply::UnknownContentError:
|
|
||||||
return tr("An unknown error related to the remote content was detected");
|
|
||||||
case QNetworkReply::ProtocolFailure:
|
|
||||||
return tr("A breakdown in protocol was detected");
|
|
||||||
default:
|
|
||||||
return tr("Unknown error");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,11 @@
|
||||||
#ifndef NET_DOWNLOADHANDLER_H
|
#ifndef NET_DOWNLOADHANDLER_H
|
||||||
#define NET_DOWNLOADHANDLER_H
|
#define NET_DOWNLOADHANDLER_H
|
||||||
|
|
||||||
|
#include <QNetworkReply>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "downloadmanager.h"
|
#include "downloadmanager.h"
|
||||||
|
|
||||||
class QNetworkReply;
|
|
||||||
class QUrl;
|
class QUrl;
|
||||||
|
|
||||||
namespace Net
|
namespace Net
|
||||||
|
@ -68,6 +69,8 @@ namespace Net
|
||||||
void assignNetworkReply(QNetworkReply *reply);
|
void assignNetworkReply(QNetworkReply *reply);
|
||||||
void handleRedirection(QUrl newUrl);
|
void handleRedirection(QUrl newUrl);
|
||||||
|
|
||||||
|
static QString errorCodeToString(QNetworkReply::NetworkError status);
|
||||||
|
|
||||||
QNetworkReply *m_reply;
|
QNetworkReply *m_reply;
|
||||||
DownloadManager *m_manager;
|
DownloadManager *m_manager;
|
||||||
const DownloadRequest m_downloadRequest;
|
const DownloadRequest m_downloadRequest;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue