Browse Source

Remember completion date correctly

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
c9c2ab320d
  1. 17
      src/bittorrent.cpp
  2. 15
      src/torrentpersistentdata.h

17
src/bittorrent.cpp

@ -2016,7 +2016,6 @@ void Bittorrent::addConsoleMessage(QString msg, QString) { @@ -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) { @@ -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())

15
src/torrentpersistentdata.h

@ -375,11 +375,16 @@ public: @@ -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…
Cancel
Save