mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
commit
cced81ddf0
@ -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,15 +199,8 @@ void Net::DownloadHandler::handleRedirection(QUrl newUrl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
QString Net::DownloadHandler::errorCodeToString(const QNetworkReply::NetworkError status)
|
||||||
{
|
{
|
||||||
QString tr(const char *message)
|
|
||||||
{
|
|
||||||
return QCoreApplication::translate("DownloadHandler", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString errorCodeToString(QNetworkReply::NetworkError status)
|
|
||||||
{
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case QNetworkReply::HostNotFoundError:
|
case QNetworkReply::HostNotFoundError:
|
||||||
return tr("The remote host name was not found (invalid hostname)");
|
return tr("The remote host name was not found (invalid hostname)");
|
||||||
@ -258,5 +247,4 @@ namespace
|
|||||||
default:
|
default:
|
||||||
return tr("Unknown error");
|
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;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
TRANSLATIONS += $$files(qbittorrent_*.ts)
|
TS_FILES += $$files(qbittorrent_*.ts)
|
||||||
TS_IN_NOEXT = $$replace(TRANSLATIONS,".ts","")
|
|
||||||
|
# need to use full path, otherwise running
|
||||||
|
# `lupdate` will generate *.ts files in project root directory
|
||||||
|
for(file, TS_FILES) {
|
||||||
|
TRANSLATIONS += "$${PWD}/$${file}"
|
||||||
|
}
|
||||||
|
|
||||||
isEmpty(QMAKE_LRELEASE) {
|
isEmpty(QMAKE_LRELEASE) {
|
||||||
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
|
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
|
||||||
@ -14,8 +19,9 @@ isEmpty(QMAKE_LRELEASE) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message("Building translations")
|
message("Building translations")
|
||||||
for(L,TS_IN_NOEXT) {
|
TS_FILES_NOEXT = $$replace(TS_FILES, ".ts", "")
|
||||||
message("Processing $${L}")
|
for(file, TS_FILES_NOEXT) {
|
||||||
system("$$QMAKE_LRELEASE -silent $${L}.ts -qm $${L}.qm")
|
message("Processing $${file}")
|
||||||
!exists("$${L}.qm"):error("Building translations failed, cannot continue")
|
system("$$QMAKE_LRELEASE -silent $${file}.ts -qm $${file}.qm")
|
||||||
|
!exists("$${file}.qm"):error("Building translations failed, cannot continue")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user