diff --git a/src/webui/www/private/css/dynamicTable.css b/src/webui/www/private/css/dynamicTable.css index 525c675ac4f4..a3cc366bebaa 100644 --- a/src/webui/www/private/css/dynamicTable.css +++ b/src/webui/www/private/css/dynamicTable.css @@ -12,6 +12,17 @@ padding: 2px; } +:root.compact .dynamicTable td { + padding-bottom: 4px; + padding-top: 4px; +} + +:root.compact #torrentFilesTableDiv .dynamicTable td, +:root.compact #bulkRenameFilesTableDiv .dynamicTable td { + padding-bottom: 2px; + padding-top: 2px; +} + .dynamicTableDiv table.dynamicTable tbody tr.selected { background-color: var(--color-background-blue); color: var(--color-text-white); diff --git a/src/webui/www/private/css/style.css b/src/webui/www/private/css/style.css index 149dca88e64d..efd135d82526 100644 --- a/src/webui/www/private/css/style.css +++ b/src/webui/www/private/css/style.css @@ -159,6 +159,12 @@ body { text-align: left; } +:root.compact body { + --icon-size: 13px; + + line-height: 1.2; +} + /* targets dialog windows loaded via iframes */ body:not(:has(#desktop)) { background-color: var(--color-background-popup); @@ -690,14 +696,13 @@ td.noWrap { .filesTableCollapseIcon { cursor: pointer; - height: 15px; - margin-bottom: -3px; - padding-right: 5px; - width: 15px; + height: var(--icon-size, 15px); + margin-right: 5px; + vertical-align: top; + width: var(--icon-size, 15px); } .filesTableCollapseIcon.rotate { - margin-bottom: -1px; transform: rotate(270deg); } @@ -777,7 +782,9 @@ td.noWrap { .combo_priority { font-size: 1em; - padding: 2px 6px; + height: 1.5em; + padding: 0 6px; + vertical-align: top; } td.statusBarSeparator { diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 477e8d1135ae..871458f6e82b 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -66,6 +66,7 @@ window.qBittorrent.Client ??= (() => { "dblclick_complete", "dblclick_download", "dblclick_filter", + "display_density", "full_url_tracker_column", "hide_zero_status_filters", "qbt_selected_log_levels", @@ -299,6 +300,7 @@ window.addEventListener("DOMContentLoaded", async (event) => { await window.qBittorrent.Client.initializeClientData(); window.qBittorrent.ColorScheme.update(); + document.documentElement.classList.toggle("compact", clientData.get("display_density") === "compact"); useAutoHideZeroStatusFilters = clientData.get("hide_zero_status_filters") === true; displayFullURLTrackerColumn = clientData.get("full_url_tracker_column") === true; diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index c1cbce6cedd8..be16d53c20b7 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -80,7 +80,7 @@ window.qBittorrent.DynamicTable ??= (() => { this.hiddenTableHeader = this.dynamicTableDiv.querySelector("thead tr"); this.table = this.dynamicTableDiv.querySelector("table"); this.tableBody = this.dynamicTableDiv.querySelector("tbody"); - this.rowHeight = 26; + this.rowHeight = (clientData.get("display_density") === "compact") ? 22 : 26; this.rows = new Map(); this.cachedElements = []; this.selectedRows = []; @@ -1100,7 +1100,7 @@ window.qBittorrent.DynamicTable ??= (() => { class TorrentsTable extends DynamicTable { setupVirtualList() { super.setupVirtualList(); - this.rowHeight = 22; + this.rowHeight = (clientData.get("display_density") === "compact") ? 18 : 22; } initColumns() { @@ -2425,11 +2425,6 @@ window.qBittorrent.DynamicTable ??= (() => { this.collapseState.clear(); } - setupVirtualList() { - super.setupVirtualList(); - this.rowHeight = 29.5; - } - expandFolder(id) { if (!this.supportCollapsing) return; @@ -2541,7 +2536,7 @@ window.qBittorrent.DynamicTable ??= (() => { if (td.firstElementChild === null) { const treeImg = document.createElement("img"); treeImg.src = "images/L.svg"; - treeImg.style.marginBottom = "-2px"; + treeImg.style.verticalAlign = "top"; td.append(treeImg); } @@ -2594,9 +2589,10 @@ window.qBittorrent.DynamicTable ??= (() => { if (dirImg === undefined) { dirImg = document.createElement("img"); dirImg.src = "images/directory.svg"; - dirImg.style.width = "20px"; - dirImg.style.paddingRight = "5px"; - dirImg.style.marginBottom = "-3px"; + dirImg.style.height = "18px"; + dirImg.style.width = "18px"; + dirImg.style.marginRight = "5px"; + dirImg.style.verticalAlign = "top"; td.append(dirImg); } dirImg.style.display = node.isFolder ? "inline" : "none"; @@ -2817,11 +2813,6 @@ window.qBittorrent.DynamicTable ??= (() => { supportCollapsing = false; fileNameColumn = "original"; - setupVirtualList() { - super.setupVirtualList(); - this.rowHeight = 29; - } - getSelectedRows() { const nodes = this.fileTree.toArray(); return nodes.filter(x => x.checked === 0); @@ -2909,7 +2900,7 @@ window.qBittorrent.DynamicTable ??= (() => { if (td.firstElementChild === null) { const treeImg = document.createElement("img"); treeImg.src = "images/L.svg"; - treeImg.style.marginBottom = "-2px"; + treeImg.style.verticalAlign = "top"; td.append(treeImg); } @@ -2974,9 +2965,10 @@ window.qBittorrent.DynamicTable ??= (() => { if (dirImg === undefined) { dirImg = document.createElement("img"); dirImg.src = "images/directory.svg"; - dirImg.style.width = "20px"; - dirImg.style.paddingRight = "5px"; - dirImg.style.marginBottom = "-3px"; + dirImg.style.height = "18px"; + dirImg.style.width = "18px"; + dirImg.style.marginRight = "5px"; + dirImg.style.verticalAlign = "top"; td.append(dirImg); } if (node.isFolder) { diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index c9c4053769c5..671edf975869 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -9,12 +9,21 @@
QBT_TR(Interface)QBT_TR[CONTEXT=OptionsDialog] - - +
+ + +
+
+ + +
@@ -2262,6 +2271,7 @@ .then((pref) => { const clientData = window.parent.qBittorrent.ClientData; const colorScheme = clientData.get("color_scheme"); + const displayDensity = clientData.get("display_density") ?? "default"; const fullUrlTrackerColumn = clientData.get("full_url_tracker_column"); const useVirtualList = clientData.get("use_virtual_list"); const hideZeroStatusFilters = clientData.get("hide_zero_status_filters"); @@ -2274,6 +2284,7 @@ // Language updateWebuiLocaleSelect(pref.locale); updateColoSchemeSelect(colorScheme); + document.getElementById("displayDensitySelect").value = displayDensity; document.getElementById("statusBarExternalIP").checked = pref.status_bar_external_ip; document.getElementById("performanceWarning").checked = pref.performance_warning; @@ -2721,6 +2732,8 @@ clientData.color_scheme = "light"; else clientData.color_scheme = "dark"; + const displayDensity = document.getElementById("displayDensitySelect").value; + clientData.display_density = (displayDensity === "default") ? null : displayDensity; settings["status_bar_external_ip"] = document.getElementById("statusBarExternalIP").checked; settings["performance_warning"] = document.getElementById("performanceWarning").checked; clientData.full_url_tracker_column = document.getElementById("displayFullURLTrackerColumn").checked;