mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-27 03:30:34 +00:00
- BUGFIX: Now filtered don't appear on hard drive anymore (libtorrent >= r1659 REQUIRED)
- BUGFIX: AddInPause setting doesn't pause downloads on startup anymore
This commit is contained in:
parent
4c862597ae
commit
a26333bc65
@ -6,6 +6,7 @@
|
||||
- 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
|
||||
|
10
TODO
10
TODO
@ -56,10 +56,8 @@
|
||||
- Recheck doc
|
||||
- Translations update (IN PROGRESS)
|
||||
- add qt4-qtconfig as package dependency
|
||||
- use new sparse mode
|
||||
|
||||
rc3->rc4 changelog:
|
||||
- BUGFIX: Fixed ip filter preferences (couldn't enable it)
|
||||
- BUGFIX: Fixed compilation problems on FreeBSD (Ok now)
|
||||
- BUGFIX: Updated INSTALL file
|
||||
- BUGFIX: Optimized torrent real size calculation
|
||||
- BUGFIX: Use system default style as a default (instead of Plastique style)
|
||||
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
|
@ -82,20 +82,16 @@ bittorrent::~bittorrent() {
|
||||
|
||||
void bittorrent::preAllocateAllFiles(bool b) {
|
||||
preAllocateAll = b;
|
||||
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);
|
||||
// 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;
|
||||
}
|
||||
pauseAndReloadTorrent(h, b);
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,6 +224,10 @@ 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);
|
||||
@ -373,7 +373,7 @@ void bittorrent::loadWebSeeds(QString hash) {
|
||||
}
|
||||
|
||||
// Add a torrent to the bittorrent session
|
||||
void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
|
||||
void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bool resumed) {
|
||||
QTorrentHandle h;
|
||||
entry resume_data;
|
||||
bool fastResume=false;
|
||||
@ -443,12 +443,12 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
|
||||
}
|
||||
QString savePath = getSavePath(hash);
|
||||
// Adding files to bittorrent session
|
||||
if(has_filtered_files(hash) || preAllocateAll) {
|
||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false, true);
|
||||
if(preAllocateAll) {
|
||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, storage_mode_allocate, true);
|
||||
qDebug(" -> Full allocation mode");
|
||||
}else{
|
||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, true, true);
|
||||
qDebug(" -> Compact allocation mode");
|
||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, storage_mode_sparse, true);
|
||||
qDebug(" -> Sparse allocation mode");
|
||||
}
|
||||
if(!h.is_valid()) {
|
||||
// No need to keep on, it failed.
|
||||
@ -485,7 +485,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
|
||||
QFile::copy(file, newFile);
|
||||
}
|
||||
// Pause torrent if it was paused last time
|
||||
if(addInPause || QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")) {
|
||||
if(!resumed && (addInPause || QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused"))) {
|
||||
torrentsToPauseAfterChecking << hash;
|
||||
qDebug("Adding a torrent to the torrentsToPauseAfterChecking list");
|
||||
}
|
||||
@ -1119,10 +1119,9 @@ void bittorrent::readAlerts() {
|
||||
if(index != -1){
|
||||
waitingForPause.removeAt(index);
|
||||
}
|
||||
index = reloadingTorrents.indexOf(hash);
|
||||
if(index != -1) {
|
||||
reloadingTorrents.removeAt(index);
|
||||
reloadTorrent(h);
|
||||
if(reloadingTorrents.contains(hash)) {
|
||||
reloadTorrent(h, reloadingTorrents.value(hash));
|
||||
reloadingTorrents.remove(hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1168,7 +1167,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) {
|
||||
void bittorrent::pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc) {
|
||||
if(!h.is_valid()) {
|
||||
std::cerr << "/!\\ Error: Invalid handle\n";
|
||||
return;
|
||||
@ -1176,14 +1175,14 @@ void bittorrent::pauseAndReloadTorrent(QTorrentHandle h) {
|
||||
// ask to pause the torrent (async)
|
||||
h.pause();
|
||||
QString hash = h.hash();
|
||||
// Add it to reloadingTorrents list so that we now we
|
||||
// Add it to reloadingTorrents has table so that we now we
|
||||
// we should reload the torrent once we receive the
|
||||
// torrent_paused_alert. pause() is async now...
|
||||
reloadingTorrents << hash;
|
||||
reloadingTorrents[hash] = full_alloc;
|
||||
}
|
||||
|
||||
// Reload a torrent with full allocation mode
|
||||
void bittorrent::reloadTorrent(const QTorrentHandle &h) {
|
||||
void bittorrent::reloadTorrent(const QTorrentHandle &h, bool full_alloc) {
|
||||
qDebug("** Reloading a torrent");
|
||||
if(!h.is_valid()) {
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
@ -1214,7 +1213,11 @@ void bittorrent::reloadTorrent(const QTorrentHandle &h) {
|
||||
SleeperThread::msleep(1000);
|
||||
++timeout;
|
||||
}
|
||||
QTorrentHandle new_h = s->add_torrent(t, saveDir, resumeData, false);
|
||||
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);
|
||||
qDebug("Using full allocation mode");
|
||||
// Connections limit per torrent
|
||||
new_h.set_max_connections(maxConnecsPerTorrent);
|
||||
@ -1335,7 +1338,7 @@ void bittorrent::applyEncryptionSettings(pe_settings se) {
|
||||
s->set_pe_settings(se);
|
||||
}
|
||||
|
||||
// Will fast resume unfinished torrents in
|
||||
// Will fast resume torrents in
|
||||
// backup directory
|
||||
void bittorrent::resumeUnfinishedTorrents() {
|
||||
qDebug("Resuming unfinished torrents");
|
||||
@ -1351,7 +1354,7 @@ void bittorrent::resumeUnfinishedTorrents() {
|
||||
}
|
||||
// Resume downloads
|
||||
foreach(fileName, filePaths) {
|
||||
addTorrent(fileName, false);
|
||||
addTorrent(fileName, false, QString(), true);
|
||||
}
|
||||
qDebug("Unfinished torrents resumed");
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class bittorrent : public QObject{
|
||||
downloadThread *downloader;
|
||||
QString defaultSavePath;
|
||||
QStringList torrentsToPauseAfterChecking;
|
||||
QStringList reloadingTorrents;
|
||||
QHash<QString, bool> reloadingTorrents;
|
||||
QHash<QString, QList<qlonglong> > ETAstats;
|
||||
QHash<QString, qlonglong> ETAs;
|
||||
QHash<QString, QPair<size_type,size_type> > ratioData;
|
||||
@ -90,7 +90,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());
|
||||
void addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
|
||||
void downloadFromUrl(QString url);
|
||||
void downloadFromURLList(const QStringList& url_list);
|
||||
void deleteTorrent(QString hash, bool permanent = false);
|
||||
@ -104,7 +104,6 @@ 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);
|
||||
@ -144,7 +143,8 @@ class bittorrent : public QObject{
|
||||
void processDownloadedFile(QString, QString);
|
||||
bool loadTrackerFile(QString hash);
|
||||
void saveTrackerFile(QString hash);
|
||||
void reloadTorrent(const QTorrentHandle &h); // This is protected now, call pauseAndReloadTorrent() instead
|
||||
void pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc);
|
||||
void reloadTorrent(const QTorrentHandle &h, bool full_alloc); // This is protected now, call pauseAndReloadTorrent() instead
|
||||
void deleteBigRatios();
|
||||
|
||||
signals:
|
||||
|
@ -693,12 +693,8 @@ bool properties::savePiecesPriorities() {
|
||||
}
|
||||
pieces_file.close();
|
||||
delete[] priorities;
|
||||
// If h.has_filtered_pieces() s true, then the torrent
|
||||
// is already in full allocation mode, no need to
|
||||
// reload it.
|
||||
if(hasFilteredFiles && !h.has_filtered_pieces()){
|
||||
BTSession->pauseAndReloadTorrent(h);
|
||||
}
|
||||
BTSession->loadFilesPriorities(h);
|
||||
// Emit a signal so that the GUI updates the size
|
||||
emit filteredFilesChanged(hash);
|
||||
has_filtered_files = hasFilteredFiles;
|
||||
return true;
|
||||
|
@ -30,7 +30,7 @@ contains(DEBUG_MODE, 0){
|
||||
|
||||
# For libtorrent stuff
|
||||
# (comment this if you are using libtorrent with debug enabled)
|
||||
DEFINES += NDEBUG
|
||||
#DEFINES += NDEBUG
|
||||
|
||||
# Install
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user