mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 23:47:23 -06:00
Merge pull request #13234 from glassez/load-torrent
Improve torrent loading code
This commit is contained in:
@@ -182,7 +182,7 @@ CategoryFilterModel::CategoryFilterModel(QObject *parent)
|
||||
connect(session, &Session::categoryRemoved, this, &CategoryFilterModel::categoryRemoved);
|
||||
connect(session, &Session::torrentCategoryChanged, this, &CategoryFilterModel::torrentCategoryChanged);
|
||||
connect(session, &Session::subcategoriesSupportChanged, this, &CategoryFilterModel::subcategoriesSupportChanged);
|
||||
connect(session, &Session::torrentAdded, this, &CategoryFilterModel::torrentAdded);
|
||||
connect(session, &Session::torrentLoaded, this, &CategoryFilterModel::torrentAdded);
|
||||
connect(session, &Session::torrentAboutToBeRemoved, this, &CategoryFilterModel::torrentAboutToBeRemoved);
|
||||
|
||||
populate();
|
||||
|
||||
@@ -195,8 +195,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
// Creating Bittorrent session
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::fullDiskError, this, &MainWindow::fullDiskError);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::addTorrentFailed, this, &MainWindow::addTorrentFailed);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentNew,this, &MainWindow::torrentNew);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::loadTorrentFailed, this, &MainWindow::addTorrentFailed);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentAdded,this, &MainWindow::torrentNew);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentFinished, this, &MainWindow::finishedTorrent);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::downloadFromUrlFailed, this, &MainWindow::handleDownloadFromUrlFailure);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::speedLimitModeChanged, this, &MainWindow::updateAltSpeedsBtn);
|
||||
|
||||
@@ -98,7 +98,7 @@ TagFilterModel::TagFilterModel(QObject *parent)
|
||||
connect(session, &Session::tagRemoved, this, &TagFilterModel::tagRemoved);
|
||||
connect(session, &Session::torrentTagAdded, this, &TagFilterModel::torrentTagAdded);
|
||||
connect(session, &Session::torrentTagRemoved, this, &TagFilterModel::torrentTagRemoved);
|
||||
connect(session, &Session::torrentAdded, this, &TagFilterModel::torrentAdded);
|
||||
connect(session, &Session::torrentLoaded, this, &TagFilterModel::torrentAdded);
|
||||
connect(session, &Session::torrentAboutToBeRemoved, this, &TagFilterModel::torrentAboutToBeRemoved);
|
||||
populate();
|
||||
}
|
||||
|
||||
@@ -209,7 +209,10 @@ void TorrentCreatorDialog::handleCreationSuccess(const QString &path, const QStr
|
||||
BitTorrent::AddTorrentParams params;
|
||||
params.savePath = branchPath;
|
||||
params.skipChecking = true;
|
||||
params.ignoreShareLimits = m_ui->checkIgnoreShareLimits->isChecked();
|
||||
if (m_ui->checkIgnoreShareLimits->isChecked()) {
|
||||
params.ratioLimit = BitTorrent::TorrentHandle::NO_RATIO_LIMIT;
|
||||
params.seedingTimeLimit = BitTorrent::TorrentHandle::NO_SEEDING_TIME_LIMIT;
|
||||
}
|
||||
params.useAutoTMM = TriStateBool::False; // otherwise if it is on by default, it will overwrite `savePath` to the default save path
|
||||
|
||||
BitTorrent::Session::instance()->addTorrent(info, params);
|
||||
|
||||
@@ -120,7 +120,7 @@ BaseFilterWidget::BaseFilterWidget(QWidget *parent, TransferListWidget *transfer
|
||||
connect(this, &BaseFilterWidget::customContextMenuRequested, this, &BaseFilterWidget::showMenu);
|
||||
connect(this, &BaseFilterWidget::currentRowChanged, this, &BaseFilterWidget::applyFilter);
|
||||
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentAdded
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentLoaded
|
||||
, this, &BaseFilterWidget::handleNewTorrent);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentAboutToBeRemoved
|
||||
, this, &BaseFilterWidget::torrentAboutToBeDeleted);
|
||||
@@ -155,7 +155,7 @@ void BaseFilterWidget::toggleFilter(bool checked)
|
||||
StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *transferList)
|
||||
: BaseFilterWidget(parent, transferList)
|
||||
{
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentAdded
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentLoaded
|
||||
, this, &StatusFilterWidget::updateTorrentNumbers);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentsUpdated
|
||||
, this, &StatusFilterWidget::updateTorrentNumbers);
|
||||
|
||||
@@ -137,7 +137,7 @@ TransferListModel::TransferListModel(QObject *parent)
|
||||
addTorrent(torrent);
|
||||
|
||||
// Listen for torrent changes
|
||||
connect(Session::instance(), &Session::torrentAdded, this, &TransferListModel::addTorrent);
|
||||
connect(Session::instance(), &Session::torrentLoaded, this, &TransferListModel::addTorrent);
|
||||
connect(Session::instance(), &Session::torrentAboutToBeRemoved, this, &TransferListModel::handleTorrentAboutToBeRemoved);
|
||||
connect(Session::instance(), &Session::torrentsUpdated, this, &TransferListModel::handleTorrentsUpdated);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user