Revise 'Add trackers' dialog

* Now it allow user to add tracker to different tier.
* The downloaded trackers are now displayed as is (without modifying).
* Now the dialog remember dialog size and last used URL.

Closes #17692.
This commit is contained in:
Chocobo1
2022-09-12 23:29:09 +08:00
parent 4e326229da
commit e692a191ed
12 changed files with 271 additions and 125 deletions

View File

@@ -423,17 +423,15 @@ void TrackerListWidget::loadTrackers()
delete m_trackerItems.take(tracker);
}
// Ask the user for new trackers and add them to the torrent
void TrackerListWidget::askForTrackers()
void TrackerListWidget::openAddTrackersDialog()
{
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
if (!torrent) return;
BitTorrent::Torrent *torrent = m_properties->getCurrentTorrent();
if (!torrent)
return;
QVector<BitTorrent::TrackerEntry> trackers;
for (const QString &tracker : asConst(TrackersAdditionDialog::askForTrackers(this, torrent)))
trackers.append({tracker});
torrent->addTrackers(trackers);
const auto dialog = new TrackersAdditionDialog(this, torrent);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->open();
}
void TrackerListWidget::copyTrackerUrl()
@@ -568,7 +566,7 @@ void TrackerListWidget::showTrackerListMenu()
// Add actions
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add trackers...")
, this, &TrackerListWidget::askForTrackers);
, this, &TrackerListWidget::openAddTrackersDialog);
if (!getSelectedTrackerItems().isEmpty())
{