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 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.4.0 * 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: Allow to define temporary download folder
- FEATURE: Display total amount of uploaded data in finished list - FEATURE: Display total amount of uploaded data in finished list
- FEATURE: Resizing a column in a search results tab affects all tabs - FEATURE: Resizing a column in a search results tab affects all tabs

19
src/FinishedTorrents.cpp

@ -40,7 +40,6 @@
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QHeaderView> #include <QHeaderView>
#include <QMenu> #include <QMenu>
#include <QTimer>
#include <QMessageBox> #include <QMessageBox>
FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : parent(parent), BTSession(BTSession), nbFinished(0){ 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(actionHOSColPeers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnPeers()));
connect(actionHOSColUpload, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpload())); connect(actionHOSColUpload, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpload()));
connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio())); connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio()));
scrapeTimer = new QTimer(this);
connect(scrapeTimer, SIGNAL(timeout()), this, SLOT(scrapeTrackers()));
scrapeTimer->start(20000);
} }
FinishedTorrents::~FinishedTorrents(){ FinishedTorrents::~FinishedTorrents(){
saveColWidthFinishedList(); saveColWidthFinishedList();
saveHiddenColumns(); saveHiddenColumns();
scrapeTimer->stop();
delete scrapeTimer;
delete finishedListDelegate; delete finishedListDelegate;
delete finishedListModel; 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) { void FinishedTorrents::notifyTorrentDoubleClicked(const QModelIndex& index) {
unsigned int row = index.row(); unsigned int row = index.row();
QString hash = getHashFromRow(row); QString hash = getHashFromRow(row);

3
src/FinishedTorrents.h

@ -37,7 +37,6 @@
class QStandardItemModel; class QStandardItemModel;
class bittorrent; class bittorrent;
class FinishedListDelegate; class FinishedListDelegate;
class QTimer;
using namespace libtorrent; using namespace libtorrent;
@ -53,7 +52,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
bool loadHiddenColumns(); bool loadHiddenColumns();
void saveHiddenColumns(); void saveHiddenColumns();
QAction* getActionHoSCol(int index); QAction* getActionHoSCol(int index);
QTimer *scrapeTimer;
public: public:
FinishedTorrents(QObject *parent, bittorrent *BTSession); FinishedTorrents(QObject *parent, bittorrent *BTSession);
@ -85,7 +83,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void hideOrShowColumnPeers(); void hideOrShowColumnPeers();
void hideOrShowColumnUpload(); void hideOrShowColumnUpload();
void hideOrShowColumnRatio(); void hideOrShowColumnRatio();
void scrapeTrackers();
void forceRecheck(); void forceRecheck();
public slots: public slots:

15
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()) { if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) {
show(); show();
} }
scrapeTimer = new QTimer(this);
connect(scrapeTimer, SIGNAL(timeout()), this, SLOT(scrapeTrackers()));
scrapeTimer->start(20000);
qDebug("GUI Built"); qDebug("GUI Built");
} }
@ -260,6 +263,8 @@ GUI::~GUI() {
BTSession->saveDHTEntry(); BTSession->saveDHTEntry();
BTSession->saveSessionState(); BTSession->saveSessionState();
BTSession->saveFastResumeData(); BTSession->saveFastResumeData();
scrapeTimer->stop();
delete scrapeTimer;
delete dlSpeedLbl; delete dlSpeedLbl;
delete upSpeedLbl; delete upSpeedLbl;
delete ratioLbl; 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() { void GUI::updateRatio() {
// Update ratio info // Update ratio info
float ratio = 1.; float ratio = 1.;

2
src/GUI.h

@ -70,6 +70,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
// Bittorrent // Bittorrent
bittorrent *BTSession; bittorrent *BTSession;
QTimer *checkConnect; QTimer *checkConnect;
QTimer *scrapeTimer;
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers;
// GUI related // GUI related
QTabWidget *tabs; QTabWidget *tabs;
@ -177,6 +178,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
bool initWebUi(QString username, QString password, int port); bool initWebUi(QString username, QString password, int port);
void on_actionIncreasePriority_triggered(); void on_actionIncreasePriority_triggered();
void on_actionDecreasePriority_triggered(); void on_actionDecreasePriority_triggered();
void scrapeTrackers();
// Options slots // Options slots
void on_actionOptions_triggered(); void on_actionOptions_triggered();
void OptionsSaved(bool deleteOptions); void OptionsSaved(bool deleteOptions);

8
src/downloadingTorrents.cpp

@ -554,7 +554,13 @@ bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
} }
} }
if(!downloadList->isColumnHidden(SEEDSLEECH)) { 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)) { if(!downloadList->isColumnHidden(RATIO)) {
DLListModel->setData(DLListModel->index(row, RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash)))); DLListModel->setData(DLListModel->index(row, RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));

Loading…
Cancel
Save