Browse Source

- Blocked users (by ipfilter) are now logged in GUI

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
c11e5e8b12
  1. 1
      Changelog
  2. 17
      src/GUI.cpp
  3. 1
      src/GUI.h
  4. 3
      src/bittorrent.cpp
  5. 1
      src/bittorrent.h
  6. 13
      src/options_imp.cpp
  7. 2
      src/src.pro

1
Changelog

@ -17,6 +17,7 @@
- FEATURE: Supports SOCKS5 proxies as well as HTTP ones - FEATURE: Supports SOCKS5 proxies as well as HTTP ones
- FEATURE: Better systems integration (buttons, dialogs...) - FEATURE: Better systems integration (buttons, dialogs...)
- FEATURE: Filtered files are not allocated on the hard-drive anymore (if FS is compatible) - FEATURE: Filtered files are not allocated on the hard-drive anymore (if FS is compatible)
- FEATURE: IPs blocked by filter are now logged in GUI
- FEATURE: Added a way to link against static libtorrent (useful for deb packages) - FEATURE: Added a way to link against static libtorrent (useful for deb packages)
- BUGFIX: Progress of paused torrents is now correct on restart - BUGFIX: Progress of paused torrents is now correct on restart
- BUGFIX: Progress column gets sorted on restart it is was during last execution - BUGFIX: Progress column gets sorted on restart it is was during last execution

17
src/GUI.cpp

@ -112,7 +112,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png"))); actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png")));
actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png"))); actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png")));
actionCreate_torrent->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/new.png"))); actionCreate_torrent->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/new.png")));
tabBottom->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/log.png"))); // tabBottom->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/log.png")));
// tabBottom->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/filter.png")));
tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))); tabs->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")));
// Set default ratio // Set default ratio
lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/stare.png"))); lbl_ratio_icon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/stare.png")));
@ -143,6 +144,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
connect(&BTSession, SIGNAL(trackerError(const QString&, const QString&, const QString&)), this, SLOT(trackerError(const QString&, const QString&, const QString&))); connect(&BTSession, SIGNAL(trackerError(const QString&, const QString&, const QString&)), this, SLOT(trackerError(const QString&, const QString&, const QString&)));
connect(&BTSession,SIGNAL(allTorrentsFinishedChecking()), this, SLOT(sortProgressColumnDelayed())); connect(&BTSession,SIGNAL(allTorrentsFinishedChecking()), this, SLOT(sortProgressColumnDelayed()));
connect(&BTSession, SIGNAL(trackerAuthenticationRequired(torrent_handle&)), this, SLOT(trackerAuthenticationRequired(torrent_handle&))); connect(&BTSession, SIGNAL(trackerAuthenticationRequired(torrent_handle&)), this, SLOT(trackerAuthenticationRequired(torrent_handle&)));
connect(&BTSession, SIGNAL(peerBlocked(const QString&)), this, SLOT(addLogPeerBlocked(const QString)));
connect(&BTSession, SIGNAL(scanDirFoundTorrents(const QStringList&)), this, SLOT(processScannedFiles(const QStringList&))); connect(&BTSession, SIGNAL(scanDirFoundTorrents(const QStringList&)), this, SLOT(processScannedFiles(const QStringList&)));
connect(&BTSession, SIGNAL(newDownloadedTorrent(const QString&, const QString&)), this, SLOT(processDownloadedFiles(const QString&, const QString&))); connect(&BTSession, SIGNAL(newDownloadedTorrent(const QString&, const QString&)), this, SLOT(processDownloadedFiles(const QString&, const QString&)));
connect(&BTSession, SIGNAL(aboutToDownloadFromUrl(const QString&)), this, SLOT(displayDownloadingUrlInfos(const QString&))); connect(&BTSession, SIGNAL(aboutToDownloadFromUrl(const QString&)), this, SLOT(displayDownloadingUrlInfos(const QString&)));
@ -242,6 +244,16 @@ void GUI::readSettings() {
settings.endGroup(); settings.endGroup();
} }
void GUI::addLogPeerBlocked(const QString& ip){
static unsigned short nbLines = 0;
++nbLines;
if(nbLines > 200){
textBlockedUsers->clear();
nbLines = 1;
}
infoBar->append("<font color='grey'>"+ QTime::currentTime().toString("hh:mm:ss") + "</font> - "+tr("<font color='red'>%1</font> <i> was blocked</i>").arg(ip));
}
// Update Info Bar information // Update Info Bar information
void GUI::setInfoBar(const QString& info, const QString& color){ void GUI::setInfoBar(const QString& info, const QString& color){
qDebug("setInfoBar called"); qDebug("setInfoBar called");
@ -1256,8 +1268,11 @@ void GUI::configureSession(bool deleteOptions){
// Apply filtering settings // Apply filtering settings
if(options->isFilteringEnabled()){ if(options->isFilteringEnabled()){
BTSession.enableIPFilter(options->getFilter()); BTSession.enableIPFilter(options->getFilter());
tabBottom->setTabEnabled(1, true);
}else{ }else{
BTSession.disableIPFilter(); BTSession.disableIPFilter();
tabBottom->setCurrentIndex(0);
tabBottom->setTabEnabled(1, false);
} }
// Apply Proxy settings // Apply Proxy settings
if(options->isProxyEnabled()){ if(options->isProxyEnabled()){

1
src/GUI.h

@ -129,6 +129,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void readSettings(); void readSettings();
void on_actionExit_triggered(); void on_actionExit_triggered();
void createTrayIcon(); void createTrayIcon();
void addLogPeerBlocked(const QString&);
// Torrent actions // Torrent actions
size_type torrentEffectiveSize(QString hash) const; size_type torrentEffectiveSize(QString hash) const;
void showProperties(const QModelIndex &index); void showProperties(const QModelIndex &index);

3
src/bittorrent.cpp

@ -716,6 +716,9 @@ void bittorrent::readAlerts(){
emit trackerAuthenticationRequired(p->handle); emit trackerAuthenticationRequired(p->handle);
} }
} }
else if (peer_blocked_alert* p = dynamic_cast<peer_blocked_alert*>(a.get())){
emit peerBlocked(QString(p->ip.to_string().c_str()));
}
a = s->pop_alert(); a = s->pop_alert();
} }
} }

1
src/bittorrent.h

@ -144,6 +144,7 @@ class bittorrent : public QObject{
void aboutToDownloadFromUrl(const QString& url); void aboutToDownloadFromUrl(const QString& url);
void updateFileSize(QString hash); void updateFileSize(QString hash);
void allTorrentsFinishedChecking(); void allTorrentsFinishedChecking();
void peerBlocked(const QString&);
}; };

13
src/options_imp.cpp

@ -516,15 +516,10 @@ void options_imp::loadOptions(){
settings.beginGroup("IPFilter"); settings.beginGroup("IPFilter");
if(settings.value("Enabled", false).toBool()){ if(settings.value("Enabled", false).toBool()){
strValue = settings.value("File", QString()).toString(); strValue = settings.value("File", QString()).toString();
if(strValue.isEmpty()){ activateFilter->setChecked(true);
activateFilter->setChecked(false); filterGroup->setEnabled(true);
filterGroup->setEnabled(false); filterFile->setText(strValue);
}else{ processFilterFile(strValue);
activateFilter->setChecked(true);
filterGroup->setEnabled(true);
filterFile->setText(strValue);
processFilterFile(strValue);
}
}else{ }else{
activateFilter->setChecked(false); activateFilter->setChecked(false);
filterGroup->setEnabled(false); filterGroup->setEnabled(false);

2
src/src.pro

@ -11,7 +11,7 @@ TARGET = qbittorrent
CONFIG += qt thread x11 network CONFIG += qt thread x11 network
# Update this VERSION for each release # Update this VERSION for each release
DEFINES += VERSION=\\\"v1.0.0alpha10\\\" DEFINES += VERSION=\\\"v1.0.0alpha11\\\"
DEFINES += VERSION_MAJOR=1 DEFINES += VERSION_MAJOR=1
DEFINES += VERSION_MINOR=0 DEFINES += VERSION_MINOR=0
DEFINES += VERSION_BUGFIX=0 DEFINES += VERSION_BUGFIX=0

Loading…
Cancel
Save