mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
Merge pull request #3212 from Chocobo1/opt_ip_filter_tracker_v32x
Add checkbox option for IpFilterTrackers.
This commit is contained in:
commit
1da29a450c
5 changed files with 52 additions and 29 deletions
|
@ -971,6 +971,16 @@ void Preferences::setFilteringEnabled(bool enabled)
|
||||||
setValue("Preferences/IPFilter/Enabled", enabled);
|
setValue("Preferences/IPFilter/Enabled", enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Preferences::isFilteringTrackerEnabled() const
|
||||||
|
{
|
||||||
|
return value("Preferences/IPFilter/FilterTracker", false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Preferences::setFilteringTrackerEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
setValue("Preferences/IPFilter/FilterTracker", enabled);
|
||||||
|
}
|
||||||
|
|
||||||
QString Preferences::getFilter() const
|
QString Preferences::getFilter() const
|
||||||
{
|
{
|
||||||
return fsutils::fromNativePath(value("Preferences/IPFilter/File").toString());
|
return fsutils::fromNativePath(value("Preferences/IPFilter/File").toString());
|
||||||
|
|
|
@ -282,6 +282,8 @@ public:
|
||||||
// IP Filter
|
// IP Filter
|
||||||
bool isFilteringEnabled() const;
|
bool isFilteringEnabled() const;
|
||||||
void setFilteringEnabled(bool enabled);
|
void setFilteringEnabled(bool enabled);
|
||||||
|
bool isFilteringTrackerEnabled() const;
|
||||||
|
void setFilteringTrackerEnabled(bool enabled);
|
||||||
QString getFilter() const;
|
QString getFilter() const;
|
||||||
void setFilter(const QString &path);
|
void setFilter(const QString &path);
|
||||||
QStringList bannedIPs() const;
|
QStringList bannedIPs() const;
|
||||||
|
|
|
@ -414,9 +414,9 @@ void QBtSession::configureSession() {
|
||||||
// * Session settings
|
// * Session settings
|
||||||
session_settings sessionSettings = s->settings();
|
session_settings sessionSettings = s->settings();
|
||||||
sessionSettings.user_agent = "qBittorrent " VERSION;
|
sessionSettings.user_agent = "qBittorrent " VERSION;
|
||||||
//std::cout << "HTTP User-Agent is " << sessionSettings.user_agent << std::endl;
|
|
||||||
logger->addMessage(tr("HTTP User-Agent is %1").arg(misc::toQString(sessionSettings.user_agent)));
|
logger->addMessage(tr("HTTP User-Agent is %1").arg(misc::toQString(sessionSettings.user_agent)));
|
||||||
|
|
||||||
|
sessionSettings.apply_ip_filter_to_trackers = pref->isFilteringTrackerEnabled();
|
||||||
sessionSettings.upnp_ignore_nonrouters = true;
|
sessionSettings.upnp_ignore_nonrouters = true;
|
||||||
sessionSettings.use_dht_as_fallback = false;
|
sessionSettings.use_dht_as_fallback = false;
|
||||||
// Disable support for SSL torrents for now
|
// Disable support for SSL torrents for now
|
||||||
|
|
|
@ -180,8 +180,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>458</width>
|
<width>474</width>
|
||||||
<height>611</height>
|
<height>646</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
@ -519,8 +519,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>458</width>
|
<width>487</width>
|
||||||
<height>933</height>
|
<height>1005</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
@ -1037,8 +1037,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>458</width>
|
<width>474</width>
|
||||||
<height>556</height>
|
<height>640</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||||
|
@ -1469,17 +1469,17 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_14">
|
<layout class="QGridLayout" name="gridLayout_14">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lblFilterPath">
|
<widget class="QLabel" name="lblFilterPath">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Filter path (.dat, .p2p, .p2b):</string>
|
<string>Filter path (.dat, .p2p, .p2b):</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="textFilterPath"/>
|
<widget class="QLineEdit" name="textFilterPath"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="1" column="2">
|
||||||
<widget class="QToolButton" name="browseFilterButton">
|
<widget class="QToolButton" name="browseFilterButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -1492,7 +1492,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item row="1" column="3">
|
||||||
<widget class="QToolButton" name="IpFilterRefreshBtn">
|
<widget class="QToolButton" name="IpFilterRefreshBtn">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -1514,6 +1514,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkIpFilterTrackers">
|
||||||
|
<property name="text">
|
||||||
|
<string>Apply to trackers</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1538,8 +1545,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>458</width>
|
<width>474</width>
|
||||||
<height>407</height>
|
<height>438</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||||
|
@ -1822,12 +1829,6 @@
|
||||||
<property name="wrapping">
|
<property name="wrapping">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="displayFormat">
|
|
||||||
<string notr="true">hh:mm</string>
|
|
||||||
</property>
|
|
||||||
<property name="calendarPopup">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="time">
|
<property name="time">
|
||||||
<time>
|
<time>
|
||||||
<hour>8</hour>
|
<hour>8</hour>
|
||||||
|
@ -1835,6 +1836,12 @@
|
||||||
<second>0</second>
|
<second>0</second>
|
||||||
</time>
|
</time>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="displayFormat">
|
||||||
|
<string notr="true">hh:mm</string>
|
||||||
|
</property>
|
||||||
|
<property name="calendarPopup">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -1852,9 +1859,6 @@
|
||||||
<property name="wrapping">
|
<property name="wrapping">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="displayFormat">
|
|
||||||
<string notr="true">hh:mm</string>
|
|
||||||
</property>
|
|
||||||
<property name="time">
|
<property name="time">
|
||||||
<time>
|
<time>
|
||||||
<hour>20</hour>
|
<hour>20</hour>
|
||||||
|
@ -1862,6 +1866,9 @@
|
||||||
<second>0</second>
|
<second>0</second>
|
||||||
</time>
|
</time>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="displayFormat">
|
||||||
|
<string notr="true">hh:mm</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -1962,8 +1969,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>458</width>
|
<width>556</width>
|
||||||
<height>381</height>
|
<height>418</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
@ -2316,8 +2323,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>458</width>
|
<width>474</width>
|
||||||
<height>494</height>
|
<height>537</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||||
|
@ -2693,8 +2700,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>474</width>
|
<width>487</width>
|
||||||
<height>316</height>
|
<height>342</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
||||||
|
|
|
@ -228,6 +228,7 @@ options_imp::options_imp(QWidget *parent):
|
||||||
connect(textProxyPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(textProxyPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
// Misc tab
|
// Misc tab
|
||||||
connect(checkIPFilter, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkIPFilter, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
|
connect(checkIpFilterTrackers, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||||
connect(textFilterPath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(textFilterPath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkEnableQueueing, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkEnableQueueing, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(spinMaxActiveDownloads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
connect(spinMaxActiveDownloads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||||
|
@ -457,8 +458,10 @@ void options_imp::saveOptions() {
|
||||||
// Misc preferences
|
// Misc preferences
|
||||||
// * IPFilter
|
// * IPFilter
|
||||||
pref->setFilteringEnabled(isFilteringEnabled());
|
pref->setFilteringEnabled(isFilteringEnabled());
|
||||||
if (isFilteringEnabled())
|
if (isFilteringEnabled()) {
|
||||||
|
pref->setFilteringTrackerEnabled(checkIpFilterTrackers->isChecked());
|
||||||
pref->setFilter(textFilterPath->text());
|
pref->setFilter(textFilterPath->text());
|
||||||
|
}
|
||||||
// End IPFilter preferences
|
// End IPFilter preferences
|
||||||
// Queueing system
|
// Queueing system
|
||||||
pref->setQueueingSystemEnabled(isQueueingSystemEnabled());
|
pref->setQueueingSystemEnabled(isQueueingSystemEnabled());
|
||||||
|
@ -764,6 +767,7 @@ void options_imp::loadOptions() {
|
||||||
// Misc preferences
|
// Misc preferences
|
||||||
// * IP Filter
|
// * IP Filter
|
||||||
checkIPFilter->setChecked(pref->isFilteringEnabled());
|
checkIPFilter->setChecked(pref->isFilteringEnabled());
|
||||||
|
checkIpFilterTrackers->setChecked(pref->isFilteringTrackerEnabled());
|
||||||
textFilterPath->setText(fsutils::toNativePath(pref->getFilter()));
|
textFilterPath->setText(fsutils::toNativePath(pref->getFilter()));
|
||||||
// End IP Filter
|
// End IP Filter
|
||||||
// Queueing system preferences
|
// Queueing system preferences
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue