Browse Source

Rename IP filtering functions and settings names.

adaptive-webui-19844
sledgehammer999 8 years ago
parent
commit
a5ae86512a
  1. 16
      src/base/bittorrent/session.cpp
  2. 6
      src/base/bittorrent/session.h
  3. 2
      src/base/settingsstorage.cpp
  4. 8
      src/gui/optionsdlg.cpp
  5. 2
      src/gui/optionsdlg.h
  6. 4
      src/webui/prefjson.cpp

16
src/base/bittorrent/session.cpp

@ -245,7 +245,7 @@ Session::Session(QObject *parent) @@ -245,7 +245,7 @@ Session::Session(QObject *parent)
, m_isLSDEnabled(BITTORRENT_SESSION_KEY("LSDEnabled"), true)
, m_isPeXEnabled(BITTORRENT_SESSION_KEY("PeXEnabled"), true)
, m_isTrackerExchangeEnabled(BITTORRENT_SESSION_KEY("TrackerExchangeEnabled"), false)
, m_isFilteringEnabled(BITTORRENT_SESSION_KEY("FilteringEnabled"), false)
, m_isIPFilteringEnabled(BITTORRENT_SESSION_KEY("IPFilteringEnabled"), false)
, m_isTrackerFilteringEnabled(BITTORRENT_SESSION_KEY("TrackerFilteringEnabled"), false)
, m_IPFilterFile(BITTORRENT_SESSION_KEY("IPFilter"))
, m_announceToAllTrackers(BITTORRENT_SESSION_KEY("AnnounceToAllTrackers"), true)
@ -417,7 +417,7 @@ Session::Session(QObject *parent) @@ -417,7 +417,7 @@ Session::Session(QObject *parent)
, Log::INFO);
m_nativeSession->set_ip_filter({});
if (isFilteringEnabled())
if (isIPFilteringEnabled())
enableIPFilter();
// Add the banned IPs
processBannedIPs();
@ -923,7 +923,7 @@ void Session::configure() @@ -923,7 +923,7 @@ void Session::configure()
#endif
if (m_IPFilteringChanged) {
if (isFilteringEnabled())
if (isIPFilteringEnabled())
enableIPFilter();
else
disableIPFilter();
@ -2347,15 +2347,15 @@ void Session::setAdditionalTrackers(const QString &trackers) @@ -2347,15 +2347,15 @@ void Session::setAdditionalTrackers(const QString &trackers)
}
}
bool Session::isFilteringEnabled() const
bool Session::isIPFilteringEnabled() const
{
return m_isFilteringEnabled;
return m_isIPFilteringEnabled;
}
void Session::setFilteringEnabled(bool enabled)
void Session::setIPFilteringEnabled(bool enabled)
{
if (enabled != m_isFilteringEnabled) {
m_isFilteringEnabled = enabled;
if (enabled != m_isIPFilteringEnabled) {
m_isIPFilteringEnabled = enabled;
m_IPFilteringChanged = true;
configureDeferred();
}

6
src/base/bittorrent/session.h

@ -273,8 +273,8 @@ namespace BitTorrent @@ -273,8 +273,8 @@ namespace BitTorrent
void setAddTrackersEnabled(bool enabled);
QString additionalTrackers() const;
void setAdditionalTrackers(const QString &trackers);
bool isFilteringEnabled() const;
void setFilteringEnabled(bool enabled);
bool isIPFilteringEnabled() const;
void setIPFilteringEnabled(bool enabled);
QString IPFilterFile() const;
void setIPFilterFile(QString path);
bool announceToAllTrackers() const;
@ -505,7 +505,7 @@ namespace BitTorrent @@ -505,7 +505,7 @@ namespace BitTorrent
CachedSettingValue<bool> m_isLSDEnabled;
CachedSettingValue<bool> m_isPeXEnabled;
CachedSettingValue<bool> m_isTrackerExchangeEnabled;
CachedSettingValue<bool> m_isFilteringEnabled;
CachedSettingValue<bool> m_isIPFilteringEnabled;
CachedSettingValue<bool> m_isTrackerFilteringEnabled;
CachedSettingValue<QString> m_IPFilterFile;
CachedSettingValue<bool> m_announceToAllTrackers;

2
src/base/settingsstorage.cpp

@ -132,7 +132,7 @@ namespace @@ -132,7 +132,7 @@ namespace
{"BitTorrent/Session/TrackerExchangeEnabled", "Preferences/Advanced/LtTrackerExchange"},
{"BitTorrent/Session/AddTrackersEnabled", "Preferences/Bittorrent/AddTrackers"},
{"BitTorrent/Session/AdditionalTrackers", "Preferences/Bittorrent/TrackersList"},
{"BitTorrent/Session/FilteringEnabled", "Preferences/IPFilter/Enabled"},
{"BitTorrent/Session/IPFilteringEnabled", "Preferences/IPFilter/Enabled"},
{"BitTorrent/Session/TrackerFilteringEnabled", "Preferences/IPFilter/FilterTracker"},
{"BitTorrent/Session/IPFilter", "Preferences/IPFilter/File"},
{"BitTorrent/Session/GlobalMaxRatio", "Preferences/Bittorrent/MaxRatio"},

8
src/gui/optionsdlg.cpp

@ -588,7 +588,7 @@ void OptionsDialog::saveOptions() @@ -588,7 +588,7 @@ void OptionsDialog::saveOptions()
// Misc preferences
// * IPFilter
session->setFilteringEnabled(isFilteringEnabled());
session->setIPFilteringEnabled(isIPFilteringEnabled());
session->setTrackerFilteringEnabled(m_ui->checkIpFilterTrackers->isChecked());
session->setIPFilterFile(m_ui->textFilterPath->text());
// End IPFilter preferences
@ -628,7 +628,7 @@ void OptionsDialog::saveOptions() @@ -628,7 +628,7 @@ void OptionsDialog::saveOptions()
pref->apply();
}
bool OptionsDialog::isFilteringEnabled() const
bool OptionsDialog::isIPFilteringEnabled() const
{
return m_ui->checkIPFilter->isChecked();
}
@ -869,7 +869,7 @@ void OptionsDialog::loadOptions() @@ -869,7 +869,7 @@ void OptionsDialog::loadOptions()
m_ui->checkForceProxy->setChecked(session->isForceProxyEnabled());
m_ui->isProxyOnlyForTorrents->setChecked(proxyConfigManager->isProxyDisabled());
m_ui->checkIPFilter->setChecked(session->isFilteringEnabled());
m_ui->checkIPFilter->setChecked(session->isIPFilteringEnabled());
m_ui->checkIpFilterTrackers->setChecked(session->isTrackerFilteringEnabled());
m_ui->textFilterPath->setText(Utils::Fs::toNativePath(session->IPFilterFile()));
// End Connection preferences
@ -1534,7 +1534,7 @@ void OptionsDialog::on_IpFilterRefreshBtn_clicked() @@ -1534,7 +1534,7 @@ void OptionsDialog::on_IpFilterRefreshBtn_clicked()
m_refreshingIpFilter = true;
// Updating program preferences
BitTorrent::Session *const session = BitTorrent::Session::instance();
session->setFilteringEnabled(true);
session->setIPFilteringEnabled(true);
session->setIPFilterFile(""); // forcing Session reload filter file
session->setIPFilterFile(getFilter());
connect(session, SIGNAL(IPFilterParsed(bool, int)), SLOT(handleIPFilterParsed(bool, int)));

2
src/gui/optionsdlg.h

@ -156,7 +156,7 @@ private: @@ -156,7 +156,7 @@ private:
QString getProxyPassword() const;
Net::ProxyType getProxyType() const;
// IP Filter
bool isFilteringEnabled() const;
bool isIPFilteringEnabled() const;
QString getFilter() const;
bool m_refreshingIpFilter;
// Queueing system

4
src/webui/prefjson.cpp

@ -111,7 +111,7 @@ QByteArray prefjson::getPreferences() @@ -111,7 +111,7 @@ QByteArray prefjson::getPreferences()
data["force_proxy"] = session->isForceProxyEnabled();
// IP Filtering
data["ip_filter_enabled"] = session->isFilteringEnabled();
data["ip_filter_enabled"] = session->isIPFilteringEnabled();
data["ip_filter_path"] = Utils::Fs::toNativePath(session->IPFilterFile());
data["ip_filter_trackers"] = session->isTrackerFilteringEnabled();
@ -304,7 +304,7 @@ void prefjson::setPreferences(const QString& json) @@ -304,7 +304,7 @@ void prefjson::setPreferences(const QString& json)
// IP Filtering
if (m.contains("ip_filter_enabled"))
session->setFilteringEnabled(m["ip_filter_enabled"].toBool());
session->setIPFilteringEnabled(m["ip_filter_enabled"].toBool());
if (m.contains("ip_filter_path"))
session->setIPFilterFile(m["ip_filter_path"].toString());
if (m.contains("ip_filter_trackers"))

Loading…
Cancel
Save