Add filter "Checking" to side panel (#15166)

This commit is contained in:
AbeniMatteo
2021-07-16 13:08:10 +02:00
committed by GitHub
parent 933e56494c
commit e5943b64c1
6 changed files with 23 additions and 0 deletions

View File

@@ -212,6 +212,9 @@ StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *tran
auto *stalledDownloading = new QListWidgetItem(this);
stalledDownloading->setData(Qt::DisplayRole, tr("Stalled Downloading (0)"));
stalledDownloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("stalledDL")));
auto *checking = new QListWidgetItem(this);
checking->setData(Qt::DisplayRole, tr("Checking (0)"));
checking->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("checking")));
auto *errored = new QListWidgetItem(this);
errored->setData(Qt::DisplayRole, tr("Errored (0)"));
errored->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("error")));
@@ -238,6 +241,7 @@ void StatusFilterWidget::updateTorrentNumbers()
int nbStalled = 0;
int nbStalledUploading = 0;
int nbStalledDownloading = 0;
int nbChecking = 0;
int nbErrored = 0;
const QVector<BitTorrent::Torrent *> torrents = BitTorrent::Session::instance()->torrents();
@@ -261,6 +265,8 @@ void StatusFilterWidget::updateTorrentNumbers()
++nbStalledUploading;
if (torrent->state() == BitTorrent::TorrentState::StalledDownloading)
++nbStalledDownloading;
if (torrent->isChecking())
++nbChecking;
if (torrent->isErrored())
++nbErrored;
}
@@ -278,6 +284,7 @@ void StatusFilterWidget::updateTorrentNumbers()
item(TorrentFilter::Stalled)->setData(Qt::DisplayRole, tr("Stalled (%1)").arg(nbStalled));
item(TorrentFilter::StalledUploading)->setData(Qt::DisplayRole, tr("Stalled Uploading (%1)").arg(nbStalledUploading));
item(TorrentFilter::StalledDownloading)->setData(Qt::DisplayRole, tr("Stalled Downloading (%1)").arg(nbStalledDownloading));
item(TorrentFilter::Checking)->setData(Qt::DisplayRole, tr("Checking (%1)").arg(nbChecking));
item(TorrentFilter::Errored)->setData(Qt::DisplayRole, tr("Errored (%1)").arg(nbErrored));
}