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)
, m_isLSDEnabled(BITTORRENT_SESSION_KEY("LSDEnabled"), true) , m_isLSDEnabled(BITTORRENT_SESSION_KEY("LSDEnabled"), true)
, m_isPeXEnabled(BITTORRENT_SESSION_KEY("PeXEnabled"), true) , m_isPeXEnabled(BITTORRENT_SESSION_KEY("PeXEnabled"), true)
, m_isTrackerExchangeEnabled(BITTORRENT_SESSION_KEY("TrackerExchangeEnabled"), false) , 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_isTrackerFilteringEnabled(BITTORRENT_SESSION_KEY("TrackerFilteringEnabled"), false)
, m_IPFilterFile(BITTORRENT_SESSION_KEY("IPFilter")) , m_IPFilterFile(BITTORRENT_SESSION_KEY("IPFilter"))
, m_announceToAllTrackers(BITTORRENT_SESSION_KEY("AnnounceToAllTrackers"), true) , m_announceToAllTrackers(BITTORRENT_SESSION_KEY("AnnounceToAllTrackers"), true)
@ -417,7 +417,7 @@ Session::Session(QObject *parent)
, Log::INFO); , Log::INFO);
m_nativeSession->set_ip_filter({}); m_nativeSession->set_ip_filter({});
if (isFilteringEnabled()) if (isIPFilteringEnabled())
enableIPFilter(); enableIPFilter();
// Add the banned IPs // Add the banned IPs
processBannedIPs(); processBannedIPs();
@ -923,7 +923,7 @@ void Session::configure()
#endif #endif
if (m_IPFilteringChanged) { if (m_IPFilteringChanged) {
if (isFilteringEnabled()) if (isIPFilteringEnabled())
enableIPFilter(); enableIPFilter();
else else
disableIPFilter(); disableIPFilter();
@ -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) { if (enabled != m_isIPFilteringEnabled) {
m_isFilteringEnabled = enabled; m_isIPFilteringEnabled = enabled;
m_IPFilteringChanged = true; m_IPFilteringChanged = true;
configureDeferred(); configureDeferred();
} }

6
src/base/bittorrent/session.h

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

2
src/base/settingsstorage.cpp

@ -132,7 +132,7 @@ namespace
{"BitTorrent/Session/TrackerExchangeEnabled", "Preferences/Advanced/LtTrackerExchange"}, {"BitTorrent/Session/TrackerExchangeEnabled", "Preferences/Advanced/LtTrackerExchange"},
{"BitTorrent/Session/AddTrackersEnabled", "Preferences/Bittorrent/AddTrackers"}, {"BitTorrent/Session/AddTrackersEnabled", "Preferences/Bittorrent/AddTrackers"},
{"BitTorrent/Session/AdditionalTrackers", "Preferences/Bittorrent/TrackersList"}, {"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/TrackerFilteringEnabled", "Preferences/IPFilter/FilterTracker"},
{"BitTorrent/Session/IPFilter", "Preferences/IPFilter/File"}, {"BitTorrent/Session/IPFilter", "Preferences/IPFilter/File"},
{"BitTorrent/Session/GlobalMaxRatio", "Preferences/Bittorrent/MaxRatio"}, {"BitTorrent/Session/GlobalMaxRatio", "Preferences/Bittorrent/MaxRatio"},

8
src/gui/optionsdlg.cpp

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

2
src/gui/optionsdlg.h

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

4
src/webui/prefjson.cpp

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

Loading…
Cancel
Save