mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-29 16:04:21 +00:00
Fix issues when marking a file as "not downloaded" causes the torrent to complete
This commit is contained in:
parent
a9d4b38bd3
commit
64f0adc813
@ -2004,12 +2004,14 @@ void QBtSession::readAlerts() {
|
||||
QTorrentHandle h(p->handle);
|
||||
if(h.is_valid()) {
|
||||
const QString hash = h.hash();
|
||||
qDebug("Got a torrent finished alert for %s", qPrintable(h.name()));
|
||||
#if LIBTORRENT_VERSION_MINOR > 14
|
||||
// Remove .!qB extension if necessary
|
||||
if(appendqBExtension)
|
||||
appendqBextensionToTorrent(h, false);
|
||||
#endif
|
||||
const bool was_already_seeded = TorrentPersistentData::isSeed(hash);
|
||||
qDebug("Was already seeded: %d", was_already_seeded);
|
||||
if(!was_already_seeded) {
|
||||
h.save_resume_data();
|
||||
qDebug("Checking if the torrent contains torrent files to download");
|
||||
@ -2040,15 +2042,18 @@ void QBtSession::readAlerts() {
|
||||
const QDir current_dir(h.save_path());
|
||||
const QDir save_dir(getSavePath(hash));
|
||||
if(current_dir != save_dir) {
|
||||
qDebug("Moving torrent from the temp folder");
|
||||
h.move_storage(save_dir.absolutePath());
|
||||
}
|
||||
}
|
||||
// Remember finished state
|
||||
qDebug("Saving seed status");
|
||||
TorrentPersistentData::saveSeedStatus(h);
|
||||
// Recheck if the user asked to
|
||||
if(Preferences::recheckTorrentsOnCompletion()) {
|
||||
h.force_recheck();
|
||||
}
|
||||
qDebug("Emitting finishedTorrent() signal");
|
||||
emit finishedTorrent(h);
|
||||
qDebug("Received finished alert for %s", qPrintable(h.name()));
|
||||
bool will_shutdown = (Preferences::shutdownWhenDownloadsComplete() || Preferences::shutdownqBTWhenDownloadsComplete())
|
||||
|
@ -584,9 +584,12 @@ void QTorrentHandle::prioritize_files(const std::vector<int> &v) {
|
||||
Q_ASSERT(h.is_valid());
|
||||
if(v.size() != (unsigned int)h.get_torrent_info().num_files())
|
||||
return;
|
||||
bool was_seed = is_seed();
|
||||
h.prioritize_files(v);
|
||||
// Save seed status
|
||||
TorrentPersistentData::saveSeedStatus(*this);
|
||||
if(was_seed && !is_seed()) {
|
||||
// Reset seed status
|
||||
TorrentPersistentData::saveSeedStatus(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void QTorrentHandle::set_ratio(float ratio) const {
|
||||
@ -622,7 +625,7 @@ void QTorrentHandle::queue_position_top() const {
|
||||
|
||||
void QTorrentHandle::queue_position_bottom() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
h.queue_position_bottom();
|
||||
h.queue_position_bottom();
|
||||
}
|
||||
|
||||
void QTorrentHandle::force_reannounce() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user