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