mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 22:18:05 -06:00
Compare commits
1 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37bcb56bb8 |
@@ -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
|
||||||
|
|||||||
16
TODO
16
TODO
@@ -52,16 +52,14 @@
|
|||||||
|
|
||||||
// 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
|
- add qt4-qtconfig as package dependency
|
||||||
|
|
||||||
rc4->rc5 changelog:
|
rc3->rc4 changelog:
|
||||||
- BUGFIX: Now filtered don't appear on hard drive anymore (libtorrent >= r1659)
|
- BUGFIX: Fixed ip filter preferences (couldn't enable it)
|
||||||
- BUGFIX: AddInPause setting doesn't pause downloads on startup anymore
|
- BUGFIX: Fixed compilation problems on FreeBSD (Ok now)
|
||||||
- BUGFIX: Fixed an ETA calculation problem when the torrent has filtered files
|
- BUGFIX: Updated INSTALL file
|
||||||
- BUGFIX: Fixed possible overflow in ETA calculation
|
- BUGFIX: Optimized torrent real size calculation
|
||||||
- BUGFIX: Fixed "Missing Input path" error when creating a torrent
|
- BUGFIX: Use system default style as a default (instead of Plastique style)
|
||||||
- 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));
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -61,6 +62,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 +72,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 +82,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 +148,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 +160,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 +208,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 +228,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 +241,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 +373,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 +443,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 +485,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 +1119,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 +1168,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 +1176,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 +1214,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 +1335,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 +1351,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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
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 +48,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 +90,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 +104,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 +144,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
#include <QPlastiqueStyle>
|
#include <QPlastiqueStyle>
|
||||||
#include "qgnomelook.h"
|
#include <QCleanlooksStyle>
|
||||||
#include <QMotifStyle>
|
#include <QMotifStyle>
|
||||||
#include <QCDEStyle>
|
#include <QCDEStyle>
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
@@ -50,7 +50,7 @@ void useStyle(QApplication *app, int style){
|
|||||||
app->setStyle(new QPlastiqueStyle());
|
app->setStyle(new QPlastiqueStyle());
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
app->setStyle(new QGnomeLookStyle());
|
app->setStyle(new QCleanlooksStyle());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
app->setStyle(new QMotifStyle());
|
app->setStyle(new QMotifStyle());
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QPlastiqueStyle>
|
#include <QPlastiqueStyle>
|
||||||
#include "qgnomelook.h"
|
#include <QCleanlooksStyle>
|
||||||
#include <QMotifStyle>
|
#include <QMotifStyle>
|
||||||
#include <QCDEStyle>
|
#include <QCDEStyle>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
@@ -222,7 +222,7 @@ void options_imp::useStyle(){
|
|||||||
QApplication::setStyle(new QPlastiqueStyle());
|
QApplication::setStyle(new QPlastiqueStyle());
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
QApplication::setStyle(new QGnomeLookStyle());
|
QApplication::setStyle(new QCleanlooksStyle());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
QApplication::setStyle(new QMotifStyle());
|
QApplication::setStyle(new QMotifStyle());
|
||||||
|
|||||||
@@ -693,8 +693,12 @@ bool properties::savePiecesPriorities() {
|
|||||||
}
|
}
|
||||||
pieces_file.close();
|
pieces_file.close();
|
||||||
delete[] priorities;
|
delete[] priorities;
|
||||||
BTSession->loadFilesPriorities(h);
|
// If h.has_filtered_pieces() s true, then the torrent
|
||||||
// Emit a signal so that the GUI updates the size
|
// is already in full allocation mode, no need to
|
||||||
|
// reload it.
|
||||||
|
if(hasFilteredFiles && !h.has_filtered_pieces()){
|
||||||
|
BTSession->pauseAndReloadTorrent(h);
|
||||||
|
}
|
||||||
emit filteredFilesChanged(hash);
|
emit filteredFilesChanged(hash);
|
||||||
has_filtered_files = hasFilteredFiles;
|
has_filtered_files = hasFilteredFiles;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
|
||||||
* Copyright (C) 2006 Christophe Dumez
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*
|
|
||||||
* Contact : chris@qbittorrent.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef QGNOMELOOK
|
|
||||||
#define QGNOMELOOK
|
|
||||||
|
|
||||||
#include <QCleanlooksStyle>
|
|
||||||
#include <QStyleOption>
|
|
||||||
#include <QStyleOptionProgressBar>
|
|
||||||
#include <QStyleOptionProgressBarV2>
|
|
||||||
#include <QPen>
|
|
||||||
#include <QPainter>
|
|
||||||
|
|
||||||
class QGnomeLookStyle : public QCleanlooksStyle {
|
|
||||||
public:
|
|
||||||
QGnomeLookStyle() : QCleanlooksStyle() {}
|
|
||||||
|
|
||||||
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const {
|
|
||||||
switch(element) {
|
|
||||||
case CE_ProgressBarLabel:
|
|
||||||
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
|
|
||||||
bool vertical = false;
|
|
||||||
if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
|
|
||||||
vertical = (pb2->orientation == Qt::Vertical);
|
|
||||||
}
|
|
||||||
if (!vertical) {
|
|
||||||
QPalette::ColorRole textRole = QPalette::Dark;/*
|
|
||||||
if ((pb->textAlignment & Qt::AlignCenter) && pb->textVisible
|
|
||||||
&& ((qint64(pb->progress) - qint64(pb->minimum)) * 2 >= (qint64(pb->maximum) - qint64(pb->minimum)))) {
|
|
||||||
textRole = QPalette::HighlightedText;
|
|
||||||
//Draw text shadow, This will increase readability when the background of same color
|
|
||||||
QRect shadowRect(pb->rect);
|
|
||||||
shadowRect.translate(1,1);
|
|
||||||
QColor shadowColor = (pb->palette.color(textRole).value() <= 128) ? QColor(255,255,255,160) : QColor(0,0,0,160);
|
|
||||||
QPalette shadowPalette = pb->palette;
|
|
||||||
shadowPalette.setColor(textRole, shadowColor);
|
|
||||||
drawItemText(painter, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette, pb->state, pb->text, textRole);
|
|
||||||
}
|
|
||||||
QPalette shadowPalette = pb->palette;
|
|
||||||
shadowPalette.setColor(textRole, QColor(0,0,0,160));*/
|
|
||||||
drawItemText(painter, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette, pb->state, pb->text, textRole);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
QCleanlooksStyle::drawControl(element, option, painter, widget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget=0) const
|
|
||||||
{
|
|
||||||
QRect rect;
|
|
||||||
switch (element) {
|
|
||||||
#ifndef QT_NO_PROGRESSBAR
|
|
||||||
case SE_ProgressBarLabel:
|
|
||||||
case SE_ProgressBarContents:
|
|
||||||
case SE_ProgressBarGroove:
|
|
||||||
return option->rect;
|
|
||||||
#endif // QT_NO_PROGRESSBAR
|
|
||||||
default:
|
|
||||||
return QCleanlooksStyle::subElementRect(element, option, widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
return visualRect(option->direction, option->rect, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -79,9 +79,9 @@ bool QTorrentHandle::is_paused() const {
|
|||||||
// return h.get_torrent_info().total_size();
|
// return h.get_torrent_info().total_size();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
size_type QTorrentHandle::total_wanted_done() const {
|
size_type QTorrentHandle::total_done() const {
|
||||||
Q_ASSERT(h.is_valid());
|
Q_ASSERT(h.is_valid());
|
||||||
return h.status().total_wanted_done;
|
return h.status().total_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
float QTorrentHandle::download_payload_rate() const {
|
float QTorrentHandle::download_payload_rate() const {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class QTorrentHandle {
|
|||||||
bool is_paused() const;
|
bool is_paused() const;
|
||||||
bool has_filtered_pieces() const;
|
bool has_filtered_pieces() const;
|
||||||
// size_type total_size() const;
|
// size_type total_size() const;
|
||||||
size_type total_wanted_done() const;
|
size_type total_done() const;
|
||||||
float download_payload_rate() const;
|
float download_payload_rate() const;
|
||||||
float upload_payload_rate() const;
|
float upload_payload_rate() const;
|
||||||
int num_peers() const;
|
int num_peers() const;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ TARGET = qbittorrent
|
|||||||
CONFIG += qt thread x11 network
|
CONFIG += qt thread x11 network
|
||||||
|
|
||||||
# Update this VERSION for each release
|
# Update this VERSION for each release
|
||||||
DEFINES += VERSION=\\\"v1.0.0rc5\\\"
|
DEFINES += VERSION=\\\"v1.0.0rc4\\\"
|
||||||
DEFINES += VERSION_MAJOR=1
|
DEFINES += VERSION_MAJOR=1
|
||||||
DEFINES += VERSION_MINOR=0
|
DEFINES += VERSION_MINOR=0
|
||||||
DEFINES += VERSION_BUGFIX=0
|
DEFINES += VERSION_BUGFIX=0
|
||||||
@@ -142,7 +142,7 @@ HEADERS += GUI.h misc.h options_imp.h about_imp.h \
|
|||||||
allocationDlg.h FinishedListDelegate.h \
|
allocationDlg.h FinishedListDelegate.h \
|
||||||
qtorrenthandle.h downloadingTorrents.h \
|
qtorrenthandle.h downloadingTorrents.h \
|
||||||
engineSelectDlg.h pluginSource.h \
|
engineSelectDlg.h pluginSource.h \
|
||||||
arborescence.h qgnomelook.h
|
arborescence.h
|
||||||
FORMS += MainWindow.ui options.ui about.ui \
|
FORMS += MainWindow.ui options.ui about.ui \
|
||||||
properties.ui createtorrent.ui preview.ui \
|
properties.ui createtorrent.ui preview.ui \
|
||||||
login.ui downloadFromURL.ui addTorrentDialog.ui \
|
login.ui downloadFromURL.ui addTorrentDialog.ui \
|
||||||
|
|||||||
Reference in New Issue
Block a user