FEATURE: Torrents can be automatically rechecked on completion

This commit is contained in:
Christophe Dumez 2010-01-31 16:14:56 +00:00
parent 0ea59c8d58
commit 77239db3c5
4 changed files with 27 additions and 4 deletions

View file

@ -7,6 +7,7 @@
- FEATURE: Outgoing ports range can be customized (for QoS)
- FEATURE: User can choose to apply transfer limits on LAN too
- FEATURE: User can choose to include the protocol overhead in transfer limits
- FEATURE: Torrents can be automatically rechecked on completion
* Mon Jan 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
- FEATURE: Graphical User Interface can be disabled at compilation time (headless running)

View file

@ -8,15 +8,15 @@
#include "preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE};
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD };
#define ROW_COUNT 5
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED };
#define ROW_COUNT 6
class AdvancedSettings: public QTableWidget {
Q_OBJECT
private:
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max;
QCheckBox *cb_ignore_limits_lan, *cb_count_overhead;
QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed;
public:
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) {
@ -39,9 +39,10 @@ public:
delete outgoing_ports_max;
delete cb_ignore_limits_lan;
delete cb_count_overhead;
delete cb_recheck_completed;
}
public slots:
public slots:
void saveAdvancedSettings() {
// Disk write cache
Preferences::setDiskCacheSize(spin_cache->value());
@ -52,6 +53,8 @@ public:
Preferences::ignoreLimitsOnLAN(cb_ignore_limits_lan->isChecked());
// Include protocol overhead in transfer limits
Preferences::includeOverheadInLimits(cb_count_overhead->isChecked());
// Recheck torrents on completion
Preferences::recheckTorrentsOnCompletion(cb_recheck_completed->isChecked());
}
protected slots:
@ -92,6 +95,12 @@ protected slots:
connect(cb_count_overhead, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
cb_count_overhead->setChecked(Preferences::includeOverheadInLimits());
setCellWidget(COUNT_OVERHEAD, VALUE, cb_count_overhead);
// Recheck completed torrents
setItem(RECHECK_COMPLETED, PROPERTY, new QTableWidgetItem(tr("Recheck torrents on completion")));
cb_recheck_completed = new QCheckBox();
connect(cb_recheck_completed, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
cb_recheck_completed->setChecked(Preferences::recheckTorrentsOnCompletion());
setCellWidget(RECHECK_COMPLETED, VALUE, cb_recheck_completed);
}
void emitSettingsChanged() {

View file

@ -1845,6 +1845,9 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
}
}
}
// Recheck if the user asked to
if(Preferences::recheckTorrentsOnCompletion())
h.force_recheck();
qDebug("Received finished alert for %s", h.name().toLocal8Bit().data());
}
}

View file

@ -878,6 +878,16 @@ public:
settings.setValue(QString::fromUtf8("Preferences/Advanced/IncludeOverhead"), include);
}
static bool recheckTorrentsOnCompletion() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Advanced/RecheckOnCompletion"), false).toBool();
}
static void recheckTorrentsOnCompletion(bool recheck) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Advanced/RecheckOnCompletion"), recheck);
}
};
#endif // PREFERENCES_H