mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Add warning when previewing torrents with many files
- Implemented confirmation dialog for torrents with >100 files - Fixes #23072
This commit is contained in:
parent
2631692cff
commit
4ca7ae88c3
1 changed files with 17 additions and 5 deletions
|
@ -610,17 +610,29 @@ void TransferListWidget::openSelectedTorrentsFolder() const
|
||||||
|
|
||||||
void TransferListWidget::previewSelectedTorrents()
|
void TransferListWidget::previewSelectedTorrents()
|
||||||
{
|
{
|
||||||
|
const int FILE_COUNT_THRESHOLD = 100;
|
||||||
|
|
||||||
for (const BitTorrent::Torrent *torrent : asConst(getSelectedTorrents()))
|
for (const BitTorrent::Torrent *torrent : asConst(getSelectedTorrents()))
|
||||||
{
|
{
|
||||||
if (torrentContainsPreviewableFiles(torrent))
|
if (!torrentContainsPreviewableFiles(torrent))
|
||||||
{
|
|
||||||
openPreviewSelectDialog(torrent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Unable to preview"), tr("The selected torrent \"%1\" does not contain previewable files")
|
QMessageBox::critical(this, tr("Unable to preview"), tr("The selected torrent \"%1\" does not contain previewable files")
|
||||||
.arg(torrent->name()));
|
.arg(torrent->name()));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int fileCount = torrent->filesCount();
|
||||||
|
if (fileCount > FILE_COUNT_THRESHOLD)
|
||||||
|
{
|
||||||
|
QMessageBox::StandardButton reply = QMessageBox::question(this, tr("Preview confirmation"),
|
||||||
|
tr("The torrent \"%1\" has a large number of files (%2). Previewing may take a long time. Do you want to continue?")
|
||||||
|
.arg(torrent->name()).arg(fileCount),
|
||||||
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
|
if (reply == QMessageBox::No)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
openPreviewSelectDialog(torrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue