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

2
src/core/preferences.h

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

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

6
src/gui/options_imp.cpp

@ -226,6 +226,7 @@ options_imp::options_imp(QWidget *parent): @@ -226,6 +226,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()));
@ -455,8 +456,10 @@ void options_imp::saveOptions() { @@ -455,8 +456,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());
@ -762,6 +765,7 @@ void options_imp::loadOptions() { @@ -762,6 +765,7 @@ void options_imp::loadOptions() {
// Misc preferences
// * IP Filter
checkIPFilter->setChecked(pref->isFilteringEnabled());
checkIpFilterTrackers->setChecked(pref->isFilteringTrackerEnabled());
textFilterPath->setText(Utils::Fs::toNativePath(pref->getFilter()));
// End IP Filter
// Queueing system preferences

Loading…
Cancel
Save