Browse Source

- Added some more assert to be sure progress value is under 100%

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
5066819c58
  1. 5
      src/GUI.cpp

5
src/GUI.cpp

@ -578,6 +578,7 @@ void GUI::updateDlList(bool force){
if(BTSession->getTorrentsToPauseAfterChecking().indexOf(fileHash) == -1){ if(BTSession->getTorrentsToPauseAfterChecking().indexOf(fileHash) == -1){
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/time.png")), Qt::DecorationRole); DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/time.png")), Qt::DecorationRole);
setRowColor(row, "grey"); setRowColor(row, "grey");
Q_ASSERT(torrentStatus.progress <= 1.);
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress)); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
} }
break; break;
@ -592,6 +593,7 @@ void GUI::updateDlList(bool force){
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole); DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole);
setRowColor(row, "grey"); setRowColor(row, "grey");
} }
Q_ASSERT(torrentStatus.progress <= 1.);
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress)); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)torrentStatus.download_payload_rate)); DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)torrentStatus.download_payload_rate));
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate)); DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate));
@ -608,6 +610,7 @@ void GUI::updateDlList(bool force){
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1));
setRowColor(row, "black"); setRowColor(row, "black");
} }
Q_ASSERT(torrentStatus.progress <= 1.);
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress)); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)torrentStatus.download_payload_rate)); DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)torrentStatus.download_payload_rate));
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate)); DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate));
@ -1222,6 +1225,7 @@ void GUI::updateFileSizeAndProgress(QString hash){
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)BTSession->torrentEffectiveSize(hash))); DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)BTSession->torrentEffectiveSize(hash)));
torrent_handle h = BTSession->getTorrentHandle(hash); torrent_handle h = BTSession->getTorrentHandle(hash);
torrent_status torrentStatus = h.status(); torrent_status torrentStatus = h.status();
Q_ASSERT(torrentStatus.progress <= 1.);
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress)); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
} }
@ -1629,6 +1633,7 @@ void GUI::torrentChecked(QString hash){
DLListModel->setData(DLListModel->index(row, NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole); DLListModel->setData(DLListModel->index(row, NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole);
setRowColor(row, "red"); setRowColor(row, "red");
// Update progress in download list // Update progress in download list
Q_ASSERT(torrentStatus.progress <= 1.);
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress)); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
// Delayed Sorting // Delayed Sorting
sortProgressColumnDelayed(); sortProgressColumnDelayed();

Loading…
Cancel
Save