diff --git a/Changelog b/Changelog index 94d9da523..8ccf41378 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,5 @@ * Unknown - Christophe Dumez - v1.4.0 - - FEATURE: Display swarm information in seeding list + - FEATURE: Display swarm information in lists - FEATURE: Allow to define temporary download folder - FEATURE: Display total amount of uploaded data in finished list - FEATURE: Resizing a column in a search results tab affects all tabs diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp index 5ab6db0d9..4f229f3f4 100644 --- a/src/FinishedTorrents.cpp +++ b/src/FinishedTorrents.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : parent(parent), BTSession(BTSession), nbFinished(0){ @@ -95,33 +94,15 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par connect(actionHOSColPeers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnPeers())); connect(actionHOSColUpload, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpload())); connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio())); - - scrapeTimer = new QTimer(this); - connect(scrapeTimer, SIGNAL(timeout()), this, SLOT(scrapeTrackers())); - scrapeTimer->start(20000); } FinishedTorrents::~FinishedTorrents(){ saveColWidthFinishedList(); saveHiddenColumns(); - scrapeTimer->stop(); - delete scrapeTimer; delete finishedListDelegate; delete finishedListModel; } -void FinishedTorrents::scrapeTrackers() { - std::vector torrents = BTSession->getTorrents(); - std::vector::iterator torrentIT; - for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { - QTorrentHandle h = QTorrentHandle(*torrentIT); - if(!h.is_valid()) continue; - if(h.is_seed()) { - h.scrape_tracker(); - } - } -} - void FinishedTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) { unsigned int row = index.row(); QString hash = getHashFromRow(row); diff --git a/src/FinishedTorrents.h b/src/FinishedTorrents.h index 1096fa8f6..80e84eaf5 100644 --- a/src/FinishedTorrents.h +++ b/src/FinishedTorrents.h @@ -37,7 +37,6 @@ class QStandardItemModel; class bittorrent; class FinishedListDelegate; -class QTimer; using namespace libtorrent; @@ -53,7 +52,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding { bool loadHiddenColumns(); void saveHiddenColumns(); QAction* getActionHoSCol(int index); - QTimer *scrapeTimer; public: FinishedTorrents(QObject *parent, bittorrent *BTSession); @@ -85,7 +83,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding { void hideOrShowColumnPeers(); void hideOrShowColumnUpload(); void hideOrShowColumnRatio(); - void scrapeTrackers(); void forceRecheck(); public slots: diff --git a/src/GUI.cpp b/src/GUI.cpp index bc3070176..5c4051c59 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -249,6 +249,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) { show(); } + scrapeTimer = new QTimer(this); + connect(scrapeTimer, SIGNAL(timeout()), this, SLOT(scrapeTrackers())); + scrapeTimer->start(20000); qDebug("GUI Built"); } @@ -260,6 +263,8 @@ GUI::~GUI() { BTSession->saveDHTEntry(); BTSession->saveSessionState(); BTSession->saveFastResumeData(); + scrapeTimer->stop(); + delete scrapeTimer; delete dlSpeedLbl; delete upSpeedLbl; delete ratioLbl; @@ -319,6 +324,16 @@ void GUI::displayRSSTab(bool enable) { } } +void GUI::scrapeTrackers() { + std::vector torrents = BTSession->getTorrents(); + std::vector::iterator torrentIT; + for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { + QTorrentHandle h = QTorrentHandle(*torrentIT); + if(!h.is_valid()) continue; + h.scrape_tracker(); + } +} + void GUI::updateRatio() { // Update ratio info float ratio = 1.; diff --git a/src/GUI.h b/src/GUI.h index 42955cce6..ccbf442f0 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -70,6 +70,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ // Bittorrent bittorrent *BTSession; QTimer *checkConnect; + QTimer *scrapeTimer; QList > unauthenticated_trackers; // GUI related QTabWidget *tabs; @@ -177,6 +178,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ bool initWebUi(QString username, QString password, int port); void on_actionIncreasePriority_triggered(); void on_actionDecreasePriority_triggered(); + void scrapeTrackers(); // Options slots void on_actionOptions_triggered(); void OptionsSaved(bool deleteOptions); diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index dff13dfba..f68cce891 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -554,7 +554,13 @@ bool DownloadingTorrents::updateTorrent(QTorrentHandle h) { } } if(!downloadList->isColumnHidden(SEEDSLEECH)) { - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(misc::toQString(h.num_seeds(), true)+QString::fromUtf8("/")+misc::toQString(h.num_peers() - h.num_seeds(), true))); + QString tmp = misc::toQString(h.num_seeds(), true); + if(h.num_complete() >= 0) + tmp.append(QString("(")+misc::toQString(h.num_complete())+QString(")")); + tmp.append(QString("/")+misc::toQString(h.num_peers() - h.num_seeds(), true)); + if(h.num_incomplete() >= 0) + tmp.append(QString("(")+misc::toQString(h.num_incomplete())+QString(")")); + DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(tmp)); } if(!downloadList->isColumnHidden(RATIO)) { DLListModel->setData(DLListModel->index(row, RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));