You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-10-14 11:52:15 +02:00
Compare commits
1 Commits
release-1.
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
91d9325c7c |
@@ -6,7 +6,6 @@
|
|||||||
- FEATURE: Added RSS support
|
- FEATURE: Added RSS support
|
||||||
- FEATURE: Support files prioritizing in a torrent
|
- FEATURE: Support files prioritizing in a torrent
|
||||||
- FEATURE: Brand new search engine plugins system
|
- 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: Finished torrents are now moved to another tab for seeding
|
||||||
- FEATURE: Display more infos about the torrent in its properties
|
- FEATURE: Display more infos about the torrent in its properties
|
||||||
- FEATURE: Allow the user to edit torrents' trackers
|
- FEATURE: Allow the user to edit torrents' trackers
|
||||||
|
4
INSTALL
4
INSTALL
@@ -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 ***
|
*** Necessary if qt3 is default on your system ***
|
||||||
@@ -14,7 +14,7 @@ qbittorrent
|
|||||||
will install and execute qBittorrent hopefully without any problems.
|
will install and execute qBittorrent hopefully without any problems.
|
||||||
|
|
||||||
Dependencies:
|
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)
|
- rblibtorrent by Arvid Norberg (>= v0.13 REQUIRED)
|
||||||
-> http://www.qbittorrent.org/download.php (advised)
|
-> http://www.qbittorrent.org/download.php (advised)
|
||||||
|
15
TODO
15
TODO
@@ -52,16 +52,11 @@
|
|||||||
|
|
||||||
// in v1.0.0 - FEATURE FREEZE
|
// in v1.0.0 - FEATURE FREEZE
|
||||||
- Fix all (or almost all) opened bugs in bug tracker
|
- Fix all (or almost all) opened bugs in bug tracker
|
||||||
|
- debug new torrent content selection
|
||||||
- Recheck doc
|
- Recheck doc
|
||||||
- Translations update (IN PROGRESS)
|
- Translations update (IN PROGRESS)
|
||||||
- add qt4-qtconfig as package dependency
|
- Make use of total_wanted
|
||||||
|
|
||||||
rc4->rc5 changelog:
|
rc2->rc3 changelog:
|
||||||
- BUGFIX: Now filtered don't appear on hard drive anymore (libtorrent >= r1659)
|
- BUGFIX: Fixed a proxy problem causing connections to be rejected by trackers
|
||||||
- BUGFIX: AddInPause setting doesn't pause downloads on startup anymore
|
- BUGFIX: Fixed compilation problem on FreeBSD
|
||||||
- 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
|
|
@@ -83,9 +83,12 @@ class DLListDelegate: public QItemDelegate {
|
|||||||
newopt.maximum = 100;
|
newopt.maximum = 100;
|
||||||
newopt.minimum = 0;
|
newopt.minimum = 0;
|
||||||
newopt.state |= QStyle::State_Enabled;
|
newopt.state |= QStyle::State_Enabled;
|
||||||
newopt.textVisible = true;
|
newopt.textVisible = false;
|
||||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
|
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
|
||||||
painter);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@@ -76,9 +76,12 @@ class FinishedListDelegate: public QItemDelegate {
|
|||||||
newopt.maximum = 100;
|
newopt.maximum = 100;
|
||||||
newopt.minimum = 0;
|
newopt.minimum = 0;
|
||||||
newopt.state |= QStyle::State_Enabled;
|
newopt.state |= QStyle::State_Enabled;
|
||||||
newopt.textVisible = true;
|
newopt.textVisible = false;
|
||||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
|
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
|
||||||
painter);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@@ -513,7 +513,7 @@ void GUI::closeEvent(QCloseEvent *e) {
|
|||||||
// Display window to create a torrent
|
// Display window to create a torrent
|
||||||
void GUI::on_actionCreate_torrent_triggered() {
|
void GUI::on_actionCreate_torrent_triggered() {
|
||||||
createtorrent *ct = new createtorrent(this);
|
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
|
// Called when we minimize the program
|
||||||
@@ -557,7 +557,7 @@ void GUI::dropEvent(QDropEvent *event) {
|
|||||||
if(useTorrentAdditionDialog) {
|
if(useTorrentAdditionDialog) {
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
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);
|
dialog->showLoad(file);
|
||||||
}else{
|
}else{
|
||||||
BTSession->addTorrent(file);
|
BTSession->addTorrent(file);
|
||||||
@@ -598,7 +598,7 @@ void GUI::on_actionOpen_triggered() {
|
|||||||
if(useTorrentAdditionDialog) {
|
if(useTorrentAdditionDialog) {
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
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));
|
dialog->showLoad(pathsList.at(i));
|
||||||
}else{
|
}else{
|
||||||
BTSession->addTorrent(pathsList.at(i));
|
BTSession->addTorrent(pathsList.at(i));
|
||||||
|
@@ -4,20 +4,19 @@ Comment=V1.0.0
|
|||||||
Encoding=UTF-8
|
Encoding=UTF-8
|
||||||
Exec=qbittorrent
|
Exec=qbittorrent
|
||||||
GenericName=Bittorrent client
|
GenericName=Bittorrent client
|
||||||
GenericName[bg]=Торент клиент
|
|
||||||
GenericName[de]=Bittorren Client
|
|
||||||
GenericName[el]=Τορεντ πελάτης
|
|
||||||
GenericName[es]=Cliente Bittorrent
|
|
||||||
GenericName[fr]=Client Bittorrent
|
GenericName[fr]=Client Bittorrent
|
||||||
GenericName[ja]=Bittorrent クライアント
|
|
||||||
GenericName[ko]=비토렌트 클라이언트
|
|
||||||
GenericName[nl]=Bittorrent client
|
GenericName[nl]=Bittorrent client
|
||||||
GenericName[pl]=Klient Bittorrent
|
GenericName[es]=Cliente Bittorrent
|
||||||
GenericName[ru]=клиент Bittorrent
|
|
||||||
GenericName[sv]=Bittorrent-klient
|
GenericName[sv]=Bittorrent-klient
|
||||||
GenericName[tr]=Bittorrent istemcisi
|
GenericName[tr]=Bittorrent istemcisi
|
||||||
GenericName[uk]=Bittorrent-клієнт
|
GenericName[de]=Bittorren Client
|
||||||
|
GenericName[pl]=Klient Bittorrent
|
||||||
GenericName[zh]=Bittorrent之用户
|
GenericName[zh]=Bittorrent之用户
|
||||||
|
GenericName[ko]=비토렌트 클라이언트
|
||||||
|
GenericName[el]=Τορεντ πελάτης
|
||||||
|
GenericName[bg]=Торент клиент
|
||||||
|
GenericName[uk]=Bittorrent-клієнт
|
||||||
|
GenericName[ru]=клиент Bittorrent
|
||||||
Icon=qbittorrent
|
Icon=qbittorrent
|
||||||
MimeType=application/x-bittorrent
|
MimeType=application/x-bittorrent
|
||||||
Name=qBittorrent
|
Name=qBittorrent
|
||||||
|
@@ -61,8 +61,11 @@ class PreviewListDelegate: public QItemDelegate {
|
|||||||
newopt.maximum = 100;
|
newopt.maximum = 100;
|
||||||
newopt.minimum = 0;
|
newopt.minimum = 0;
|
||||||
newopt.state |= QStyle::State_Enabled;
|
newopt.state |= QStyle::State_Enabled;
|
||||||
newopt.textVisible = true;
|
newopt.textVisible = false;
|
||||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@@ -75,8 +75,11 @@ class PropListDelegate: public QItemDelegate {
|
|||||||
newopt.maximum = 100;
|
newopt.maximum = 100;
|
||||||
newopt.minimum = 0;
|
newopt.minimum = 0;
|
||||||
newopt.state |= QStyle::State_Enabled;
|
newopt.state |= QStyle::State_Enabled;
|
||||||
newopt.textVisible = true;
|
newopt.textVisible = false;
|
||||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case PRIORITY:{
|
case PRIORITY:{
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "bittorrent.h"
|
#include "bittorrent.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "downloadThread.h"
|
#include "downloadThread.h"
|
||||||
|
#include "deleteThread.h"
|
||||||
|
|
||||||
#include <libtorrent/extensions/metadata_transfer.hpp>
|
#include <libtorrent/extensions/metadata_transfer.hpp>
|
||||||
#include <libtorrent/extensions/ut_pex.hpp>
|
#include <libtorrent/extensions/ut_pex.hpp>
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
#include <libtorrent/bencode.hpp>
|
#include <libtorrent/bencode.hpp>
|
||||||
#include <libtorrent/identify_client.hpp>
|
#include <libtorrent/identify_client.hpp>
|
||||||
#include <libtorrent/alert_types.hpp>
|
#include <libtorrent/alert_types.hpp>
|
||||||
|
#include <libtorrent/ip_filter.hpp>
|
||||||
#include <libtorrent/torrent_info.hpp>
|
#include <libtorrent/torrent_info.hpp>
|
||||||
#include <boost/filesystem/exception.hpp>
|
#include <boost/filesystem/exception.hpp>
|
||||||
|
|
||||||
@@ -61,6 +63,8 @@ bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false
|
|||||||
downloader = new downloadThread(this);
|
downloader = new downloadThread(this);
|
||||||
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
|
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
|
||||||
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
|
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
|
||||||
|
// File deleter (thread)
|
||||||
|
deleter = new deleteThread(this);
|
||||||
qDebug("* BTSession constructed");
|
qDebug("* BTSession constructed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +73,7 @@ bittorrent::~bittorrent() {
|
|||||||
// Disable directory scanning
|
// Disable directory scanning
|
||||||
disableDirectoryScanning();
|
disableDirectoryScanning();
|
||||||
// Delete our objects
|
// Delete our objects
|
||||||
|
delete deleter;
|
||||||
delete timerAlerts;
|
delete timerAlerts;
|
||||||
delete ETARefresher;
|
delete ETARefresher;
|
||||||
delete downloader;
|
delete downloader;
|
||||||
@@ -78,16 +83,20 @@ bittorrent::~bittorrent() {
|
|||||||
|
|
||||||
void bittorrent::preAllocateAllFiles(bool b) {
|
void bittorrent::preAllocateAllFiles(bool b) {
|
||||||
preAllocateAll = b;
|
preAllocateAll = b;
|
||||||
// Reload All Torrents
|
if(b) {
|
||||||
std::vector<torrent_handle> handles = s->get_torrents();
|
// Reload All Torrents
|
||||||
unsigned int nbHandles = handles.size();
|
std::vector<torrent_handle> handles = s->get_torrents();
|
||||||
for(unsigned int i=0; i<nbHandles; ++i) {
|
unsigned int nbHandles = handles.size();
|
||||||
QTorrentHandle h = handles[i];
|
for(unsigned int i=0; i<nbHandles; ++i) {
|
||||||
if(!h.is_valid()) {
|
QTorrentHandle h = handles[i];
|
||||||
qDebug("/!\\ Error: Invalid handle");
|
if(!h.is_valid()) {
|
||||||
continue;
|
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;
|
if(h.is_paused()) continue;
|
||||||
QString hash = h.hash();
|
QString hash = h.hash();
|
||||||
QList<qlonglong> listEtas = ETAstats.value(hash, QList<qlonglong>());
|
QList<qlonglong> listEtas = ETAstats.value(hash, QList<qlonglong>());
|
||||||
// XXX: We can still get an overflow if remaining file size is approximately
|
if(listEtas.size() == ETAS_MAX_VALUES) {
|
||||||
// 8.38*10^5 TiB (let's assume this can't happen)
|
listEtas.removeFirst();
|
||||||
if(h.download_payload_rate() > 0.1) {
|
}
|
||||||
if(listEtas.size() == ETAS_MAX_VALUES) {
|
if(h.download_payload_rate()) {
|
||||||
listEtas.removeFirst();
|
listEtas << (qlonglong)((h.actual_size()-h.total_done())/(double)h.download_payload_rate());
|
||||||
}
|
|
||||||
listEtas << (qlonglong)((h.actual_size()-h.total_wanted_done())/(double)h.download_payload_rate());
|
|
||||||
ETAstats[hash] = listEtas;
|
ETAstats[hash] = listEtas;
|
||||||
qlonglong moy = 0;
|
qlonglong moy = 0;
|
||||||
qlonglong val;
|
qlonglong val;
|
||||||
@@ -154,16 +161,12 @@ void bittorrent::updateETAs() {
|
|||||||
Q_ASSERT(nbETAs);
|
Q_ASSERT(nbETAs);
|
||||||
foreach(val, listEtas) {
|
foreach(val, listEtas) {
|
||||||
moy += (qlonglong)((double)val/(double)nbETAs);
|
moy += (qlonglong)((double)val/(double)nbETAs);
|
||||||
Q_ASSERT(moy >= 0);
|
if(moy < 0) break;
|
||||||
}
|
}
|
||||||
ETAs[hash] = moy;
|
if(moy < 0) {
|
||||||
} else {
|
|
||||||
// Speed is too low, we don't want an overflow.
|
|
||||||
if(ETAstats.contains(hash)) {
|
|
||||||
ETAstats.remove(hash);
|
|
||||||
}
|
|
||||||
if(ETAs.contains(hash)) {
|
|
||||||
ETAs.remove(hash);
|
ETAs.remove(hash);
|
||||||
|
} else {
|
||||||
|
ETAs[hash] = moy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,13 +209,12 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
|
|||||||
}
|
}
|
||||||
QString savePath = h.save_path();
|
QString savePath = h.save_path();
|
||||||
QString fileName = h.name();
|
QString fileName = h.name();
|
||||||
// Remove it from session
|
arborescence *files_arb = 0;
|
||||||
if(permanent) {
|
if(permanent){
|
||||||
qDebug("Removing this on hard drive: %s", qPrintable(savePath+QDir::separator()+fileName));
|
files_arb = new arborescence(h.get_torrent_info());
|
||||||
s->remove_torrent(h.get_torrent_handle(), session::delete_files);
|
|
||||||
} else {
|
|
||||||
s->remove_torrent(h.get_torrent_handle());
|
|
||||||
}
|
}
|
||||||
|
// Remove it from session
|
||||||
|
s->remove_torrent(h.get_torrent_handle());
|
||||||
// Remove it from torrent backup directory
|
// Remove it from torrent backup directory
|
||||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
@@ -227,10 +229,6 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
|
|||||||
ETAs.remove(hash);
|
ETAs.remove(hash);
|
||||||
// Remove tracker errors
|
// Remove tracker errors
|
||||||
trackersErrors.remove(hash);
|
trackersErrors.remove(hash);
|
||||||
// Remove from reloadingTorrents if reloading
|
|
||||||
if(reloadingTorrents.contains(hash)) {
|
|
||||||
reloadingTorrents.remove(hash);
|
|
||||||
}
|
|
||||||
// Remove it from ratio table
|
// Remove it from ratio table
|
||||||
ratioData.remove(hash);
|
ratioData.remove(hash);
|
||||||
int index = finishedTorrents.indexOf(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";
|
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
|
// 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
|
// 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;
|
QTorrentHandle h;
|
||||||
entry resume_data;
|
entry resume_data;
|
||||||
bool fastResume=false;
|
bool fastResume=false;
|
||||||
@@ -440,12 +444,12 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
|
|||||||
}
|
}
|
||||||
QString savePath = getSavePath(hash);
|
QString savePath = getSavePath(hash);
|
||||||
// Adding files to bittorrent session
|
// Adding files to bittorrent session
|
||||||
if(preAllocateAll) {
|
if(has_filtered_files(hash) || preAllocateAll) {
|
||||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, storage_mode_allocate, true);
|
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false, true);
|
||||||
qDebug(" -> Full allocation mode");
|
qDebug(" -> Full allocation mode");
|
||||||
}else{
|
}else{
|
||||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, storage_mode_sparse, true);
|
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, true, true);
|
||||||
qDebug(" -> Sparse allocation mode");
|
qDebug(" -> Compact allocation mode");
|
||||||
}
|
}
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
// No need to keep on, it failed.
|
// 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);
|
QFile::copy(file, newFile);
|
||||||
}
|
}
|
||||||
// Pause torrent if it was paused last time
|
// 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;
|
torrentsToPauseAfterChecking << hash;
|
||||||
qDebug("Adding a torrent to the torrentsToPauseAfterChecking list");
|
qDebug("Adding a torrent to the torrentsToPauseAfterChecking list");
|
||||||
}
|
}
|
||||||
@@ -1116,9 +1120,10 @@ void bittorrent::readAlerts() {
|
|||||||
if(index != -1){
|
if(index != -1){
|
||||||
waitingForPause.removeAt(index);
|
waitingForPause.removeAt(index);
|
||||||
}
|
}
|
||||||
if(reloadingTorrents.contains(hash)) {
|
index = reloadingTorrents.indexOf(hash);
|
||||||
reloadTorrent(h, reloadingTorrents.value(hash));
|
if(index != -1) {
|
||||||
reloadingTorrents.remove(hash);
|
reloadingTorrents.removeAt(index);
|
||||||
|
reloadTorrent(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1164,7 +1169,7 @@ QStringList bittorrent::getTorrentsToPauseAfterChecking() const{
|
|||||||
|
|
||||||
// Function to reload the torrent async after the torrent is actually
|
// Function to reload the torrent async after the torrent is actually
|
||||||
// paused so that we can get fastresume data
|
// 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()) {
|
if(!h.is_valid()) {
|
||||||
std::cerr << "/!\\ Error: Invalid handle\n";
|
std::cerr << "/!\\ Error: Invalid handle\n";
|
||||||
return;
|
return;
|
||||||
@@ -1172,14 +1177,14 @@ void bittorrent::pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc) {
|
|||||||
// ask to pause the torrent (async)
|
// ask to pause the torrent (async)
|
||||||
h.pause();
|
h.pause();
|
||||||
QString hash = h.hash();
|
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
|
// we should reload the torrent once we receive the
|
||||||
// torrent_paused_alert. pause() is async now...
|
// torrent_paused_alert. pause() is async now...
|
||||||
reloadingTorrents[hash] = full_alloc;
|
reloadingTorrents << hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reload a torrent with full allocation mode
|
// 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");
|
qDebug("** Reloading a torrent");
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
qDebug("/!\\ Error: Invalid handle");
|
qDebug("/!\\ Error: Invalid handle");
|
||||||
@@ -1210,11 +1215,7 @@ void bittorrent::reloadTorrent(const QTorrentHandle &h, bool full_alloc) {
|
|||||||
SleeperThread::msleep(1000);
|
SleeperThread::msleep(1000);
|
||||||
++timeout;
|
++timeout;
|
||||||
}
|
}
|
||||||
QTorrentHandle new_h;
|
QTorrentHandle new_h = s->add_torrent(t, saveDir, resumeData, false);
|
||||||
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);
|
|
||||||
qDebug("Using full allocation mode");
|
qDebug("Using full allocation mode");
|
||||||
// Connections limit per torrent
|
// Connections limit per torrent
|
||||||
new_h.set_max_connections(maxConnecsPerTorrent);
|
new_h.set_max_connections(maxConnecsPerTorrent);
|
||||||
@@ -1335,7 +1336,7 @@ void bittorrent::applyEncryptionSettings(pe_settings se) {
|
|||||||
s->set_pe_settings(se);
|
s->set_pe_settings(se);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will fast resume torrents in
|
// Will fast resume unfinished torrents in
|
||||||
// backup directory
|
// backup directory
|
||||||
void bittorrent::resumeUnfinishedTorrents() {
|
void bittorrent::resumeUnfinishedTorrents() {
|
||||||
qDebug("Resuming unfinished torrents");
|
qDebug("Resuming unfinished torrents");
|
||||||
@@ -1351,7 +1352,7 @@ void bittorrent::resumeUnfinishedTorrents() {
|
|||||||
}
|
}
|
||||||
// Resume downloads
|
// Resume downloads
|
||||||
foreach(fileName, filePaths) {
|
foreach(fileName, filePaths) {
|
||||||
addTorrent(fileName, false, QString(), true);
|
addTorrent(fileName, false);
|
||||||
}
|
}
|
||||||
qDebug("Unfinished torrents resumed");
|
qDebug("Unfinished torrents resumed");
|
||||||
}
|
}
|
||||||
|
@@ -27,12 +27,12 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include <libtorrent/session.hpp>
|
#include <libtorrent/session.hpp>
|
||||||
#include <libtorrent/ip_filter.hpp>
|
|
||||||
#include "qtorrenthandle.h"
|
#include "qtorrenthandle.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
class downloadThread;
|
class downloadThread;
|
||||||
|
class deleteThread;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
class bittorrent : public QObject{
|
class bittorrent : public QObject{
|
||||||
@@ -47,12 +47,13 @@ class bittorrent : public QObject{
|
|||||||
downloadThread *downloader;
|
downloadThread *downloader;
|
||||||
QString defaultSavePath;
|
QString defaultSavePath;
|
||||||
QStringList torrentsToPauseAfterChecking;
|
QStringList torrentsToPauseAfterChecking;
|
||||||
QHash<QString, bool> reloadingTorrents;
|
QStringList reloadingTorrents;
|
||||||
QHash<QString, QList<qlonglong> > ETAstats;
|
QHash<QString, QList<qlonglong> > ETAstats;
|
||||||
QHash<QString, qlonglong> ETAs;
|
QHash<QString, qlonglong> ETAs;
|
||||||
QHash<QString, QPair<size_type,size_type> > ratioData;
|
QHash<QString, QPair<size_type,size_type> > ratioData;
|
||||||
QTimer *ETARefresher;
|
QTimer *ETARefresher;
|
||||||
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
||||||
|
deleteThread *deleter;
|
||||||
QStringList waitingForPause;
|
QStringList waitingForPause;
|
||||||
QStringList finishedTorrents;
|
QStringList finishedTorrents;
|
||||||
QStringList unfinishedTorrents;
|
QStringList unfinishedTorrents;
|
||||||
@@ -88,7 +89,7 @@ class bittorrent : public QObject{
|
|||||||
bool has_filtered_files(QString hash) const;
|
bool has_filtered_files(QString hash) const;
|
||||||
|
|
||||||
public slots:
|
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 downloadFromUrl(QString url);
|
||||||
void downloadFromURLList(const QStringList& url_list);
|
void downloadFromURLList(const QStringList& url_list);
|
||||||
void deleteTorrent(QString hash, bool permanent = false);
|
void deleteTorrent(QString hash, bool permanent = false);
|
||||||
@@ -102,6 +103,7 @@ class bittorrent : public QObject{
|
|||||||
void enablePeerExchange();
|
void enablePeerExchange();
|
||||||
void enableIPFilter(ip_filter filter);
|
void enableIPFilter(ip_filter filter);
|
||||||
void disableIPFilter();
|
void disableIPFilter();
|
||||||
|
void pauseAndReloadTorrent(QTorrentHandle h);
|
||||||
void resumeUnfinishedTorrents();
|
void resumeUnfinishedTorrents();
|
||||||
void updateETAs();
|
void updateETAs();
|
||||||
void saveTorrentSpeedLimits(QString hash);
|
void saveTorrentSpeedLimits(QString hash);
|
||||||
@@ -141,8 +143,7 @@ class bittorrent : public QObject{
|
|||||||
void processDownloadedFile(QString, QString);
|
void processDownloadedFile(QString, QString);
|
||||||
bool loadTrackerFile(QString hash);
|
bool loadTrackerFile(QString hash);
|
||||||
void saveTrackerFile(QString hash);
|
void saveTrackerFile(QString hash);
|
||||||
void pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc);
|
void reloadTorrent(const QTorrentHandle &h); // This is protected now, call pauseAndReloadTorrent() instead
|
||||||
void reloadTorrent(const QTorrentHandle &h, bool full_alloc); // This is protected now, call pauseAndReloadTorrent() instead
|
|
||||||
void deleteBigRatios();
|
void deleteBigRatios();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@@ -141,7 +141,7 @@ QStringList createtorrent::allItems(QListWidget *list){
|
|||||||
// Main function that create a .torrent file
|
// Main function that create a .torrent file
|
||||||
void createtorrent::on_createButton_clicked(){
|
void createtorrent::on_createButton_clicked(){
|
||||||
QString input = textInputPath->text().trimmed();
|
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"));
|
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,6 @@ void createtorrent::on_createButton_clicked(){
|
|||||||
// create the torrent and print it to out
|
// create the torrent and print it to out
|
||||||
entry e = t->create_torrent();
|
entry e = t->create_torrent();
|
||||||
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
||||||
out.flush();
|
|
||||||
if(checkStartSeeding->isChecked())
|
if(checkStartSeeding->isChecked())
|
||||||
emit torrent_to_seed(destination);
|
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
Reference in New Issue
Block a user