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