mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-23 17:56:50 +03:00
Remember completion date correctly
This commit is contained in:
parent
53d9817d8a
commit
c9c2ab320d
2 changed files with 16 additions and 16 deletions
|
@ -2016,7 +2016,6 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
|||
if (torrent_finished_alert* p = dynamic_cast<torrent_finished_alert*>(a.get())) {
|
||||
QTorrentHandle h(p->handle);
|
||||
if(h.is_valid()) {
|
||||
emit finishedTorrent(h);
|
||||
const QString hash = h.hash();
|
||||
#if LIBTORRENT_VERSION_MINOR > 14
|
||||
// Remove .!qB extension if necessary
|
||||
|
@ -2057,18 +2056,14 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
|||
if(current_dir != save_dir) {
|
||||
h.move_storage(save_dir.absolutePath());
|
||||
}
|
||||
}
|
||||
// Recheck if the user asked to
|
||||
if(Preferences::recheckTorrentsOnCompletion() && !was_already_seeded) {
|
||||
// Remember finished state
|
||||
TorrentPersistentData::saveSeedStatus(h);
|
||||
h.force_recheck();
|
||||
} else {
|
||||
// Remember finished state
|
||||
TorrentPersistentData::saveSeedStatus(h);
|
||||
}
|
||||
qDebug("Received finished alert for %s", qPrintable(h.name()));
|
||||
if(!was_already_seeded) {
|
||||
// Recheck if the user asked to
|
||||
if(Preferences::recheckTorrentsOnCompletion()) {
|
||||
h.force_recheck();
|
||||
}
|
||||
emit finishedTorrent(h);
|
||||
qDebug("Received finished alert for %s", qPrintable(h.name()));
|
||||
bool will_shutdown = Preferences::shutdownWhenDownloadsComplete() && !hasDownloadingTorrents();
|
||||
// AutoRun program
|
||||
if(Preferences::isAutoRunEnabled())
|
||||
|
|
|
@ -375,11 +375,16 @@ public:
|
|||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
|
||||
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash();
|
||||
QHash<QString, QVariant> data = all_data[h.hash()].toHash();
|
||||
data["seed"] = h.is_seed();
|
||||
all_data[h.hash()] = data;
|
||||
settings.setValue("torrents", all_data);
|
||||
// Save completion date
|
||||
saveSeedDate(h);
|
||||
bool was_seed = data.value("seed", false).toBool();
|
||||
if(was_seed != h.is_seed()) {
|
||||
data["seed"] = !was_seed;
|
||||
all_data[h.hash()] = data;
|
||||
settings.setValue("torrents", all_data);
|
||||
if(!was_seed) {
|
||||
// Save completion date
|
||||
saveSeedDate(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
Loading…
Reference in a new issue