1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-09 18:32:15 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Christophe Dumez
91d9325c7c - Tagged rc3 release 2007-09-30 17:50:52 +00:00
70 changed files with 3193 additions and 3383 deletions

View File

@@ -6,7 +6,6 @@
- FEATURE: Added RSS support
- FEATURE: Support files prioritizing in a torrent
- FEATURE: Brand new search engine plugins system
- FEATURE: Filtered files don't appear on hard disk anymore
- FEATURE: Finished torrents are now moved to another tab for seeding
- FEATURE: Display more infos about the torrent in its properties
- FEATURE: Allow the user to edit torrents' trackers

View File

@@ -1,4 +1,4 @@
qBittorrent - A BitTorrent client in C++ / Qt4
qBittorrent - A BitTorrent client in C++ / Qt4.2
------------------------------------------
*** Necessary if qt3 is default on your system ***
@@ -14,7 +14,7 @@ qbittorrent
will install and execute qBittorrent hopefully without any problems.
Dependencies:
- Qt >= 4.3.0 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
- Qt >= 4.2 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
- rblibtorrent by Arvid Norberg (>= v0.13 REQUIRED)
-> http://www.qbittorrent.org/download.php (advised)

15
TODO
View File

@@ -52,16 +52,11 @@
// in v1.0.0 - FEATURE FREEZE
- Fix all (or almost all) opened bugs in bug tracker
- debug new torrent content selection
- Recheck doc
- Translations update (IN PROGRESS)
- add qt4-qtconfig as package dependency
- Make use of total_wanted
rc4->rc5 changelog:
- BUGFIX: Now filtered don't appear on hard drive anymore (libtorrent >= r1659)
- BUGFIX: AddInPause setting doesn't pause downloads on startup anymore
- BUGFIX: Fixed an ETA calculation problem when the torrent has filtered files
- BUGFIX: Fixed possible overflow in ETA calculation
- BUGFIX: Fixed "Missing Input path" error when creating a torrent
- BUGFIX: Fixed some notification messages for torrent addition dialog
- BUGFIX: Fixed "Automatically start seeding" feature in torrent creation tool
- COSMETIC: Improved progress bar text rendering
rc2->rc3 changelog:
- BUGFIX: Fixed a proxy problem causing connections to be rejected by trackers
- BUGFIX: Fixed compilation problem on FreeBSD

View File

@@ -83,9 +83,12 @@ class DLListDelegate: public QItemDelegate {
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = true;
newopt.textVisible = false;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
painter);
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
painter->setPen(opt.palette.color(cg, QPalette::WindowText));
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
break;
}
default:

View File

@@ -76,9 +76,12 @@ class FinishedListDelegate: public QItemDelegate {
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = true;
newopt.textVisible = false;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
painter);
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
painter->setPen(opt.palette.color(cg, QPalette::WindowText));
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
break;
}
default:

View File

@@ -513,7 +513,7 @@ void GUI::closeEvent(QCloseEvent *e) {
// Display window to create a torrent
void GUI::on_actionCreate_torrent_triggered() {
createtorrent *ct = new createtorrent(this);
connect(ct, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString)));
connect(ct, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString path)));
}
// Called when we minimize the program
@@ -557,7 +557,7 @@ void GUI::dropEvent(QDropEvent *event) {
if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
connect(dialog, SIGNAL(setInfoBarGUI(QString, QColor)), downloadingTorrentTab, SLOT(setInfoBar(QString, QColor)));
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), downloadingTorrentTab, SLOT(setInfoBar(QString, QString)));
dialog->showLoad(file);
}else{
BTSession->addTorrent(file);
@@ -598,7 +598,7 @@ void GUI::on_actionOpen_triggered() {
if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
connect(dialog, SIGNAL(setInfoBarGUI(QString, QColor)), downloadingTorrentTab, SLOT(setInfoBar(QString, QColor)));
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), downloadingTorrentTab, SLOT(setInfoBar(QString, QString)));
dialog->showLoad(pathsList.at(i));
}else{
BTSession->addTorrent(pathsList.at(i));

View File

@@ -4,20 +4,19 @@ Comment=V1.0.0
Encoding=UTF-8
Exec=qbittorrent
GenericName=Bittorrent client
GenericName[bg]=Торент клиент
GenericName[de]=Bittorren Client
GenericName[el]=Τορεντ πελάτης
GenericName[es]=Cliente Bittorrent
GenericName[fr]=Client Bittorrent
GenericName[ja]=Bittorrent クライアント
GenericName[ko]=비토렌트 클라이언트
GenericName[nl]=Bittorrent client
GenericName[pl]=Klient Bittorrent
GenericName[ru]=клиент Bittorrent
GenericName[es]=Cliente Bittorrent
GenericName[sv]=Bittorrent-klient
GenericName[tr]=Bittorrent istemcisi
GenericName[uk]=Bittorrent-клієнт
GenericName[de]=Bittorren Client
GenericName[pl]=Klient Bittorrent
GenericName[zh]=Bittorrent之用户
GenericName[ko]=비토렌트 클라이언트
GenericName[el]=Τορεντ πελάτης
GenericName[bg]=Торент клиент
GenericName[uk]=Bittorrent-клієнт
GenericName[ru]=клиент Bittorrent
Icon=qbittorrent
MimeType=application/x-bittorrent
Name=qBittorrent

View File

@@ -61,8 +61,11 @@ class PreviewListDelegate: public QItemDelegate {
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = true;
newopt.textVisible = false;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
painter->setPen(opt.palette.color(cg, QPalette::WindowText));
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
break;
}
default:

View File

@@ -75,8 +75,11 @@ class PropListDelegate: public QItemDelegate {
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = true;
newopt.textVisible = false;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
painter->setPen(opt.palette.color(cg, QPalette::WindowText));
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
break;
}
case PRIORITY:{

View File

@@ -27,6 +27,7 @@
#include "bittorrent.h"
#include "misc.h"
#include "downloadThread.h"
#include "deleteThread.h"
#include <libtorrent/extensions/metadata_transfer.hpp>
#include <libtorrent/extensions/ut_pex.hpp>
@@ -34,6 +35,7 @@
#include <libtorrent/bencode.hpp>
#include <libtorrent/identify_client.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/ip_filter.hpp>
#include <libtorrent/torrent_info.hpp>
#include <boost/filesystem/exception.hpp>
@@ -61,6 +63,8 @@ bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false
downloader = new downloadThread(this);
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
// File deleter (thread)
deleter = new deleteThread(this);
qDebug("* BTSession constructed");
}
@@ -69,6 +73,7 @@ bittorrent::~bittorrent() {
// Disable directory scanning
disableDirectoryScanning();
// Delete our objects
delete deleter;
delete timerAlerts;
delete ETARefresher;
delete downloader;
@@ -78,16 +83,20 @@ bittorrent::~bittorrent() {
void bittorrent::preAllocateAllFiles(bool b) {
preAllocateAll = b;
// Reload All Torrents
std::vector<torrent_handle> handles = s->get_torrents();
unsigned int nbHandles = handles.size();
for(unsigned int i=0; i<nbHandles; ++i) {
QTorrentHandle h = handles[i];
if(!h.is_valid()) {
qDebug("/!\\ Error: Invalid handle");
continue;
if(b) {
// Reload All Torrents
std::vector<torrent_handle> handles = s->get_torrents();
unsigned int nbHandles = handles.size();
for(unsigned int i=0; i<nbHandles; ++i) {
QTorrentHandle h = handles[i];
if(!h.is_valid()) {
qDebug("/!\\ Error: Invalid handle");
continue;
}
QString hash = h.hash();
if(has_filtered_files(hash)) continue;
reloadTorrent(h);
}
pauseAndReloadTorrent(h, b);
}
}
@@ -140,13 +149,11 @@ void bittorrent::updateETAs() {
if(h.is_paused()) continue;
QString hash = h.hash();
QList<qlonglong> listEtas = ETAstats.value(hash, QList<qlonglong>());
// XXX: We can still get an overflow if remaining file size is approximately
// 8.38*10^5 TiB (let's assume this can't happen)
if(h.download_payload_rate() > 0.1) {
if(listEtas.size() == ETAS_MAX_VALUES) {
listEtas.removeFirst();
}
listEtas << (qlonglong)((h.actual_size()-h.total_wanted_done())/(double)h.download_payload_rate());
if(listEtas.size() == ETAS_MAX_VALUES) {
listEtas.removeFirst();
}
if(h.download_payload_rate()) {
listEtas << (qlonglong)((h.actual_size()-h.total_done())/(double)h.download_payload_rate());
ETAstats[hash] = listEtas;
qlonglong moy = 0;
qlonglong val;
@@ -154,16 +161,12 @@ void bittorrent::updateETAs() {
Q_ASSERT(nbETAs);
foreach(val, listEtas) {
moy += (qlonglong)((double)val/(double)nbETAs);
Q_ASSERT(moy >= 0);
if(moy < 0) break;
}
ETAs[hash] = moy;
} else {
// Speed is too low, we don't want an overflow.
if(ETAstats.contains(hash)) {
ETAstats.remove(hash);
}
if(ETAs.contains(hash)) {
if(moy < 0) {
ETAs.remove(hash);
} else {
ETAs[hash] = moy;
}
}
}
@@ -206,13 +209,12 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
}
QString savePath = h.save_path();
QString fileName = h.name();
// Remove it from session
if(permanent) {
qDebug("Removing this on hard drive: %s", qPrintable(savePath+QDir::separator()+fileName));
s->remove_torrent(h.get_torrent_handle(), session::delete_files);
} else {
s->remove_torrent(h.get_torrent_handle());
arborescence *files_arb = 0;
if(permanent){
files_arb = new arborescence(h.get_torrent_info());
}
// Remove it from session
s->remove_torrent(h.get_torrent_handle());
// Remove it from torrent backup directory
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
QStringList filters;
@@ -227,10 +229,6 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
ETAs.remove(hash);
// Remove tracker errors
trackersErrors.remove(hash);
// Remove from reloadingTorrents if reloading
if(reloadingTorrents.contains(hash)) {
reloadingTorrents.remove(hash);
}
// Remove it from ratio table
ratioData.remove(hash);
int index = finishedTorrents.indexOf(hash);
@@ -244,6 +242,12 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
std::cerr << "Error: Torrent " << hash.toStdString() << " is neither in finished or unfinished list\n";
}
}
if(permanent && files_arb != 0) {
// Remove from Hard drive
qDebug("Removing this on hard drive: %s", qPrintable(savePath+QDir::separator()+fileName));
// Deleting in a thread to avoid GUI freeze
deleter->deleteTorrent(savePath, files_arb);
}
}
// Return a list of hashes for the finished torrents
@@ -370,7 +374,7 @@ void bittorrent::loadWebSeeds(QString hash) {
}
// Add a torrent to the bittorrent session
void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bool resumed) {
void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
QTorrentHandle h;
entry resume_data;
bool fastResume=false;
@@ -440,12 +444,12 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
}
QString savePath = getSavePath(hash);
// Adding files to bittorrent session
if(preAllocateAll) {
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, storage_mode_allocate, true);
if(has_filtered_files(hash) || preAllocateAll) {
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false, true);
qDebug(" -> Full allocation mode");
}else{
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, storage_mode_sparse, true);
qDebug(" -> Sparse allocation mode");
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, true, true);
qDebug(" -> Compact allocation mode");
}
if(!h.is_valid()) {
// No need to keep on, it failed.
@@ -482,7 +486,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
QFile::copy(file, newFile);
}
// Pause torrent if it was paused last time
if((!resumed && addInPause) || QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")) {
if(addInPause || QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")) {
torrentsToPauseAfterChecking << hash;
qDebug("Adding a torrent to the torrentsToPauseAfterChecking list");
}
@@ -1116,9 +1120,10 @@ void bittorrent::readAlerts() {
if(index != -1){
waitingForPause.removeAt(index);
}
if(reloadingTorrents.contains(hash)) {
reloadTorrent(h, reloadingTorrents.value(hash));
reloadingTorrents.remove(hash);
index = reloadingTorrents.indexOf(hash);
if(index != -1) {
reloadingTorrents.removeAt(index);
reloadTorrent(h);
}
}
}
@@ -1164,7 +1169,7 @@ QStringList bittorrent::getTorrentsToPauseAfterChecking() const{
// Function to reload the torrent async after the torrent is actually
// paused so that we can get fastresume data
void bittorrent::pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc) {
void bittorrent::pauseAndReloadTorrent(QTorrentHandle h) {
if(!h.is_valid()) {
std::cerr << "/!\\ Error: Invalid handle\n";
return;
@@ -1172,14 +1177,14 @@ void bittorrent::pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc) {
// ask to pause the torrent (async)
h.pause();
QString hash = h.hash();
// Add it to reloadingTorrents has table so that we now we
// Add it to reloadingTorrents list so that we now we
// we should reload the torrent once we receive the
// torrent_paused_alert. pause() is async now...
reloadingTorrents[hash] = full_alloc;
reloadingTorrents << hash;
}
// Reload a torrent with full allocation mode
void bittorrent::reloadTorrent(const QTorrentHandle &h, bool full_alloc) {
void bittorrent::reloadTorrent(const QTorrentHandle &h) {
qDebug("** Reloading a torrent");
if(!h.is_valid()) {
qDebug("/!\\ Error: Invalid handle");
@@ -1210,11 +1215,7 @@ void bittorrent::reloadTorrent(const QTorrentHandle &h, bool full_alloc) {
SleeperThread::msleep(1000);
++timeout;
}
QTorrentHandle new_h;
if(full_alloc)
new_h = s->add_torrent(t, saveDir, resumeData, storage_mode_allocate);
else
new_h = s->add_torrent(t, saveDir, resumeData, storage_mode_sparse);
QTorrentHandle new_h = s->add_torrent(t, saveDir, resumeData, false);
qDebug("Using full allocation mode");
// Connections limit per torrent
new_h.set_max_connections(maxConnecsPerTorrent);
@@ -1335,7 +1336,7 @@ void bittorrent::applyEncryptionSettings(pe_settings se) {
s->set_pe_settings(se);
}
// Will fast resume torrents in
// Will fast resume unfinished torrents in
// backup directory
void bittorrent::resumeUnfinishedTorrents() {
qDebug("Resuming unfinished torrents");
@@ -1351,7 +1352,7 @@ void bittorrent::resumeUnfinishedTorrents() {
}
// Resume downloads
foreach(fileName, filePaths) {
addTorrent(fileName, false, QString(), true);
addTorrent(fileName, false);
}
qDebug("Unfinished torrents resumed");
}

View File

@@ -27,12 +27,12 @@
#include <QStringList>
#include <libtorrent/session.hpp>
#include <libtorrent/ip_filter.hpp>
#include "qtorrenthandle.h"
using namespace libtorrent;
class downloadThread;
class deleteThread;
class QTimer;
class bittorrent : public QObject{
@@ -47,12 +47,13 @@ class bittorrent : public QObject{
downloadThread *downloader;
QString defaultSavePath;
QStringList torrentsToPauseAfterChecking;
QHash<QString, bool> reloadingTorrents;
QStringList reloadingTorrents;
QHash<QString, QList<qlonglong> > ETAstats;
QHash<QString, qlonglong> ETAs;
QHash<QString, QPair<size_type,size_type> > ratioData;
QTimer *ETARefresher;
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
deleteThread *deleter;
QStringList waitingForPause;
QStringList finishedTorrents;
QStringList unfinishedTorrents;
@@ -88,7 +89,7 @@ class bittorrent : public QObject{
bool has_filtered_files(QString hash) const;
public slots:
void addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
void addTorrent(QString path, bool fromScanDir = false, QString from_url = QString());
void downloadFromUrl(QString url);
void downloadFromURLList(const QStringList& url_list);
void deleteTorrent(QString hash, bool permanent = false);
@@ -102,6 +103,7 @@ class bittorrent : public QObject{
void enablePeerExchange();
void enableIPFilter(ip_filter filter);
void disableIPFilter();
void pauseAndReloadTorrent(QTorrentHandle h);
void resumeUnfinishedTorrents();
void updateETAs();
void saveTorrentSpeedLimits(QString hash);
@@ -141,8 +143,7 @@ class bittorrent : public QObject{
void processDownloadedFile(QString, QString);
bool loadTrackerFile(QString hash);
void saveTrackerFile(QString hash);
void pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc);
void reloadTorrent(const QTorrentHandle &h, bool full_alloc); // This is protected now, call pauseAndReloadTorrent() instead
void reloadTorrent(const QTorrentHandle &h); // This is protected now, call pauseAndReloadTorrent() instead
void deleteBigRatios();
signals:

View File

@@ -141,7 +141,7 @@ QStringList createtorrent::allItems(QListWidget *list){
// Main function that create a .torrent file
void createtorrent::on_createButton_clicked(){
QString input = textInputPath->text().trimmed();
if(input.isEmpty()){
if(input.isEmpty() == 0){
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
return;
}
@@ -199,7 +199,6 @@ void createtorrent::on_createButton_clicked(){
// create the torrent and print it to out
entry e = t->create_torrent();
libtorrent::bencode(std::ostream_iterator<char>(out), e);
out.flush();
if(checkStartSeeding->isChecked())
emit torrent_to_seed(destination);
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More