Skip to content

Commit

Permalink
WebUI: add multi-file renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
loligans committed Feb 18, 2023
1 parent 7ae83df commit 887c27c
Show file tree
Hide file tree
Showing 12 changed files with 1,340 additions and 28 deletions.
3 changes: 2 additions & 1 deletion src/webui/www/private/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ h2 {
padding: 6px 0;
}

#error_div {
#error_div,
#rename_error {
color: #f00;
float: left;
font-size: 14px;
Expand Down
9 changes: 9 additions & 0 deletions src/webui/www/private/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<script src="scripts/piecesbar.js?v=${CACHEID}"></script>
<script src="scripts/file-tree.js?v=${CACHEID}"></script>
<script src="scripts/dynamicTable.js?locale=${LANG}&v=${CACHEID}"></script>
<script src="scripts/rename-files.js?v=${CACHEID}"></script>
<script src="scripts/client.js?locale=${LANG}&v=${CACHEID}"></script>
<script src="scripts/contextmenu.js?locale=${LANG}&v=${CACHEID}"></script>
</head>
Expand Down Expand Up @@ -136,8 +137,13 @@ <h1 class="applicationTitle">qBittorrent Web User Interface <span class="version
<li class="separator"><a href="#delete"><img src="images/list-remove.svg" alt="QBT_TR(Remove)QBT_TR[CONTEXT=TransferListWidget]" /> QBT_TR(Remove)QBT_TR[CONTEXT=TransferListWidget]</a></li>
<li class="separator">
<a href="#setLocation"><img src="images/set-location.svg" alt="QBT_TR(Set location...)QBT_TR[CONTEXT=TransferListWidget]" /> QBT_TR(Set location...)QBT_TR[CONTEXT=TransferListWidget]</a>
</li>
<li>
<a href="#rename"><img src="images/edit-rename.svg" alt="QBT_TR(Rename...)QBT_TR[CONTEXT=TransferListWidget]" /> QBT_TR(Rename...)QBT_TR[CONTEXT=TransferListWidget]</a>
</li>
<li>
<a href="#renameFiles"><img src="images/edit-rename.svg" alt="QBT_TR(Rename Files...)QBT_TR[CONTEXT=TransferListWidget]" /> QBT_TR(Rename Files...)QBT_TR[CONTEXT=TransferListWidget]</a>
</li>
<li>
<a href="#Category" class="arrow-right"><img src="images/view-categories.svg" alt="QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]" /> QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]</a>
<ul id="contextCategoryList" class="scrollableMenu"></ul>
Expand Down Expand Up @@ -225,6 +231,9 @@ <h1 class="applicationTitle">qBittorrent Web User Interface <span class="version
</ul>
</li>
</ul>
<ul id="multiRenameFilesMenu" class="contextMenu">
<li><a href="#ToggleSelection"><img src="images/edit-rename.svg" alt="QBT_TR(Toggle Selection)QBT_TR[CONTEXT=PropertiesWidget]" /> QBT_TR(Toggle Selection)QBT_TR[CONTEXT=PropertiesWidget]</a></li>
</ul>
<div id="desktopFooterWrapper">
<div id="desktopFooter">
<span id="error_div"></span>
Expand Down
489 changes: 489 additions & 0 deletions src/webui/www/private/rename_files.html

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/webui/www/private/scripts/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,19 @@ window.qBittorrent.ContextMenu = (function() {

let show_seq_dl = true;

// hide renameFiles when more than 1 torrent is selected
if (h.length == 1) {
const data = torrentsTable.rows.get(h[0]).full_data;
let metadata_downloaded = !(data['state'] == 'metaDL' || data['state'] == 'forcedMetaDL' || data['total_size'] == -1);

// hide renameFiles when metadata hasn't been downloaded yet
metadata_downloaded
? this.showItem('renameFiles')
: this.hideItem('renameFiles');
}
else
this.hideItem('renameFiles');

if (!all_are_seq_dl && there_are_seq_dl)
show_seq_dl = false;

Expand Down
Loading

0 comments on commit 887c27c

Please sign in to comment.