WebUI: Implement double-click behavior controls

PR #21000.
This commit is contained in:
Hanabishi 2024-07-05 11:34:05 +05:00 committed by GitHub
parent d87533bf4c
commit b52fa98a02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 0 deletions

View file

@ -1536,6 +1536,20 @@ window.qBittorrent.DynamicTable = (function() {
this._this.selectRow(this.rowId); this._this.selectRow(this.rowId);
const row = this._this.rows.get(this.rowId); const row = this._this.rows.get(this.rowId);
const state = row["full_data"].state; 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")) if (state.includes("stopped"))
startFN(); startFN();
else else

View file

@ -7,6 +7,30 @@
</select> </select>
</fieldset> </fieldset>
<fieldset class="settings">
<legend>QBT_TR(Action on double-click)QBT_TR[CONTEXT=OptionsDialog]</legend>
<table>
<tr>
<td><label for="dblclickDownloadSelect">QBT_TR(Downloading torrents:)QBT_TR[CONTEXT=OptionsDialog]</label></td>
<td>
<select id="dblclickDownloadSelect">
<option value="1" selected>QBT_TR(Start / Stop Torrent)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="0">QBT_TR(No action)QBT_TR[CONTEXT=OptionsDialog]</option>
</select>
</td>
</tr>
<tr>
<td><label for="dblclickCompleteSelect">QBT_TR(Completed torrents:)QBT_TR[CONTEXT=OptionsDialog]</label></td>
<td>
<select id="dblclickCompleteSelect">
<option value="1" selected>QBT_TR(Start / Stop Torrent)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="0">QBT_TR(No action)QBT_TR[CONTEXT=OptionsDialog]</option>
</select>
</td>
</tr>
</table>
</fieldset>
<fieldset class="settings"> <fieldset class="settings">
<legend> <legend>
<input type="checkbox" id="filelog_checkbox" onclick="qBittorrent.Preferences.updateFileLogEnabled();" /> <input type="checkbox" id="filelog_checkbox" onclick="qBittorrent.Preferences.updateFileLogEnabled();" />
@ -1995,6 +2019,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
window.parent.qBittorrent.Cache.preferences.init({ window.parent.qBittorrent.Cache.preferences.init({
onSuccess: (pref) => { onSuccess: (pref) => {
// Behavior tab // 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_checkbox").setProperty("checked", pref.file_log_enabled);
$("filelog_save_path_input").setProperty("value", pref.file_log_path); $("filelog_save_path_input").setProperty("value", pref.file_log_path);
$("filelog_backup_checkbox").setProperty("checked", pref.file_log_backup_enabled); $("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 // Validate form data
// Behavior tab // 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_enabled"] = $("filelog_checkbox").getProperty("checked");
settings["file_log_path"] = $("filelog_save_path_input").getProperty("value"); settings["file_log_path"] = $("filelog_save_path_input").getProperty("value");
settings["file_log_backup_enabled"] = $("filelog_backup_checkbox").getProperty("checked"); settings["file_log_backup_enabled"] = $("filelog_backup_checkbox").getProperty("checked");