- 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
This commit is contained in:
Christophe Dumez 2006-12-27 23:56:30 +00:00
commit 931cfb6783
8 changed files with 31 additions and 196 deletions

View file

@ -40,6 +40,9 @@
#include <boost/filesystem/exception.hpp>
#include <curl/curl.h>
#include <libtorrent/extensions/metadata_transfer.hpp>
#include <libtorrent/extensions/ut_pex.hpp>
#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")){

View file

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

View file

@ -26,12 +26,13 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#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 <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 <libtorrent/file_pool.hpp>
#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; i<trackers.size(); ++i){
t.add_tracker((const char*)trackers.at(i).toUtf8());

View file

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>538</width>
<height>585</height>
<height>567</height>
</rect>
</property>
<property name="windowTitle" >
@ -77,137 +77,6 @@
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="font" >
<font>
<family>Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="text" >
<string>Download state:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="dlState" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>111</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lbl_seeds" >
<property name="font" >
<font>
<family>Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="text" >
<string>Seeders:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nbSeeds" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_leechers" >
<property name="font" >
<font>
<family>Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="text" >
<string>Leechers:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nbLeechers" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
@ -218,6 +87,12 @@
</property>
<item>
<widget class="QLabel" name="savePath_lbl" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Save path:</string>
</property>

View file

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