- Display swarm information in download list too

This commit is contained in:
Christophe Dumez 2009-07-12 07:51:58 +00:00
parent bca898d8b6
commit ca83fdecff
6 changed files with 25 additions and 24 deletions

View file

@ -1,5 +1,5 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - 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

View file

@ -40,7 +40,6 @@
#include <QStandardItemModel>
#include <QHeaderView>
#include <QMenu>
#include <QTimer>
#include <QMessageBox>
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<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle>::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);

View file

@ -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:

View file

@ -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<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle>::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.;

View file

@ -70,6 +70,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
// Bittorrent
bittorrent *BTSession;
QTimer *checkConnect;
QTimer *scrapeTimer;
QList<QPair<QTorrentHandle,QString> > 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);

View file

@ -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))));