You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-10-12 03:12:18 +02:00
Compare commits
2 Commits
release-1.
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6ecb5fe1e1 | ||
![]() |
6ae21c2919 |
@@ -44,6 +44,7 @@
|
||||
- I18N: Added Hungarian translation
|
||||
- I18N: Added Brazilian translation
|
||||
- BUGFIX: Progress of paused torrents is now correct on restart
|
||||
- BUGFIX: clear the results of a search stops searching
|
||||
- BUGFIX: Progress column gets sorted on restart it is was during last execution
|
||||
- BUGFIX: Made ETA more reliable using stats instead of instant values
|
||||
- BUGFIX: Remove torrent from hard drive used to delete parent folder if empty
|
||||
@@ -64,6 +65,8 @@
|
||||
- BUGFIX: Prevent downloadFromUrl flooding
|
||||
- BUGFIX: ETA was wrong for torrents with filtered files
|
||||
- BUGFIX: Fixed drag'n drop on non-KDE systems
|
||||
- BUGFIX: Removed build dependency on Python
|
||||
- BUGFIX: Catching DHT exception in case there is a problem
|
||||
- COSMETIC: Redesigned torrent properties a little
|
||||
- COSMETIC: Totally redesigned program preferences
|
||||
- COSMETIC: Display more logs messages concerning features
|
||||
|
16
TODO
16
TODO
@@ -46,6 +46,8 @@
|
||||
- Display in torrent addition dialog:
|
||||
* free disk space on selected drive
|
||||
* free disk space after torrent download (and/or torrent size)
|
||||
- Start minimized option in program preferences
|
||||
- In finished list, replace "Seeds/Leechs" column by "Leechers" because Seeds are always 0.
|
||||
- Allow to change action on double-click
|
||||
-> in download list
|
||||
-> in seeding list
|
||||
@@ -54,14 +56,8 @@
|
||||
- Fix all (or almost all) opened bugs in bug tracker
|
||||
- Recheck doc
|
||||
- Translations update (IN PROGRESS)
|
||||
- add qt4-qtconfig as package dependency
|
||||
|
||||
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
|
||||
rc7->rc8 changelog:
|
||||
- BUGFIX: Fixed torrent files filtering
|
||||
- BUGFIX: Stop search when clearing results
|
||||
- BUGFIX: Fixed compilation on Fedora 8
|
||||
|
59
configure
vendored
59
configure
vendored
@@ -412,7 +412,9 @@ public:
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(conf->checkLibrary(s, "torrent")){
|
||||
@@ -423,16 +425,6 @@ public:
|
||||
if(!found) return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}
|
||||
// BUGFIX for Fedora (doesn't support pkg-config?)
|
||||
QFile issue_file("/etc/issue");
|
||||
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
QString content = issue_file.readAll();
|
||||
issue_file.close();
|
||||
if(content.indexOf("Fedora") != -1){
|
||||
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
||||
conf->addLib("-lssl -lcrypto -lboost_date_time -lboost_filesystem -lboost_thread -lz -ltorrent");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -533,15 +525,17 @@ public:
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("libccext2.so")))
|
||||
if(!QFile::exists(s+QString("/libccext2.so")))
|
||||
return false;
|
||||
if(!QFile::exists(s+QString("libccgnu2.so")))
|
||||
if(!QFile::exists(s+QString("/libccgnu2.so")))
|
||||
return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libccext2.so"))){
|
||||
@@ -554,16 +548,6 @@ public:
|
||||
if(!found) return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}
|
||||
// BUGFIX for Fedora (doesn't support pkg-config?)
|
||||
QFile issue_file("/etc/issue");
|
||||
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
QString content = issue_file.readAll();
|
||||
issue_file.close();
|
||||
if(content.indexOf("Fedora") != -1){
|
||||
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
||||
conf->addLib("-pthread -lccext2 -lz -lccgnu2 -ldl -lrt");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -614,13 +598,15 @@ public:
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("libMagick++.so"))){
|
||||
if(!QFile::exists(s+QString("/libMagick++.so"))){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libMagick++.so"))){
|
||||
@@ -692,13 +678,15 @@ public:
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBZZIP_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("libzzip.so"))){
|
||||
if(!QFile::exists(s+QString("/libzzip.so"))){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libzzip.so"))){
|
||||
@@ -715,26 +703,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
};
|
||||
#line 1 "python.qcm"
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: python
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
class qc_python : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_python(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "python >= 2.3"; }
|
||||
QString shortname() const { return "python"; }
|
||||
bool exec(){
|
||||
int r = conf->doCommand("python testpython.py");
|
||||
if(r == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
EOT
|
||||
cat >$1/modules_new.cpp <<EOT
|
||||
@@ -756,9 +724,6 @@ cat >$1/modules_new.cpp <<EOT
|
||||
o = new qc_libzzip(conf);
|
||||
o->required = false;
|
||||
o->disabled = false;
|
||||
o = new qc_python(conf);
|
||||
o->required = true;
|
||||
o->disabled = false;
|
||||
|
||||
EOT
|
||||
cat >$1/conf4.h <<EOT
|
||||
|
@@ -17,7 +17,4 @@
|
||||
</dep>
|
||||
<dep type='libmagick'/>
|
||||
<dep type='libzzip'/>
|
||||
<dep type='python'>
|
||||
<required/>
|
||||
</dep>
|
||||
</qconf>
|
||||
|
@@ -37,15 +37,17 @@ public:
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("libccext2.so")))
|
||||
if(!QFile::exists(s+QString("/libccext2.so")))
|
||||
return false;
|
||||
if(!QFile::exists(s+QString("libccgnu2.so")))
|
||||
if(!QFile::exists(s+QString("/libccgnu2.so")))
|
||||
return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libccext2.so"))){
|
||||
@@ -58,16 +60,6 @@ public:
|
||||
if(!found) return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}
|
||||
// BUGFIX for Fedora (doesn't support pkg-config?)
|
||||
QFile issue_file("/etc/issue");
|
||||
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
QString content = issue_file.readAll();
|
||||
issue_file.close();
|
||||
if(content.indexOf("Fedora") != -1){
|
||||
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
||||
conf->addLib("-pthread -lccext2 -lz -lccgnu2 -ldl -lrt");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@@ -44,13 +44,15 @@ public:
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("libMagick++.so"))){
|
||||
if(!QFile::exists(s+QString("/libMagick++.so"))){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libMagick++.so"))){
|
||||
|
@@ -52,7 +52,9 @@ public:
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(conf->checkLibrary(s, "torrent")){
|
||||
@@ -63,16 +65,6 @@ public:
|
||||
if(!found) return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}
|
||||
// BUGFIX for Fedora (doesn't support pkg-config?)
|
||||
QFile issue_file("/etc/issue");
|
||||
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
QString content = issue_file.readAll();
|
||||
issue_file.close();
|
||||
if(content.indexOf("Fedora") != -1){
|
||||
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
||||
conf->addLib("-lssl -lcrypto -lboost_date_time -lboost_filesystem -lboost_thread -lz -ltorrent");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@@ -44,13 +44,15 @@ public:
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBZZIP_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("libzzip.so"))){
|
||||
if(!QFile::exists(s+QString("/libzzip.so"))){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libzzip.so"))){
|
||||
|
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: python
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
class qc_python : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_python(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "python >= 2.3"; }
|
||||
QString shortname() const { return "python"; }
|
||||
bool exec(){
|
||||
int r = conf->doCommand("python testpython.py");
|
||||
if(r == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
64
src/GUI.cpp
64
src/GUI.cpp
@@ -47,7 +47,6 @@
|
||||
#include "allocationDlg.h"
|
||||
|
||||
using namespace libtorrent;
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
/*****************************************************
|
||||
* *
|
||||
@@ -519,7 +518,7 @@ void GUI::on_actionCreate_torrent_triggered() {
|
||||
// Called when we minimize the program
|
||||
void GUI::hideEvent(QHideEvent *e) {
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
if(systrayIntegration && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool() && !e->spontaneous()) {
|
||||
if(systrayIntegration && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
|
||||
// Hide window
|
||||
hide();
|
||||
}
|
||||
@@ -885,11 +884,14 @@ void GUI::configureSession(bool deleteOptions) {
|
||||
BTSession->setMaxUploadsPerTorrent(options->getMaxUploadsPerTorrent());
|
||||
// * DHT
|
||||
if(options->isDHTEnabled()) {
|
||||
BTSession->enableDHT(true);
|
||||
downloadingTorrentTab->setInfoBar(tr("DHT support [ON], port: %1").arg(new_listenPort), QString::fromUtf8("blue"));
|
||||
// Set DHT Port
|
||||
BTSession->setDHTPort(new_listenPort);
|
||||
}else{
|
||||
if(BTSession->enableDHT(true)) {
|
||||
downloadingTorrentTab->setInfoBar(tr("DHT support [ON], port: %1").arg(new_listenPort), QString::fromUtf8("blue"));
|
||||
} else {
|
||||
downloadingTorrentTab->setInfoBar(tr("DHT support [OFF]"), QString::fromUtf8("red"));
|
||||
}
|
||||
} else {
|
||||
BTSession->enableDHT(false);
|
||||
downloadingTorrentTab->setInfoBar(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
|
||||
}
|
||||
@@ -988,30 +990,8 @@ void GUI::togglePausedState(QString hash) {
|
||||
// Pause All Downloads in DL list
|
||||
void GUI::on_actionPause_All_triggered() {
|
||||
bool change = false;
|
||||
bool inDownloadList = true;
|
||||
bool hidden = false;
|
||||
switch(getCurrentTabIndex()) {
|
||||
case -1:
|
||||
hidden = true;
|
||||
inDownloadList = false;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
inDownloadList = false;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList DL_hashes;
|
||||
QStringList F_hashes;
|
||||
if(hidden || inDownloadList) {
|
||||
DL_hashes = BTSession->getUnfinishedTorrents();
|
||||
}
|
||||
if(hidden || !inDownloadList) {
|
||||
F_hashes = BTSession->getFinishedTorrents();
|
||||
}
|
||||
QStringList DL_hashes = BTSession->getUnfinishedTorrents();
|
||||
QStringList F_hashes = BTSession->getFinishedTorrents();
|
||||
QString hash;
|
||||
foreach(hash, DL_hashes) {
|
||||
if(BTSession->pauseTorrent(hash)){
|
||||
@@ -1057,30 +1037,8 @@ void GUI::on_actionPause_triggered() {
|
||||
// Resume All Downloads in DL list
|
||||
void GUI::on_actionStart_All_triggered() {
|
||||
bool change = false;
|
||||
bool inDownloadList = true;
|
||||
bool hidden = false;
|
||||
switch(getCurrentTabIndex()) {
|
||||
case -1:
|
||||
hidden = true;
|
||||
inDownloadList = false;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
inDownloadList = false;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList DL_hashes;
|
||||
QStringList F_hashes;
|
||||
if(hidden || inDownloadList) {
|
||||
DL_hashes = BTSession->getUnfinishedTorrents();
|
||||
}
|
||||
if(hidden || !inDownloadList) {
|
||||
F_hashes = BTSession->getFinishedTorrents();
|
||||
}
|
||||
QStringList DL_hashes = BTSession->getUnfinishedTorrents();
|
||||
QStringList F_hashes = BTSession->getFinishedTorrents();
|
||||
QString hash;
|
||||
foreach(hash, DL_hashes) {
|
||||
if(BTSession->resumeTorrent(hash)){
|
||||
|
BIN
src/Icons/edit_clear.png
Normal file
BIN
src/Icons/edit_clear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 575 B |
@@ -174,14 +174,15 @@ class PropListDelegate: public QItemDelegate {
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(old_val != NORMAL){
|
||||
model->setData(index, QVariant(NORMAL));
|
||||
if(filteredFilesChanged != 0)
|
||||
*filteredFilesChanged = true;
|
||||
} else {
|
||||
// if(old_val != NORMAL){
|
||||
// model->setData(index, QVariant(NORMAL));
|
||||
// if(filteredFilesChanged != 0)
|
||||
// *filteredFilesChanged = true;
|
||||
// } else {
|
||||
model->setData(index, QVariant(HIGH));
|
||||
model->setData(index, QVariant(NORMAL));
|
||||
}
|
||||
*filteredFilesChanged = true;
|
||||
// }
|
||||
break;
|
||||
case 2:
|
||||
if(old_val != HIGH){
|
||||
|
@@ -62,12 +62,20 @@ class file {
|
||||
|
||||
void updateProgress() {
|
||||
Q_ASSERT(is_dir);
|
||||
float sum = 0;
|
||||
if(children.isEmpty()) {
|
||||
progress = 0.;
|
||||
return;
|
||||
}
|
||||
float wanted = 0.;
|
||||
float done = 0.;
|
||||
file *child;
|
||||
foreach(child, children) {
|
||||
sum += child->getProgress();
|
||||
wanted += child->getSize();
|
||||
done += child->getSize()*child->getProgress();
|
||||
}
|
||||
progress = sum / (float)children.size();
|
||||
progress = done / wanted;
|
||||
Q_ASSERT(progress >= 0.);
|
||||
Q_ASSERT(progress <= 1.);
|
||||
}
|
||||
|
||||
void updatePriority(int prio) {
|
||||
|
@@ -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>
|
||||
@@ -61,6 +62,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 +72,7 @@ bittorrent::~bittorrent() {
|
||||
// Disable directory scanning
|
||||
disableDirectoryScanning();
|
||||
// Delete our objects
|
||||
delete deleter;
|
||||
delete timerAlerts;
|
||||
delete ETARefresher;
|
||||
delete downloader;
|
||||
@@ -77,17 +81,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;
|
||||
bool change = (preAllocateAll != b);
|
||||
if(change) {
|
||||
qDebug("PreAllocateAll changed, reloading all torrents!");
|
||||
preAllocateAll = b;
|
||||
// Reload All unfinished torrents
|
||||
QString hash;
|
||||
foreach(hash, unfinishedTorrents) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
if(!h.is_valid()) {
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
continue;
|
||||
}
|
||||
pauseAndReloadTorrent(h, b);
|
||||
}
|
||||
pauseAndReloadTorrent(h, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,8 +161,8 @@ void bittorrent::updateETAs() {
|
||||
Q_ASSERT(nbETAs);
|
||||
foreach(val, listEtas) {
|
||||
moy += (qlonglong)((double)val/(double)nbETAs);
|
||||
Q_ASSERT(moy >= 0);
|
||||
}
|
||||
Q_ASSERT(moy >= 0);
|
||||
ETAs[hash] = moy;
|
||||
} else {
|
||||
// Speed is too low, we don't want an overflow.
|
||||
@@ -206,13 +213,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;
|
||||
@@ -244,6 +250,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
|
||||
@@ -630,7 +642,7 @@ void bittorrent::enableLSD(bool b) {
|
||||
}
|
||||
|
||||
// Enable DHT
|
||||
void bittorrent::enableDHT(bool b) {
|
||||
bool bittorrent::enableDHT(bool b) {
|
||||
if(b) {
|
||||
if(!DHTEnabled) {
|
||||
boost::filesystem::ifstream dht_state_file((misc::qBittorrentPath()+QString::fromUtf8("dht_state")).toUtf8().data(), std::ios_base::binary);
|
||||
@@ -639,12 +651,17 @@ void bittorrent::enableDHT(bool b) {
|
||||
try{
|
||||
dht_state = bdecode(std::istream_iterator<char>(dht_state_file), std::istream_iterator<char>());
|
||||
}catch (std::exception&) {}
|
||||
s->start_dht(dht_state);
|
||||
s->add_dht_router(std::make_pair(std::string("router.bittorrent.com"), 6881));
|
||||
s->add_dht_router(std::make_pair(std::string("router.utorrent.com"), 6881));
|
||||
s->add_dht_router(std::make_pair(std::string("router.bitcomet.com"), 6881));
|
||||
DHTEnabled = true;
|
||||
qDebug("DHT enabled");
|
||||
try {
|
||||
s->start_dht(dht_state);
|
||||
s->add_dht_router(std::make_pair(std::string("router.bittorrent.com"), 6881));
|
||||
s->add_dht_router(std::make_pair(std::string("router.utorrent.com"), 6881));
|
||||
s->add_dht_router(std::make_pair(std::string("router.bitcomet.com"), 6881));
|
||||
DHTEnabled = true;
|
||||
qDebug("DHT enabled");
|
||||
}catch(std::exception e) {
|
||||
qDebug("Could not enable DHT, reason: %s", e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(DHTEnabled) {
|
||||
@@ -653,6 +670,7 @@ void bittorrent::enableDHT(bool b) {
|
||||
qDebug("DHT disabled");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void bittorrent::saveTorrentSpeedLimits(QString hash) {
|
||||
@@ -690,6 +708,7 @@ void bittorrent::loadTorrentSpeedLimits(QString hash) {
|
||||
// Read pieces priorities from .priorities file
|
||||
// and ask QTorrentHandle to consider them
|
||||
void bittorrent::loadFilesPriorities(QTorrentHandle &h) {
|
||||
qDebug("Applying pieces priorities");
|
||||
if(!h.is_valid()) {
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
return;
|
||||
@@ -1207,15 +1226,18 @@ void bittorrent::reloadTorrent(const QTorrentHandle &h, bool full_alloc) {
|
||||
// Add torrent again to session
|
||||
unsigned int timeout = 0;
|
||||
while(h.is_valid() && timeout < 6) {
|
||||
qDebug("Waiting for the torrent to be removed...");
|
||||
SleeperThread::msleep(1000);
|
||||
++timeout;
|
||||
}
|
||||
QTorrentHandle new_h;
|
||||
if(full_alloc)
|
||||
if(full_alloc) {
|
||||
new_h = s->add_torrent(t, saveDir, resumeData, storage_mode_allocate);
|
||||
else
|
||||
qDebug("Using full allocation mode");
|
||||
} else {
|
||||
new_h = s->add_torrent(t, saveDir, resumeData, storage_mode_sparse);
|
||||
qDebug("Using full allocation mode");
|
||||
qDebug("Using sparse mode");
|
||||
}
|
||||
// Connections limit per torrent
|
||||
new_h.set_max_connections(maxConnecsPerTorrent);
|
||||
// Uploads limit per torrent
|
||||
|
@@ -33,6 +33,7 @@
|
||||
using namespace libtorrent;
|
||||
|
||||
class downloadThread;
|
||||
class deleteThread;
|
||||
class QTimer;
|
||||
|
||||
class bittorrent : public QObject{
|
||||
@@ -53,6 +54,7 @@ class bittorrent : public QObject{
|
||||
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;
|
||||
@@ -133,7 +135,7 @@ class bittorrent : public QObject{
|
||||
void enableUPnP(bool b);
|
||||
void enableNATPMP(bool b);
|
||||
void enableLSD(bool b);
|
||||
void enableDHT(bool b);
|
||||
bool enableDHT(bool b);
|
||||
|
||||
protected slots:
|
||||
void scanDirectory();
|
||||
|
@@ -47,6 +47,7 @@
|
||||
<file>Icons/configure.png</file>
|
||||
<file>Icons/download.png</file>
|
||||
<file>Icons/folder.png</file>
|
||||
<file>Icons/edit_clear.png</file>
|
||||
<file>Icons/flags/portugal.png</file>
|
||||
<file>Icons/flags/france.png</file>
|
||||
<file>Icons/flags/ukraine.png</file>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
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