From c2da2272547ccfca6025ef04735deb7a515c8e14 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 18 May 2010 09:35:55 +0000 Subject: [PATCH] User can force tracker reannounce --- Changelog | 1 + src/propertieswidget.cpp | 9 +++++++ src/propertieswidget.h | 1 + src/qtorrenthandle.cpp | 10 ++++++++ src/qtorrenthandle.h | 2 ++ src/ui/propertieswidget.ui | 49 +++++++++++++++++++++++++++++++------- 6 files changed, 64 insertions(+), 8 deletions(-) diff --git a/Changelog b/Changelog index bea916fa0..d65344e82 100644 --- a/Changelog +++ b/Changelog @@ -4,6 +4,7 @@ - FEATURE: Added support for strict super seeding - FEATURE: The user can force listening on a particular network interface - FEATURE: Added cookie support for RSS feeds + - FEATURE: User can force tracker reannounce - COSMETIC: Display peers country name in tooltip * Sun Mar 14 2010 - Christophe Dumez - v2.2.0 diff --git a/src/propertieswidget.cpp b/src/propertieswidget.cpp index b4cec347b..8041a4b3b 100644 --- a/src/propertieswidget.cpp +++ b/src/propertieswidget.cpp @@ -190,6 +190,7 @@ void PropertiesWidget::clear() { lbl_dllimit->clear(); lbl_elapsed->clear(); lbl_connections->clear(); + reannounce_lbl->clear(); shareRatio->clear(); listWebSeeds->clear(); PropListModel->clear(); @@ -215,6 +216,12 @@ void PropertiesWidget::updateSavePath(QTorrentHandle& _h) { } } +void PropertiesWidget::on_reannounce_btn_clicked() { + if(h.is_valid()) { + h.force_reannounce(); + } +} + void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) { clear(); h = _h; @@ -329,6 +336,8 @@ void PropertiesWidget::loadDynamicData() { lbl_connections->setText(QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")"); else lbl_connections->setText(QString::number(h.num_connections())); + // Update next announce time + reannounce_lbl->setText(h.next_announce()); // Update ratio info const double ratio = BTSession->getRealRatio(h.hash()); if(ratio > 100.) diff --git a/src/propertieswidget.h b/src/propertieswidget.h index 1e87588a6..f0d18124f 100644 --- a/src/propertieswidget.h +++ b/src/propertieswidget.h @@ -100,6 +100,7 @@ protected slots: void showPiecesAvailability(bool show); void updateSavePath(QTorrentHandle& h); void renameSelectedFile(); + void on_reannounce_btn_clicked(); public slots: void loadDynamicData(); diff --git a/src/qtorrenthandle.cpp b/src/qtorrenthandle.cpp index 4d16ed451..4a131ec26 100644 --- a/src/qtorrenthandle.cpp +++ b/src/qtorrenthandle.cpp @@ -79,6 +79,16 @@ QString QTorrentHandle::creation_date() const { return misc::boostTimeToQString(boostDate); } +QString QTorrentHandle::next_announce() const { + Q_ASSERT(h.is_valid()); + return misc::userFriendlyDuration(h.status().next_announce.total_seconds()); +} + +qlonglong QTorrentHandle::next_announce_s() const { + Q_ASSERT(h.is_valid()); + return h.status().next_announce.total_seconds(); +} + float QTorrentHandle::progress() const { Q_ASSERT(h.is_valid()); if(!h.status().total_wanted) diff --git a/src/qtorrenthandle.h b/src/qtorrenthandle.h index 64ce17d5f..b9b1f542a 100644 --- a/src/qtorrenthandle.h +++ b/src/qtorrenthandle.h @@ -121,6 +121,8 @@ class QTorrentHandle { bool super_seeding() const; #endif QString creation_date() const; + QString next_announce() const; + qlonglong next_announce_s() const; void get_peer_info(std::vector&) const; #ifndef DISABLE_GUI bool resolve_countries() const; diff --git a/src/ui/propertieswidget.ui b/src/ui/propertieswidget.ui index f1828dc70..81c9781d5 100644 --- a/src/ui/propertieswidget.ui +++ b/src/ui/propertieswidget.ui @@ -53,9 +53,9 @@ 0 - -60 + 0 520 - 351 + 360 @@ -310,16 +310,49 @@ - + Reannounce in: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - + + + + + + 0 + 0 + + + + + + + + + + + Force reannounce + + + + + + + :/Icons/oxygen/run-build.png:/Icons/oxygen/run-build.png + + + + 12 + 12 + + + + +