Browse Source

FEATURE: Give feedback regarding the IP filter parsing

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
af63ba9a8d
  1. 1
      Changelog
  2. 15
      src/qtlibtorrent/qbtsession.cpp
  3. 6
      src/qtlibtorrent/qbtsession.h

1
Changelog

@ -5,6 +5,7 @@
- FEATURE: Software update check can now be disabled (Mac OS X / Windows) - FEATURE: Software update check can now be disabled (Mac OS X / Windows)
- FEATURE: Display pieces size in torrent properties - FEATURE: Display pieces size in torrent properties
- FEATURE: Added "Time Active/Seeded" column to transfer list - FEATURE: Added "Time Active/Seeded" column to transfer list
- FEATURE: Give feedback regarding the IP filter parsing
- COSMETIC: Same deletion confirmation dialog in the GUI and Web UI - COSMETIC: Same deletion confirmation dialog in the GUI and Web UI
- COSMETIC: Simplified the top toolbar - COSMETIC: Simplified the top toolbar
- COSMETIC: Display execution log as a tab instead of a modal window - COSMETIC: Display execution log as a tab instead of a modal window

15
src/qtlibtorrent/qbtsession.cpp

@ -386,7 +386,7 @@ void QBtSession::configureSession() {
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
#endif #endif
sessionSettings.cache_size = pref.diskCacheSize()*64; sessionSettings.cache_size = pref.diskCacheSize()*64;
addConsoleMessage(tr("Using a disk cache size of %1 MiB").arg(pref.diskCacheSize())); qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB";
// Queueing System // Queueing System
if(pref.isQueueingSystemEnabled()) { if(pref.isQueueingSystemEnabled()) {
sessionSettings.active_downloads = pref.getMaxActiveDownloads(); sessionSettings.active_downloads = pref.getMaxActiveDownloads();
@ -1749,6 +1749,8 @@ void QBtSession::enableIPFilter(QString filter) {
qDebug("Enabling IPFiler"); qDebug("Enabling IPFiler");
if(!filterParser) { if(!filterParser) {
filterParser = new FilterParserThread(this, s); filterParser = new FilterParserThread(this, s);
connect(filterParser.data(), SIGNAL(IPFilterParsed(int)), SLOT(handleIPFilterParsed(int)));
connect(filterParser.data(), SIGNAL(IPFilterError()), SLOT(handleIPFilterError()));
} }
if(filterPath.isEmpty() || filterPath != filter) { if(filterPath.isEmpty() || filterPath != filter) {
filterPath = filter; filterPath = filter;
@ -1761,6 +1763,7 @@ void QBtSession::disableIPFilter() {
qDebug("Disabling IPFilter"); qDebug("Disabling IPFilter");
s->set_ip_filter(ip_filter()); s->set_ip_filter(ip_filter());
if(filterParser) { if(filterParser) {
disconnect(filterParser.data(), 0, this, 0);
delete filterParser; delete filterParser;
} }
filterPath = ""; filterPath = "";
@ -2547,3 +2550,13 @@ qlonglong QBtSession::getETA(const QString &hash) const
{ {
return m_speedMonitor->getETA(hash); return m_speedMonitor->getETA(hash);
} }
void QBtSession::handleIPFilterParsed(int ruleCount)
{
addConsoleMessage(tr("Successfuly parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount));
}
void QBtSession::handleIPFilterError()
{
addConsoleMessage(tr("Error: Failed to parse the provided IP filter."), "red");
}

6
src/qtlibtorrent/qbtsession.h

@ -161,14 +161,14 @@ public slots:
void banIP(QString ip); void banIP(QString ip);
void recursiveTorrentDownload(const QTorrentHandle &h); void recursiveTorrentDownload(const QTorrentHandle &h);
protected: private:
QString getSavePath(QString hash, bool fromScanDir = false, QString filePath = QString::null, QString root_folder=QString::null); QString getSavePath(QString hash, bool fromScanDir = false, QString filePath = QString::null, QString root_folder=QString::null);
bool loadFastResumeData(QString hash, std::vector<char> &buf); bool loadFastResumeData(QString hash, std::vector<char> &buf);
void loadTorrentSettings(QTorrentHandle h); void loadTorrentSettings(QTorrentHandle h);
void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet); void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet);
libtorrent::add_torrent_params initializeAddTorrentParams(QString hash); libtorrent::add_torrent_params initializeAddTorrentParams(QString hash);
protected slots: private slots:
void addTorrentsFromScanFolder(QStringList&); void addTorrentsFromScanFolder(QStringList&);
void readAlerts(); void readAlerts();
void processBigRatios(); void processBigRatios();
@ -180,6 +180,8 @@ protected slots:
void mergeTorrents(QTorrentHandle h_ex, boost::intrusive_ptr<libtorrent::torrent_info> t); void mergeTorrents(QTorrentHandle h_ex, boost::intrusive_ptr<libtorrent::torrent_info> t);
void exportTorrentFile(QTorrentHandle h); void exportTorrentFile(QTorrentHandle h);
void initWebUi(); void initWebUi();
void handleIPFilterParsed(int ruleCount);
void handleIPFilterError();
signals: signals:
void addedTorrent(const QTorrentHandle& h); void addedTorrent(const QTorrentHandle& h);

Loading…
Cancel
Save