mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 11:24:15 +00:00
- Fixed remembering of paused torrents cleanly
This commit is contained in:
parent
71e3061c18
commit
cd260198f9
@ -456,11 +456,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
|
|||||||
p.duplicate_is_error = false; // Already checked
|
p.duplicate_is_error = false; // Already checked
|
||||||
p.auto_managed = false; // Because it is added in paused state
|
p.auto_managed = false; // Because it is added in paused state
|
||||||
// Adding torrent to bittorrent session
|
// Adding torrent to bittorrent session
|
||||||
h = s->add_torrent(p);
|
h = QTorrentHandle(s->add_torrent(p));
|
||||||
// XXX: Workaround for http://code.rasterbar.com/libtorrent/ticket/454
|
|
||||||
h.pause(false);
|
|
||||||
//Q_ASSERT(!h.is_auto_managed());
|
|
||||||
//Q_ASSERT(h.is_paused());
|
|
||||||
// Check if it worked
|
// Check if it worked
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
// No need to keep on, it failed.
|
// No need to keep on, it failed.
|
||||||
@ -806,7 +802,7 @@ void bittorrent::saveFastResumeData() {
|
|||||||
for(unsigned int i=0; i<torrents.size(); ++i) {
|
for(unsigned int i=0; i<torrents.size(); ++i) {
|
||||||
QTorrentHandle h(torrents[i]);
|
QTorrentHandle h(torrents[i]);
|
||||||
if(!h.is_valid()) continue;
|
if(!h.is_valid()) continue;
|
||||||
if(h.is_paused()) continue;
|
//if(h.is_paused()) continue;
|
||||||
if (!h.has_metadata()) continue;
|
if (!h.has_metadata()) continue;
|
||||||
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) continue;
|
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) continue;
|
||||||
h.save_resume_data();
|
h.save_resume_data();
|
||||||
|
@ -315,12 +315,12 @@ void QTorrentHandle::set_upload_limit(int limit) {
|
|||||||
h.set_upload_limit(limit);
|
h.set_upload_limit(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTorrentHandle::pause(bool create_file) {
|
void QTorrentHandle::pause() {
|
||||||
Q_ASSERT(h.is_valid());
|
Q_ASSERT(h.is_valid());
|
||||||
h.auto_managed(false);
|
h.auto_managed(false);
|
||||||
h.pause();
|
h.pause();
|
||||||
// Create .paused file if necessary
|
// Create .paused file if necessary
|
||||||
if(create_file && !QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash()+".paused")) {
|
if(!QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash()+".paused")) {
|
||||||
QFile paused_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash()+".paused");
|
QFile paused_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash()+".paused");
|
||||||
paused_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
paused_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
paused_file.close();
|
paused_file.close();
|
||||||
|
@ -103,7 +103,7 @@ class QTorrentHandle {
|
|||||||
|
|
||||||
void set_download_limit(int limit);
|
void set_download_limit(int limit);
|
||||||
void set_upload_limit(int limit);
|
void set_upload_limit(int limit);
|
||||||
void pause(bool create_file=true);
|
void pause();
|
||||||
void resume();
|
void resume();
|
||||||
void remove_url_seed(QString seed);
|
void remove_url_seed(QString seed);
|
||||||
void add_url_seed(QString seed);
|
void add_url_seed(QString seed);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user