mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 16:58:06 -06:00
FEATURE: Added a button to reload the IP filter
This commit is contained in:
@@ -1745,16 +1745,16 @@ void QBtSession::setDHTPort(int dht_port) {
|
||||
}
|
||||
|
||||
// Enable IP Filtering
|
||||
void QBtSession::enableIPFilter(QString filter) {
|
||||
void QBtSession::enableIPFilter(const QString &filter_path, bool force) {
|
||||
qDebug("Enabling IPFiler");
|
||||
if(!filterParser) {
|
||||
filterParser = new FilterParserThread(this, s);
|
||||
connect(filterParser.data(), SIGNAL(IPFilterParsed(int)), SLOT(handleIPFilterParsed(int)));
|
||||
connect(filterParser.data(), SIGNAL(IPFilterError()), SLOT(handleIPFilterError()));
|
||||
}
|
||||
if(filterPath.isEmpty() || filterPath != filter) {
|
||||
filterPath = filter;
|
||||
filterParser->processFilterFile(filter);
|
||||
if(filterPath.isEmpty() || filterPath != filter_path || force) {
|
||||
filterPath = filter_path;
|
||||
filterParser->processFilterFile(filter_path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2554,9 +2554,11 @@ qlonglong QBtSession::getETA(const QString &hash) const
|
||||
void QBtSession::handleIPFilterParsed(int ruleCount)
|
||||
{
|
||||
addConsoleMessage(tr("Successfuly parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount));
|
||||
emit ipFilterParsed(false, ruleCount);
|
||||
}
|
||||
|
||||
void QBtSession::handleIPFilterError()
|
||||
{
|
||||
addConsoleMessage(tr("Error: Failed to parse the provided IP filter."), "red");
|
||||
emit ipFilterParsed(true, 0);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public slots:
|
||||
/* End Web UI */
|
||||
void preAllocateAllFiles(bool b);
|
||||
void saveFastResumeData();
|
||||
void enableIPFilter(QString filter);
|
||||
void enableIPFilter(const QString &filter_path, bool force=false);
|
||||
void disableIPFilter();
|
||||
void setQueueingEnabled(bool enable);
|
||||
void handleDownloadFailure(QString url, QString reason);
|
||||
@@ -203,6 +203,7 @@ signals:
|
||||
void newBanMessage(const QString &msg);
|
||||
void alternativeSpeedsModeChanged(bool alternative);
|
||||
void recursiveTorrentDownloadPossible(const QTorrentHandle &h);
|
||||
void ipFilterParsed(bool error, int ruleCount);
|
||||
|
||||
private:
|
||||
#if LIBTORRENT_VERSION_MINOR < 15
|
||||
|
||||
Reference in New Issue
Block a user