From be73c482d0d5ae6cab79a72d092291b3772b66de Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 27 Dec 2006 14:43:57 +0000 Subject: [PATCH] - Display "Unknown" instead of "0/0" in SEEDS/LEECHS column when the tracker doesn't send this info --- src/GUI.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index 64b38be79..fe84dd425 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -476,7 +476,6 @@ void GUI::updateDlList(bool force){ DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate)); DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Finished"))); DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.)); - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_complete, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_incomplete, true).c_str()))); DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/seeding.png")), Qt::DecorationRole); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)1.)); @@ -487,7 +486,6 @@ void GUI::updateDlList(bool force){ DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Checking..."))); DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole); setRowColor(row, "grey"); - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_complete, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_incomplete, true).c_str()))); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress)); break; case torrent_status::connecting_to_tracker: @@ -503,7 +501,6 @@ void GUI::updateDlList(bool force){ DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole); setRowColor(row, "grey"); } - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_complete, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_incomplete, true).c_str()))); 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, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate)); @@ -521,7 +518,6 @@ void GUI::updateDlList(bool force){ DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); setRowColor(row, "black"); } - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_complete, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_incomplete, true).c_str()))); 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, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate)); @@ -530,6 +526,11 @@ void GUI::updateDlList(bool force){ DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_complete, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_incomplete, true).c_str()))); DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); } + if(torrentStatus.num_complete == -1 && torrentStatus.num_incomplete == -1){ + DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(tr("Unknown"))); + }else{ + DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_complete, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_incomplete, true).c_str()))); + } } }catch(invalid_handle e){ continue; @@ -1295,7 +1296,7 @@ void GUI::addTorrent(const QString& path, bool fromScanDir, const QString& from_ DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)t.total_size())); DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.)); DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.)); - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0")); + DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(tr("Unknown"))); DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); // Pause torrent if it was paused last time if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+QString(t.name().c_str())+".paused")){