From 931cfb6783bfc2189dc17bf27393b65306db1c66 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 27 Dec 2006 23:56:30 +0000 Subject: [PATCH] - Based on libtorrent v0.12 (still unreleased, use libtorrent cvs) - Added Peer Exchange (PeX) - Display number of complete/incomplete sources in download list for each torrent - Updated version to v0.9.0beta1 --- Changelog | 4 +- INSTALL | 2 +- qcm/libtorrent.qcm | 6 +- src/GUI.cpp | 15 ++--- src/about_imp.h | 2 +- src/createtorrent_imp.cpp | 16 +++-- src/properties.ui | 133 ++------------------------------------ src/properties_imp.cpp | 43 ------------ 8 files changed, 28 insertions(+), 193 deletions(-) diff --git a/Changelog b/Changelog index e3d8270f2..8e1461465 100644 --- a/Changelog +++ b/Changelog @@ -1,12 +1,14 @@ * Unknown - Christophe Dumez - v0.9.0 + - FEATURE: Based on libtorrent v0.12 - FEATURE: Based on Qt 4.2 - FEATURE: Brand new trayicon from Qt 4.2 + - FEATURE: Support Peer Exchange (PeX) - FEATURE: Added a menu action to visit qBittorrent website - FEATURE: Added a menu action to report a bug in qBittorrent - FEATURE: Use hashtables for faster lookup - FEATURE: Improved the way parameters are passed between qBT instances (socket) - FEATURE: User is warned when hard drive becomes full and downloads are paused - - FEATURE: Seeds / Leechers are displayed in download list as well as in torrent properties + - FEATURE: Number of complete/incomplete sources are now displayed in download list for each torrent - BUGFIX: Fixed download from url that would fail sometimes - BUGFIX: Save directory was reset to default when filtering files in torrent - BUGFIX: Force a refresh of download list when the window is shown (avoid delay) diff --git a/INSTALL b/INSTALL index 5f5990ba9..1e05d2aa4 100644 --- a/INSTALL +++ b/INSTALL @@ -16,7 +16,7 @@ will install and execute qBittorrent hopefully without any problems. Dependencies: - Qt >= 4.2 (libqt-devel, libqtgui, libqtcore, libqtnetwork) -- rb_libtorrent by Arvid Norberg (>= v0.11 REQUIRED) +- libtorrent by Arvid Norberg (>= v0.12 REQUIRED) -> http://libtorrent.sf.net Be carefull: another library (the one used by rtorrent) use the same name. These are TWO different libraries and qBittorrent will only work with the one provided diff --git a/qcm/libtorrent.qcm b/qcm/libtorrent.qcm index 5497b241f..f7ab7f532 100644 --- a/qcm/libtorrent.qcm +++ b/qcm/libtorrent.qcm @@ -7,7 +7,7 @@ class qc_libtorrent : public ConfObj { public: qc_libtorrent(Conf *c) : ConfObj(c) {} - QString name() const { return "libtorrent >= 0.11"; } + QString name() const { return "libtorrent >= 0.12"; } QString shortname() const { return "libtorrent"; } bool exec(){ QString s; @@ -15,8 +15,8 @@ public: sl += "/usr/include"; sl += "/usr/local/include"; sl += "/sw/include"; - if(!conf->findHeader("libtorrent/kademlia/node.hpp", sl, &s)) { - qWarning("libtorrent v0.11 includes not found!\nYou can download it at http://www.libtorrent.net"); + if(!conf->findHeader("libtorrent/extensions/ut_pex.hpp", sl, &s)) { + qWarning("libtorrent v0.12 includes not found!\nYou can download it at http://www.libtorrent.net"); return false; } conf->addIncludePath(s); diff --git a/src/GUI.cpp b/src/GUI.cpp index 34704cbdd..794524010 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -40,6 +40,9 @@ #include #include +#include +#include + #include "GUI.h" #include "misc.h" #include "createtorrent_imp.h" @@ -127,7 +130,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ DHTEnabled = false; // Configure BT session according to options configureSession(); - s->disable_extensions(); + s->add_extension(&create_metadata_plugin); + s->add_extension(&create_ut_pex_plugin); // download thread downloader = new downloadThread(this); connect(downloader, SIGNAL(downloadFinished(QString, QString, int, QString)), this, SLOT(processDownloadedFile(QString, QString, int, QString))); @@ -523,14 +527,9 @@ void GUI::updateDlList(bool force){ DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)torrentStatus.upload_payload_rate)); break; default: - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_complete, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_incomplete, true).c_str()))); DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); } - if(torrentStatus.num_complete == -1 && torrentStatus.num_incomplete == -1){ - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(tr("Unknown"))); - }else{ - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_complete, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_incomplete, true).c_str()))); - } + DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString(misc::toString(torrentStatus.num_seeds, true).c_str())+"/"+QString(misc::toString(torrentStatus.num_peers - torrentStatus.num_seeds, true).c_str()))); } }catch(invalid_handle e){ continue; @@ -1296,7 +1295,7 @@ void GUI::addTorrent(const QString& path, bool fromScanDir, const QString& from_ DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)t.total_size())); DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.)); DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.)); - DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(tr("Unknown"))); + DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0")); DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); // Pause torrent if it was paused last time if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+QString(t.name().c_str())+".paused")){ diff --git a/src/about_imp.h b/src/about_imp.h index 62b49f6cc..d154ab1c4 100644 --- a/src/about_imp.h +++ b/src/about_imp.h @@ -23,7 +23,7 @@ #define ABOUT_H #include "ui_about.h" -#define VERSION "v0.9.0alpha1" +#define VERSION "v0.9.0beta1" class about : public QDialog, private Ui::AboutDlg{ Q_OBJECT diff --git a/src/createtorrent_imp.cpp b/src/createtorrent_imp.cpp index 1b494a504..862cbe1b9 100644 --- a/src/createtorrent_imp.cpp +++ b/src/createtorrent_imp.cpp @@ -26,12 +26,13 @@ #include #include -#include "libtorrent/entry.hpp" -#include "libtorrent/bencode.hpp" -#include "libtorrent/torrent_info.hpp" -#include "libtorrent/file.hpp" -#include "libtorrent/storage.hpp" -#include "libtorrent/hasher.hpp" +#include +#include +#include +#include +#include +#include +#include #include "createtorrent_imp.h" @@ -105,7 +106,8 @@ void createtorrent::on_createButton_clicked(){ add_files(t, full_path.branch_path(), full_path.leaf()); t.set_piece_size(piece_size); - storage st(t, full_path.branch_path()); + file_pool fp; + storage st(t, full_path.branch_path(), fp); QStringList trackers = txt_announce->toPlainText().split('\n'); for(int i=0; i0 0 538 - 585 + 567 @@ -86,138 +86,13 @@ 6 - - - - Sans Serif - 9 - 50 - false - false - false - false - - - - Download state: - - - - - - - 0 - - - 6 - - - - - - - - - - - - Qt::Horizontal - - - - 111 - 20 - - - - - - - - - - - - 0 - - - 6 - - - - - - Sans Serif - 9 - 50 - false - false - false - false - - - - Seeders: - - - - - - - - - - - - + - Sans Serif - 9 - 50 - false - false - false - false + 75 + true - - Leechers: - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - 6 - - - Save path: diff --git a/src/properties_imp.cpp b/src/properties_imp.cpp index 335076240..20eb042c0 100644 --- a/src/properties_imp.cpp +++ b/src/properties_imp.cpp @@ -46,32 +46,6 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr torrent_status torrentStatus = h.status(); torrent_info torrentInfo = h.get_torrent_info(); fileName->setText(torrentInfo.name().c_str()); - torrent_status::state_t state = torrentStatus.state; - switch(state){ - case torrent_status::finished: - dlState->setText(tr("Finished")); - break; - case torrent_status::queued_for_checking: - dlState->setText(tr("Queued for checking")); - break; - case torrent_status::checking_files: - dlState->setText(tr("Checking files")); - break; - case torrent_status::connecting_to_tracker: - dlState->setText(tr("Connecting to tracker")); - break; - case torrent_status::downloading_metadata: - dlState->setText(tr("Downloading Metadata")); - break; - case torrent_status::downloading: - dlState->setText(tr("Downloading")); - break; - case torrent_status::seeding: - dlState->setText(tr("Seeding")); - break; - case torrent_status::allocating: - dlState->setText(tr("Allocating")); - } QString tracker = QString(torrentStatus.current_tracker.c_str()).trimmed(); if(!tracker.isEmpty()){ trackerURL->setText(tracker); @@ -98,23 +72,6 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr snprintf(tmp, MAX_CHAR_TMP, "%.1f", ratio); shareRatio->setText(tmp); } - - float complete, partial; - QString completeStr, partialStr; - complete = torrentStatus.num_complete; - if(complete == -1){ - completeStr = tr("Unknown"); - }else{ - completeStr = QString(misc::toString(complete).c_str()); - } - partial = torrentStatus.num_incomplete; - if(partial == -1){ - partialStr = tr("Unknown"); - }else{ - partialStr = QString(misc::toString(partial).c_str()); - } - nbSeeds->setText(completeStr); - nbLeechers->setText(partialStr); // Tracker Errors for(int i=0; i < trackerErrors.size(); ++i){ this->trackerErrors->append(trackerErrors.at(i));