Browse Source

Add checkbox option for IpFilterTrackers, closes #3154.

adaptive-webui-19844
Chocobo1 10 years ago
parent
commit
32a712f005
  1. 10
      src/core/preferences.cpp
  2. 2
      src/core/preferences.h
  3. 3162
      src/core/qtlibtorrent/qbtsession.cpp
  4. 61
      src/gui/options.ui
  5. 6
      src/gui/options_imp.cpp

10
src/core/preferences.cpp

@ -973,6 +973,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 Utils::Fs::fromNativePath(value("Preferences/IPFilter/File").toString()); return Utils::Fs::fromNativePath(value("Preferences/IPFilter/File").toString());

2
src/core/preferences.h

@ -280,6 +280,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;

3162
src/core/qtlibtorrent/qbtsession.cpp

File diff suppressed because it is too large Load Diff

61
src/gui/options.ui

@ -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"/>

6
src/gui/options_imp.cpp

@ -226,6 +226,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()));
@ -455,8 +456,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());
@ -762,6 +765,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(Utils::Fs::toNativePath(pref->getFilter())); textFilterPath->setText(Utils::Fs::toNativePath(pref->getFilter()));
// End IP Filter // End IP Filter
// Queueing system preferences // Queueing system preferences

Loading…
Cancel
Save