Browse Source

Add confirmation for enabling Auto TMM from context menu

* Add confirmation for enabling Auto TMM from context 
* Add tooltip to Automatic Torrent Management context menu action

PR #16241.
adaptive-webui-19844
Vladimir Golovnev 3 years ago committed by GitHub
parent
commit
bc2ef5d726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/gui/transferlistwidget.cpp
  2. 2
      src/gui/transferlistwidget.h

12
src/gui/transferlistwidget.cpp

@ -703,8 +703,16 @@ void TransferListWidget::setSelectedFirstLastPiecePrio(const bool enabled) const
torrent->setFirstLastPiecePriority(enabled); torrent->setFirstLastPiecePriority(enabled);
} }
void TransferListWidget::setSelectedAutoTMMEnabled(const bool enabled) const void TransferListWidget::setSelectedAutoTMMEnabled(const bool enabled)
{ {
if (enabled)
{
const QMessageBox::StandardButton btn = QMessageBox::question(this, tr("Enable automatic torrent management")
, tr("Are you sure you want to enable Automatic Torrent Management for the selected torrent(s)? They may be relocated.")
, (QMessageBox::Yes | QMessageBox::No), QMessageBox::Yes);
if (btn != QMessageBox::Yes) return;
}
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents())) for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
torrent->setAutoTMMEnabled(enabled); torrent->setAutoTMMEnabled(enabled);
} }
@ -852,6 +860,7 @@ void TransferListWidget::displayListMenu()
auto *listMenu = new QMenu(this); auto *listMenu = new QMenu(this);
listMenu->setAttribute(Qt::WA_DeleteOnClose); listMenu->setAttribute(Qt::WA_DeleteOnClose);
listMenu->setToolTipsVisible(true);
// Create actions // Create actions
@ -902,6 +911,7 @@ void TransferListWidget::displayListMenu()
auto *actionFirstLastPiecePrio = new TriStateAction(tr("Download first and last pieces first"), listMenu); auto *actionFirstLastPiecePrio = new TriStateAction(tr("Download first and last pieces first"), listMenu);
connect(actionFirstLastPiecePrio, &QAction::triggered, this, &TransferListWidget::setSelectedFirstLastPiecePrio); connect(actionFirstLastPiecePrio, &QAction::triggered, this, &TransferListWidget::setSelectedFirstLastPiecePrio);
auto *actionAutoTMM = new TriStateAction(tr("Automatic Torrent Management"), listMenu); auto *actionAutoTMM = new TriStateAction(tr("Automatic Torrent Management"), listMenu);
actionAutoTMM->setToolTip(tr("Automatic mode means that various torrent properties (e.g. save path) will be decided by the associated category"));
connect(actionAutoTMM, &QAction::triggered, this, &TransferListWidget::setSelectedAutoTMMEnabled); connect(actionAutoTMM, &QAction::triggered, this, &TransferListWidget::setSelectedAutoTMMEnabled);
auto *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit trackers..."), listMenu); auto *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit trackers..."), listMenu);
connect(actionEditTracker, &QAction::triggered, this, &TransferListWidget::editTorrentTrackers); connect(actionEditTracker, &QAction::triggered, this, &TransferListWidget::editTorrentTrackers);

2
src/gui/transferlistwidget.h

@ -111,7 +111,7 @@ private slots:
void setSelectedTorrentsSuperSeeding(bool enabled) const; void setSelectedTorrentsSuperSeeding(bool enabled) const;
void setSelectedTorrentsSequentialDownload(bool enabled) const; void setSelectedTorrentsSequentialDownload(bool enabled) const;
void setSelectedFirstLastPiecePrio(bool enabled) const; void setSelectedFirstLastPiecePrio(bool enabled) const;
void setSelectedAutoTMMEnabled(bool enabled) const; void setSelectedAutoTMMEnabled(bool enabled);
void askNewCategoryForSelection(); void askNewCategoryForSelection();
void saveSettings(); void saveSettings();

Loading…
Cancel
Save