Browse Source

- Display swarm information in download list too

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
ca83fdecff
  1. 2
      Changelog
  2. 19
      src/FinishedTorrents.cpp
  3. 3
      src/FinishedTorrents.h
  4. 15
      src/GUI.cpp
  5. 2
      src/GUI.h
  6. 8
      src/downloadingTorrents.cpp

2
Changelog

@ -1,5 +1,5 @@ @@ -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

19
src/FinishedTorrents.cpp

@ -40,7 +40,6 @@ @@ -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 @@ -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);

3
src/FinishedTorrents.h

@ -37,7 +37,6 @@ @@ -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 { @@ -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 { @@ -85,7 +83,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void hideOrShowColumnPeers();
void hideOrShowColumnUpload();
void hideOrShowColumnRatio();
void scrapeTrackers();
void forceRecheck();
public slots:

15
src/GUI.cpp

@ -249,6 +249,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -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() { @@ -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) { @@ -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.;

2
src/GUI.h

@ -70,6 +70,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -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{ @@ -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);

8
src/downloadingTorrents.cpp

@ -554,7 +554,13 @@ bool DownloadingTorrents::updateTorrent(QTorrentHandle h) { @@ -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))));

Loading…
Cancel
Save