mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-02 15:36:29 +00:00
- Cleaned torrent progress asserts
This commit is contained in:
parent
63334ea6fb
commit
7921adbcf9
@ -209,7 +209,6 @@ void FinishedTorrents::updateFinishedList(){
|
||||
}
|
||||
Q_ASSERT(row != -1);
|
||||
if(h.is_paused()) continue;
|
||||
Q_ASSERT(h.progress() <= 1. && h.progress() >= 0.);
|
||||
if(h.state() == torrent_status::downloading || (h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking && h.progress() < 1.)) {
|
||||
// What are you doing here? go back to download tab!
|
||||
qDebug("Info: a torrent was moved from finished to download tab");
|
||||
@ -223,7 +222,6 @@ void FinishedTorrents::updateFinishedList(){
|
||||
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
|
||||
setRowColor(row, QString::fromUtf8("grey"));
|
||||
}
|
||||
Q_ASSERT(h.progress() <= 1. && h.progress() >= 0.);
|
||||
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)h.progress()));
|
||||
continue;
|
||||
}
|
||||
|
@ -137,7 +137,6 @@ void DownloadingTorrents::pauseTorrent(QString hash) {
|
||||
DLListModel->setData(DLListModel->index(row, NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole);
|
||||
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString::fromUtf8("0/0")));
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
Q_ASSERT(h.progress() <= 1. && h.progress() >= 0.);
|
||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
||||
setRowColor(row, QString::fromUtf8("red"));
|
||||
}
|
||||
@ -389,7 +388,6 @@ void DownloadingTorrents::updateDlList() {
|
||||
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
|
||||
setRowColor(row, QString::fromUtf8("grey"));
|
||||
}
|
||||
Q_ASSERT(h.progress() <= 1. && h.progress() >= 0.);
|
||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
||||
break;
|
||||
case torrent_status::connecting_to_tracker:
|
||||
@ -403,7 +401,6 @@ void DownloadingTorrents::updateDlList() {
|
||||
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/connecting.png"))), Qt::DecorationRole);
|
||||
setRowColor(row, QString::fromUtf8("grey"));
|
||||
}
|
||||
Q_ASSERT(h.progress() <= 1. && h.progress() >= 0.);
|
||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
||||
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)h.download_payload_rate()));
|
||||
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate()));
|
||||
@ -419,7 +416,6 @@ void DownloadingTorrents::updateDlList() {
|
||||
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1));
|
||||
setRowColor(row, QString::fromUtf8("black"));
|
||||
}
|
||||
Q_ASSERT(h.progress() <= 1. && h.progress() >= 0.);
|
||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
||||
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)h.download_payload_rate()));
|
||||
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate()));
|
||||
@ -655,7 +651,6 @@ void DownloadingTorrents::updateFileSizeAndProgress(QString hash) {
|
||||
Q_ASSERT(row != -1);
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)h.actual_size()));
|
||||
Q_ASSERT(h.progress() <= 1.);
|
||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,9 @@ QString QTorrentHandle::name() const {
|
||||
|
||||
float QTorrentHandle::progress() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
return h.status().progress;
|
||||
float progress = h.status().progress;
|
||||
Q_ASSERT(progress >= 0. && progress <= 1.);
|
||||
return progress;
|
||||
}
|
||||
|
||||
QString QTorrentHandle::current_tracker() const {
|
||||
|
Loading…
Reference in New Issue
Block a user