Merge pull request #9315 from Chocobo1/lupdate

Fix lupdate errors
This commit is contained in:
Mike Tzou 2018-08-13 01:52:40 +08:00 committed by GitHub
commit cced81ddf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 65 deletions

View File

@ -34,7 +34,6 @@
#include <QNetworkAccessManager>
#include <QNetworkCookie>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QTemporaryFile>
#include <QUrl>
@ -46,9 +45,6 @@
namespace
{
QString tr(const char *message);
QString errorCodeToString(QNetworkReply::NetworkError status);
bool saveToFile(const QByteArray &replyData, QString &filePath)
{
QTemporaryFile tmpfile {Utils::Fs::tempPath() + "XXXXXX"};
@ -203,14 +199,7 @@ void Net::DownloadHandler::handleRedirection(QUrl newUrl)
}
}
namespace
{
QString tr(const char *message)
{
return QCoreApplication::translate("DownloadHandler", message);
}
QString errorCodeToString(QNetworkReply::NetworkError status)
QString Net::DownloadHandler::errorCodeToString(const QNetworkReply::NetworkError status)
{
switch (status) {
case QNetworkReply::HostNotFoundError:
@ -259,4 +248,3 @@ namespace
return tr("Unknown error");
}
}
}

View File

@ -30,10 +30,11 @@
#ifndef NET_DOWNLOADHANDLER_H
#define NET_DOWNLOADHANDLER_H
#include <QNetworkReply>
#include <QObject>
#include "downloadmanager.h"
class QNetworkReply;
class QUrl;
namespace Net
@ -68,6 +69,8 @@ namespace Net
void assignNetworkReply(QNetworkReply *reply);
void handleRedirection(QUrl newUrl);
static QString errorCodeToString(QNetworkReply::NetworkError status);
QNetworkReply *m_reply;
DownloadManager *m_manager;
const DownloadRequest m_downloadRequest;

View File

@ -1,5 +1,10 @@
TRANSLATIONS += $$files(qbittorrent_*.ts)
TS_IN_NOEXT = $$replace(TRANSLATIONS,".ts","")
TS_FILES += $$files(qbittorrent_*.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) {
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
@ -14,8 +19,9 @@ isEmpty(QMAKE_LRELEASE) {
}
message("Building translations")
for(L,TS_IN_NOEXT) {
message("Processing $${L}")
system("$$QMAKE_LRELEASE -silent $${L}.ts -qm $${L}.qm")
!exists("$${L}.qm"):error("Building translations failed, cannot continue")
TS_FILES_NOEXT = $$replace(TS_FILES, ".ts", "")
for(file, TS_FILES_NOEXT) {
message("Processing $${file}")
system("$$QMAKE_LRELEASE -silent $${file}.ts -qm $${file}.qm")
!exists("$${file}.qm"):error("Building translations failed, cannot continue")
}