diff --git a/src/webui/www/private/css/style.css b/src/webui/www/private/css/style.css index 4962a1667..3540cae2d 100644 --- a/src/webui/www/private/css/style.css +++ b/src/webui/www/private/css/style.css @@ -418,50 +418,10 @@ a.propButton img { /* Sliders */ .slider { - clear: both; font-size: 12px; font-weight: bold; - margin-bottom: 15px; + margin: 4px; position: relative; - width: 400px; -} - -.sliderWrapper { - font-size: 1px; - height: 9px; - line-height: 1px; - position: relative; - width: 422px; -} - -.sliderarea { - background: #f2f2f2 url("../images/slider-area.gif") repeat-x; - border: 1px solid #a3a3a3; - border-bottom: 1px solid #cccccc; - border-left: 1px solid #cccccc; - font-size: 1px; - height: 7px; - left: 0; - line-height: 1px; - overflow: hidden; - padding: 0; - position: absolute; - top: 0; - width: 420px; -} - -.sliderknob { - background: url("../images/knob.gif") no-repeat; - cursor: pointer; - font-size: 1px; - height: 9px; - left: 0; - line-height: 1px; - overflow: hidden; - position: absolute; - top: 0; - width: 19px; - z-index: 2; } .update { diff --git a/src/webui/www/private/downloadlimit.html b/src/webui/www/private/downloadlimit.html deleted file mode 100644 index 4b313ed83..000000000 --- a/src/webui/www/private/downloadlimit.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget] - - - - - - - - - - -
-
-
- - - QBT_TR(KiB/s)QBT_TR[CONTEXT=SpeedLimitDialog] -
-
-
-
-
-
-
- -
- - - - - diff --git a/src/webui/www/private/images/knob.gif b/src/webui/www/private/images/knob.gif deleted file mode 100644 index 755e06e0d..000000000 Binary files a/src/webui/www/private/images/knob.gif and /dev/null differ diff --git a/src/webui/www/private/images/slider-area.gif b/src/webui/www/private/images/slider-area.gif deleted file mode 100644 index f22edcdfd..000000000 Binary files a/src/webui/www/private/images/slider-area.gif and /dev/null differ diff --git a/src/webui/www/private/scripts/mocha-init.js b/src/webui/www/private/scripts/mocha-init.js index 314d84d22..e7473071f 100644 --- a/src/webui/www/private/scripts/mocha-init.js +++ b/src/webui/www/private/scripts/mocha-init.js @@ -309,9 +309,10 @@ const initializeWindows = () => { }); globalUploadLimitFN = () => { - const contentURL = new URL("uploadlimit.html", window.location); + const contentURL = new URL("speedlimit.html", window.location); contentURL.search = new URLSearchParams({ - hashes: "global" + hashes: "global", + type: "upload", }); new MochaUI.Window({ id: "uploadLimitPage", @@ -334,9 +335,10 @@ const initializeWindows = () => { if (hashes.length <= 0) return; - const contentURL = new URL("uploadlimit.html", window.location); + const contentURL = new URL("speedlimit.html", window.location); contentURL.search = new URLSearchParams({ - hashes: hashes.join("|") + hashes: hashes.join("|"), + type: "upload", }); new MochaUI.Window({ id: "uploadLimitPage", @@ -455,9 +457,10 @@ const initializeWindows = () => { }; globalDownloadLimitFN = () => { - const contentURL = new URL("downloadlimit.html", window.location); + const contentURL = new URL("speedlimit.html", window.location); contentURL.search = new URLSearchParams({ - hashes: "global" + hashes: "global", + type: "download", }); new MochaUI.Window({ id: "downloadLimitPage", @@ -498,9 +501,10 @@ const initializeWindows = () => { if (hashes.length <= 0) return; - const contentURL = new URL("downloadlimit.html", window.location); + const contentURL = new URL("speedlimit.html", window.location); contentURL.search = new URLSearchParams({ - hashes: hashes.join("|") + hashes: hashes.join("|"), + type: "download", }); new MochaUI.Window({ id: "downloadLimitPage", diff --git a/src/webui/www/private/scripts/speedslider.js b/src/webui/www/private/scripts/speedslider.js deleted file mode 100644 index f2c96f66a..000000000 --- a/src/webui/www/private/scripts/speedslider.js +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2019 Thomas Piccirello - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, the copyright holders give permission to - * link this program with the OpenSSL project's "OpenSSL" library (or with - * modified versions of it that use the same license as the "OpenSSL" library), - * and distribute the linked executables. You must obey the GNU General Public - * License in all respects for all of the code used other than "OpenSSL". If you - * modify file(s), you may extend this exception to your version of the file(s), - * but you are not obligated to do so. If you do not wish to do so, delete this - * exception statement from your version. - */ - -"use strict"; - -MochaUI.extend({ - addUpLimitSlider: (hashes) => { - if (document.getElementById("uplimitSliderarea")) { - // Get global upload limit - fetch("api/v2/transfer/uploadLimit", { - method: "GET", - cache: "no-store" - }) - .then(async (response) => { - if (!response.ok) - return; - - const data = await response.text(); - - let maximum = 500; - const tmp = Number(data); - if (tmp > 0) { - maximum = tmp / 1024.0; - } - else { - if (hashes[0] === "global") - maximum = 10000; - else - maximum = 1000; - } - - // Get torrents upload limit - // And create slider - if (hashes[0] === "global") { - let up_limit = maximum; - if (up_limit < 0) - up_limit = 0; - maximum = 10000; - new Slider(document.getElementById("uplimitSliderarea"), document.getElementById("uplimitSliderknob"), { - steps: maximum, - offset: 0, - initialStep: Math.round(up_limit), - onChange: (pos) => { - if (pos > 0) { - document.getElementById("uplimitUpdatevalue").value = pos; - document.getElementById("upLimitUnit").style.visibility = "visible"; - } - else { - document.getElementById("uplimitUpdatevalue").value = "∞"; - document.getElementById("upLimitUnit").style.visibility = "hidden"; - } - } - }); - // Set default value - if (up_limit === 0) { - document.getElementById("uplimitUpdatevalue").value = "∞"; - document.getElementById("upLimitUnit").style.visibility = "hidden"; - } - else { - document.getElementById("uplimitUpdatevalue").value = Math.round(up_limit); - document.getElementById("upLimitUnit").style.visibility = "visible"; - } - } - else { - fetch("api/v2/torrents/uploadLimit", { - method: "POST", - body: new URLSearchParams({ - hashes: hashes.join("|") - }) - }) - .then(async (response) => { - if (!response.ok) - return; - - const data = await response.json(); - - let up_limit = data[hashes[0]]; - for (const key in data) { - if (up_limit !== data[key]) { - up_limit = 0; - break; - } - } - if (up_limit < 0) - up_limit = 0; - new Slider(document.getElementById("uplimitSliderarea"), document.getElementById("uplimitSliderknob"), { - steps: maximum, - offset: 0, - initialStep: Math.round(up_limit / 1024), - onChange: (pos) => { - if (pos > 0) { - document.getElementById("uplimitUpdatevalue").value = pos; - document.getElementById("upLimitUnit").style.visibility = "visible"; - } - else { - document.getElementById("uplimitUpdatevalue").value = "∞"; - document.getElementById("upLimitUnit").style.visibility = "hidden"; - } - } - }); - // Set default value - if (up_limit === 0) { - document.getElementById("uplimitUpdatevalue").value = "∞"; - document.getElementById("upLimitUnit").style.visibility = "hidden"; - } - else { - document.getElementById("uplimitUpdatevalue").value = Math.round(up_limit / 1024); - document.getElementById("upLimitUnit").style.visibility = "visible"; - } - }); - } - }); - } - }, - - addDlLimitSlider: (hashes) => { - if (document.getElementById("dllimitSliderarea")) { - // Get global upload limit - fetch("api/v2/transfer/downloadLimit", { - method: "GET", - cache: "no-store" - }) - .then(async (response) => { - if (!response.ok) - return; - - const data = await response.text(); - - let maximum = 500; - const tmp = Number(data); - if (tmp > 0) { - maximum = tmp / 1024.0; - } - else { - if (hashes[0] === "global") - maximum = 10000; - else - maximum = 1000; - } - - // Get torrents download limit - // And create slider - if (hashes[0] === "global") { - let dl_limit = maximum; - if (dl_limit < 0) - dl_limit = 0; - maximum = 10000; - new Slider(document.getElementById("dllimitSliderarea"), document.getElementById("dllimitSliderknob"), { - steps: maximum, - offset: 0, - initialStep: Math.round(dl_limit), - onChange: (pos) => { - if (pos > 0) { - document.getElementById("dllimitUpdatevalue").value = pos; - document.getElementById("dlLimitUnit").style.visibility = "visible"; - } - else { - document.getElementById("dllimitUpdatevalue").value = "∞"; - document.getElementById("dlLimitUnit").style.visibility = "hidden"; - } - } - }); - // Set default value - if (dl_limit === 0) { - document.getElementById("dllimitUpdatevalue").value = "∞"; - document.getElementById("dlLimitUnit").style.visibility = "hidden"; - } - else { - document.getElementById("dllimitUpdatevalue").value = Math.round(dl_limit); - document.getElementById("dlLimitUnit").style.visibility = "visible"; - } - } - else { - fetch("api/v2/torrents/downloadLimit", { - method: "POST", - body: new URLSearchParams({ - hashes: hashes.join("|") - }) - }) - .then(async (response) => { - if (!response.ok) - return; - - const data = await response.json(); - - let dl_limit = data[hashes[0]]; - for (const key in data) { - if (dl_limit !== data[key]) { - dl_limit = 0; - break; - } - } - if (dl_limit < 0) - dl_limit = 0; - new Slider(document.getElementById("dllimitSliderarea"), document.getElementById("dllimitSliderknob"), { - steps: maximum, - offset: 0, - initialStep: Math.round(dl_limit / 1024), - onChange: (pos) => { - if (pos > 0) { - document.getElementById("dllimitUpdatevalue").value = pos; - document.getElementById("dlLimitUnit").style.visibility = "visible"; - } - else { - document.getElementById("dllimitUpdatevalue").value = "∞"; - document.getElementById("dlLimitUnit").style.visibility = "hidden"; - } - } - }); - // Set default value - if (dl_limit === 0) { - document.getElementById("dllimitUpdatevalue").value = "∞"; - document.getElementById("dlLimitUnit").style.visibility = "hidden"; - } - else { - document.getElementById("dllimitUpdatevalue").value = Math.round(dl_limit / 1024); - document.getElementById("dlLimitUnit").style.visibility = "visible"; - } - }); - } - }); - } - } -}); diff --git a/src/webui/www/private/speedlimit.html b/src/webui/www/private/speedlimit.html new file mode 100644 index 000000000..5bfd5840f --- /dev/null +++ b/src/webui/www/private/speedlimit.html @@ -0,0 +1,159 @@ + + + + + + QBT_TR(Speed limit)QBT_TR[CONTEXT=SpeedLimit] + + + + + + +
+
+
+ + + QBT_TR(KiB/s)QBT_TR[CONTEXT=SpeedLimit] +
+ +
+ +
+ + + + + diff --git a/src/webui/www/private/uploadlimit.html b/src/webui/www/private/uploadlimit.html deleted file mode 100644 index fb60da531..000000000 --- a/src/webui/www/private/uploadlimit.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget] - - - - - - - - - - -
-
-
- - - QBT_TR(KiB/s)QBT_TR[CONTEXT=SpeedLimitDialog] -
-
-
-
-
-
-
- -
- - - - - diff --git a/src/webui/www/webui.qrc b/src/webui/www/webui.qrc index 4a833b85a..123790da2 100644 --- a/src/webui/www/webui.qrc +++ b/src/webui/www/webui.qrc @@ -16,7 +16,6 @@ private/css/vanillaSelectBox.css private/css/Window.css private/download.html - private/downloadlimit.html private/editfeedurl.html private/edittracker.html private/editwebseed.html @@ -329,7 +328,6 @@ private/images/help-contents.svg private/images/insert-link.svg private/images/ip-blocked.svg - private/images/knob.gif private/images/L.gif private/images/list-add.svg private/images/list-remove.svg @@ -356,7 +354,6 @@ private/images/reannounce.svg private/images/regex.svg private/images/set-location.svg - private/images/slider-area.gif private/images/slow.svg private/images/slow_off.svg private/images/spacer.gif @@ -419,11 +416,10 @@ private/scripts/prop-webseeds.js private/scripts/rename-files.js private/scripts/search.js - private/scripts/speedslider.js private/setlocation.html private/shareratio.html + private/speedlimit.html private/upload.html - private/uploadlimit.html private/views/about.html private/views/aboutToolbar.html private/views/confirmAutoTMM.html