mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Progress of paused torrents is now correct on restart
This commit is contained in:
parent
8755ebba01
commit
568b2ddf75
4 changed files with 25 additions and 3 deletions
|
@ -125,6 +125,11 @@ void bittorrent::pauseTorrent(const QString& hash){
|
|||
QFile paused_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused");
|
||||
paused_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
paused_file.close();
|
||||
int index = torrentsToPauseAfterChecking.indexOf(hash);
|
||||
if(index != -1) {
|
||||
torrentsToPauseAfterChecking.removeAt(index);
|
||||
qDebug("A torrent was paused just after checking, good");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,10 +245,10 @@ void bittorrent::addTorrent(const QString& path, bool fromScanDir, const QString
|
|||
// Copy it to torrentBackup directory
|
||||
QFile::copy(file, newFile);
|
||||
}
|
||||
//qDebug("Copied to torrent backup directory");
|
||||
// Pause torrent if it was paused last time
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")){
|
||||
h.pause();
|
||||
torrentsToPauseAfterChecking << hash;
|
||||
qDebug("Adding a torrent to the torrentsToPauseAfterChecking list");
|
||||
}
|
||||
// Incremental download
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".incremental")){
|
||||
|
@ -296,6 +301,10 @@ void bittorrent::addTorrent(const QString& path, bool fromScanDir, const QString
|
|||
}
|
||||
}
|
||||
|
||||
QStringList bittorrent::getTorrentsToPauseAfterChecking() const{
|
||||
return torrentsToPauseAfterChecking;
|
||||
}
|
||||
|
||||
// Set the maximum number of opened connections
|
||||
void bittorrent::setMaxConnections(int maxConnec){
|
||||
s->set_max_connections(maxConnec);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue