From bb683bd39391e2bb1d97f56363eca48cb74fd890 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Thu, 2 Nov 2017 12:14:27 +0300 Subject: [PATCH] Switch built-in Web UI html to HTML5 --- src/base/http/types.h | 14 +++++++---- src/webui/abstractwebapplication.cpp | 6 ++--- src/webui/www/private/index.html | 16 ++++++------- src/webui/www/private/login.html | 6 ++--- src/webui/www/public/about.html | 2 +- src/webui/www/public/addtrackers.html | 8 +++---- src/webui/www/public/confirmdeletion.html | 4 ++-- src/webui/www/public/download.html | 24 +++++++++---------- src/webui/www/public/downloadlimit.html | 4 ++-- src/webui/www/public/filters.html | 18 +++++++------- src/webui/www/public/newcategory.html | 4 ++-- src/webui/www/public/preferences.html | 4 ++-- src/webui/www/public/preferences_content.html | 10 ++++---- src/webui/www/public/properties_content.html | 4 ++-- src/webui/www/public/rename.html | 4 ++-- src/webui/www/public/scripts/client.js | 10 ++++++-- src/webui/www/public/setlocation.html | 4 ++-- src/webui/www/public/upload.html | 18 +++++++------- src/webui/www/public/uploadlimit.html | 4 ++-- 19 files changed, 86 insertions(+), 78 deletions(-) diff --git a/src/base/http/types.h b/src/base/http/types.h index 9c8ea535e..b7d5c9586 100644 --- a/src/base/http/types.h +++ b/src/base/http/types.h @@ -37,6 +37,9 @@ namespace Http { + const char METHOD_GET[] = "GET"; + const char METHOD_POST[] = "POST"; + const char HEADER_CACHE_CONTROL[] = "cache-control"; const char HEADER_CONTENT_ENCODING[] = "content-encoding"; const char HEADER_CONTENT_LENGTH[] = "content-length"; @@ -52,13 +55,14 @@ namespace Http const char HEADER_X_FRAME_OPTIONS[] = "x-frame-options"; const char HEADER_X_XSS_PROTECTION[] = "x-xss-protection"; - const char CONTENT_TYPE_CSS[] = "text/css; charset=UTF-8"; - const char CONTENT_TYPE_GIF[] = "image/gif"; - const char CONTENT_TYPE_HTML[] = "text/html; charset=UTF-8"; - const char CONTENT_TYPE_JS[] = "application/javascript; charset=UTF-8"; + const char CONTENT_TYPE_HTML[] = "text/html"; + const char CONTENT_TYPE_JS[] = "application/javascript"; const char CONTENT_TYPE_JSON[] = "application/json"; + const char CONTENT_TYPE_BMP[] = "image/bmp"; + const char CONTENT_TYPE_GIF[] = "image/gif"; + const char CONTENT_TYPE_JPEG[] = "image/jpeg"; const char CONTENT_TYPE_PNG[] = "image/png"; - const char CONTENT_TYPE_TXT[] = "text/plain; charset=UTF-8"; + const char CONTENT_TYPE_TXT[] = "text/plain"; const char CONTENT_TYPE_SVG[] = "image/svg+xml"; // portability: "\r\n" doesn't guarantee mapping to the correct value diff --git a/src/webui/abstractwebapplication.cpp b/src/webui/abstractwebapplication.cpp index d855bab0f..1be2e73ad 100644 --- a/src/webui/abstractwebapplication.cpp +++ b/src/webui/abstractwebapplication.cpp @@ -225,9 +225,6 @@ bool AbstractWebApplication::readFile(const QString& path, QByteArray &data, QSt QString dataStr = QString::fromUtf8(data.constData()); translateDocument(dataStr); - if (path.endsWith("about.html") || path.endsWith("index.html") || path.endsWith("client.js")) - dataStr.replace("${VERSION}", QBT_VERSION); - data = dataStr.toUtf8(); translatedFiles_[path] = data; // cashing translated file } @@ -296,6 +293,9 @@ void AbstractWebApplication::translateDocument(QString& data) else { found = false; // no more translatable strings } + + data.replace(QLatin1String("${LANG}"), locale.left(2)); + data.replace(QLatin1String("${VERSION}"), QBT_VERSION); } } diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 5741cbed4..9c8d85f32 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -1,8 +1,8 @@ - - + + - + qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog] @@ -50,12 +50,10 @@
  • QBT_TR(&Resume)QBT_TR[CONTEXT=MainWindow]QBT_TR(&Resume)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(&Pause)QBT_TR[CONTEXT=MainWindow]QBT_TR(&Pause)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(&Delete)QBT_TR[CONTEXT=MainWindow]QBT_TR(&Delete)QBT_TR[CONTEXT=MainWindow]
  • - -
  • QBT_TR(Top Priority)QBT_TR[CONTEXT=MainWindow]QBT_TR(Top Priority)QBT_TR[CONTEXT=MainWindow]
  • -
  • QBT_TR(Increase Priority)QBT_TR[CONTEXT=MainWindow]QBT_TR(Increase Priority)QBT_TR[CONTEXT=MainWindow]
  • -
  • QBT_TR(Decrease Priority)QBT_TR[CONTEXT=MainWindow]QBT_TR(Decrease Priority)QBT_TR[CONTEXT=MainWindow]
  • -
  • QBT_TR(Minimum Priority)QBT_TR[CONTEXT=MainWindow]QBT_TR(Minimum Priority)QBT_TR[CONTEXT=MainWindow]
  • -
    +
  • QBT_TR(Top Priority)QBT_TR[CONTEXT=MainWindow]QBT_TR(Top Priority)QBT_TR[CONTEXT=MainWindow]
  • +
  • QBT_TR(Increase Priority)QBT_TR[CONTEXT=MainWindow]QBT_TR(Increase Priority)QBT_TR[CONTEXT=MainWindow]
  • +
  • QBT_TR(Decrease Priority)QBT_TR[CONTEXT=MainWindow]QBT_TR(Decrease Priority)QBT_TR[CONTEXT=MainWindow]
  • +
  • QBT_TR(Minimum Priority)QBT_TR[CONTEXT=MainWindow]QBT_TR(Minimum Priority)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(Force Recheck)QBT_TR[CONTEXT=TransferListWidget]QBT_TR(Force recheck)QBT_TR[CONTEXT=TransferListWidget]
  • diff --git a/src/webui/www/private/login.html b/src/webui/www/private/login.html index 6be455edd..5eb115b5a 100644 --- a/src/webui/www/private/login.html +++ b/src/webui/www/private/login.html @@ -1,5 +1,5 @@ - - + + qBittorrent QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog] @@ -74,7 +74,7 @@ qBittorrent logo
    -
    +


    diff --git a/src/webui/www/public/about.html b/src/webui/www/public/about.html index 84ee00ac9..4d976d6cf 100644 --- a/src/webui/www/public/about.html +++ b/src/webui/www/public/about.html @@ -1,4 +1,4 @@ - +qBittorrent Mascot

    qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]

    QBT_TR(An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar.)QBT_TR[CONTEXT=about]

    Copyright (c) 2011-2018 The qBittorrent project

    diff --git a/src/webui/www/public/addtrackers.html b/src/webui/www/public/addtrackers.html index c2f988571..0d9d958db 100644 --- a/src/webui/www/public/addtrackers.html +++ b/src/webui/www/public/addtrackers.html @@ -1,5 +1,5 @@ - - + + QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDlg] @@ -25,12 +25,12 @@ -
    +

    QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDlg]


    -
    +
    diff --git a/src/webui/www/public/confirmdeletion.html b/src/webui/www/public/confirmdeletion.html index 4640b03aa..420cf6855 100644 --- a/src/webui/www/public/confirmdeletion.html +++ b/src/webui/www/public/confirmdeletion.html @@ -1,5 +1,5 @@ - - + + QBT_TR(Deletion confirmation - qBittorrent)QBT_TR[CONTEXT=confirmDeletionDlg] diff --git a/src/webui/www/public/download.html b/src/webui/www/public/download.html index 267c89253..09c0b10bc 100644 --- a/src/webui/www/public/download.html +++ b/src/webui/www/public/download.html @@ -1,5 +1,5 @@ - - + + QBT_TR(Add Torrent Links)QBT_TR[CONTEXT=downloadFromURL] @@ -11,7 +11,7 @@ -
    +

    QBT_TR(Download Torrents from their URLs or Magnet links)QBT_TR[CONTEXT=HttpServer]

    @@ -27,7 +27,7 @@
    - +
    @@ -40,33 +40,33 @@
    - +
    - -
    +
    - +
    - +
    - +
    - +
    -
    + +