Browse Source

- Cleaned torrent progress asserts

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
7921adbcf9
  1. 2
      src/FinishedTorrents.cpp
  2. 5
      src/downloadingTorrents.cpp
  3. 4
      src/qtorrenthandle.cpp

2
src/FinishedTorrents.cpp

@ -209,7 +209,6 @@ void FinishedTorrents::updateFinishedList(){ @@ -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(){ @@ -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;
}

5
src/downloadingTorrents.cpp

@ -137,7 +137,6 @@ void DownloadingTorrents::pauseTorrent(QString hash) { @@ -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() { @@ -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() { @@ -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() { @@ -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) { @@ -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()));
}

4
src/qtorrenthandle.cpp

@ -55,7 +55,9 @@ QString QTorrentHandle::name() const { @@ -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…
Cancel
Save