From af63ba9a8dab274e3245fd288bd66378d3f06fd2 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 25 Dec 2010 14:07:28 +0000 Subject: [PATCH] FEATURE: Give feedback regarding the IP filter parsing --- Changelog | 1 + src/qtlibtorrent/qbtsession.cpp | 15 ++++++++++++++- src/qtlibtorrent/qbtsession.h | 6 ++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index e54a0fe83..9d86e10c7 100644 --- a/Changelog +++ b/Changelog @@ -5,6 +5,7 @@ - FEATURE: Software update check can now be disabled (Mac OS X / Windows) - FEATURE: Display pieces size in torrent properties - 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: Simplified the top toolbar - COSMETIC: Display execution log as a tab instead of a modal window diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index f2288cd95..eb44530bc 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -386,7 +386,7 @@ void QBtSession::configureSession() { sessionSettings.auto_scrape_min_interval = 900; // 15 minutes #endif 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 if(pref.isQueueingSystemEnabled()) { sessionSettings.active_downloads = pref.getMaxActiveDownloads(); @@ -1749,6 +1749,8 @@ void QBtSession::enableIPFilter(QString filter) { qDebug("Enabling IPFiler"); if(!filterParser) { 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) { filterPath = filter; @@ -1761,6 +1763,7 @@ void QBtSession::disableIPFilter() { qDebug("Disabling IPFilter"); s->set_ip_filter(ip_filter()); if(filterParser) { + disconnect(filterParser.data(), 0, this, 0); delete filterParser; } filterPath = ""; @@ -2547,3 +2550,13 @@ qlonglong QBtSession::getETA(const QString &hash) const { 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"); +} diff --git a/src/qtlibtorrent/qbtsession.h b/src/qtlibtorrent/qbtsession.h index a0b96e954..09e00b902 100644 --- a/src/qtlibtorrent/qbtsession.h +++ b/src/qtlibtorrent/qbtsession.h @@ -161,14 +161,14 @@ public slots: void banIP(QString ip); void recursiveTorrentDownload(const QTorrentHandle &h); -protected: +private: QString getSavePath(QString hash, bool fromScanDir = false, QString filePath = QString::null, QString root_folder=QString::null); bool loadFastResumeData(QString hash, std::vector &buf); void loadTorrentSettings(QTorrentHandle h); void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet); libtorrent::add_torrent_params initializeAddTorrentParams(QString hash); -protected slots: +private slots: void addTorrentsFromScanFolder(QStringList&); void readAlerts(); void processBigRatios(); @@ -180,6 +180,8 @@ protected slots: void mergeTorrents(QTorrentHandle h_ex, boost::intrusive_ptr t); void exportTorrentFile(QTorrentHandle h); void initWebUi(); + void handleIPFilterParsed(int ruleCount); + void handleIPFilterError(); signals: void addedTorrent(const QTorrentHandle& h);