From b52fa98a02bfa74766dd4a31d6a667a51ad00843 Mon Sep 17 00:00:00 2001 From: Hanabishi <13597663+HanabishiRecca@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:34:05 +0500 Subject: [PATCH] WebUI: Implement double-click behavior controls PR #21000. --- src/webui/www/private/scripts/dynamicTable.js | 14 ++++++++++ src/webui/www/private/views/preferences.html | 28 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 1fa668920..07503ea77 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -1536,6 +1536,20 @@ window.qBittorrent.DynamicTable = (function() { this._this.selectRow(this.rowId); const row = this._this.rows.get(this.rowId); const state = row["full_data"].state; + + const prefKey = + (state !== "uploading") + && (state !== "stoppedUP") + && (state !== "forcedUP") + && (state !== "stalledUP") + && (state !== "queuedUP") + && (state !== "checkingUP") + ? "dblclick_download" + : "dblclick_complete"; + + if (LocalPreferences.get(prefKey, "1") !== "1") + return true; + if (state.includes("stopped")) startFN(); else diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index 78ec25d9f..fab7a8e91 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -7,6 +7,30 @@ +
+ QBT_TR(Action on double-click)QBT_TR[CONTEXT=OptionsDialog] + + + + + + + + + +
+ +
+ +
+
+
@@ -1995,6 +2019,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD window.parent.qBittorrent.Cache.preferences.init({ onSuccess: (pref) => { // Behavior tab + $("dblclickDownloadSelect").value = LocalPreferences.get("dblclick_download", "1"); + $("dblclickCompleteSelect").value = LocalPreferences.get("dblclick_complete", "1"); $("filelog_checkbox").setProperty("checked", pref.file_log_enabled); $("filelog_save_path_input").setProperty("value", pref.file_log_path); $("filelog_backup_checkbox").setProperty("checked", pref.file_log_backup_enabled); @@ -2403,6 +2429,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD // Validate form data // Behavior tab + LocalPreferences.set("dblclick_download", $("dblclickDownloadSelect").value); + LocalPreferences.set("dblclick_complete", $("dblclickCompleteSelect").value); settings["file_log_enabled"] = $("filelog_checkbox").getProperty("checked"); settings["file_log_path"] = $("filelog_save_path_input").getProperty("value"); settings["file_log_backup_enabled"] = $("filelog_backup_checkbox").getProperty("checked");