Browse Source

Merge pull request #464 from Gelmir/log_clear

Allow clearing of execution log and peer ban log
adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
a998f4c980
  1. 2
      src/executionlog.cpp
  2. 8
      src/loglistwidget.cpp
  3. 4
      src/loglistwidget.h
  4. 2
      src/qtlibtorrent/qbtsession.h

2
src/executionlog.cpp

@ -57,6 +57,8 @@ ExecutionLog::ExecutionLog(QWidget *parent) :
addBanMessage(msg); addBanMessage(msg);
connect(QBtSession::instance(), SIGNAL(newConsoleMessage(QString)), SLOT(addLogMessage(QString))); connect(QBtSession::instance(), SIGNAL(newConsoleMessage(QString)), SLOT(addLogMessage(QString)));
connect(QBtSession::instance(), SIGNAL(newBanMessage(QString)), SLOT(addBanMessage(QString))); connect(QBtSession::instance(), SIGNAL(newBanMessage(QString)), SLOT(addBanMessage(QString)));
connect(m_logList, SIGNAL(logCleared()), QBtSession::instance(), SLOT(clearConsoleMessages()));
connect(m_banList, SIGNAL(logCleared()), QBtSession::instance(), SLOT(clearPeerBanMessages()));
} }
ExecutionLog::~ExecutionLog() ExecutionLog::~ExecutionLog()

8
src/loglistwidget.cpp

@ -45,8 +45,11 @@ LogListWidget::LogListWidget(int max_lines, QWidget *parent) :
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
// Context menu // Context menu
QAction *copyAct = new QAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy"), this); QAction *copyAct = new QAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy"), this);
QAction *clearAct = new QAction(IconProvider::instance()->getIcon("edit-clear"), tr("Clear"), this);
connect(copyAct, SIGNAL(triggered()), SLOT(copySelection())); connect(copyAct, SIGNAL(triggered()), SLOT(copySelection()));
connect(clearAct, SIGNAL(triggered()), SLOT(clearLog()));
addAction(copyAct); addAction(copyAct);
addAction(clearAct);
setContextMenuPolicy(Qt::ActionsContextMenu); setContextMenuPolicy(Qt::ActionsContextMenu);
} }
@ -87,3 +90,8 @@ void LogListWidget::copySelection()
QApplication::clipboard()->setText(strings.join("\n")); QApplication::clipboard()->setText(strings.join("\n"));
} }
void LogListWidget::clearLog() {
clear();
emit logCleared();
}

4
src/loglistwidget.h

@ -48,6 +48,10 @@ public slots:
protected slots: protected slots:
void copySelection(); void copySelection();
void clearLog();
signals:
void logCleared();
protected: protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);

2
src/qtlibtorrent/qbtsession.h

@ -166,6 +166,8 @@ public slots:
void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText)); void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText));
#endif #endif
void addPeerBanMessage(QString msg, bool from_ipfilter); void addPeerBanMessage(QString msg, bool from_ipfilter);
void clearConsoleMessages() { consoleMessages.clear(); }
void clearPeerBanMessages() { peerBanMessages.clear(); }
void processDownloadedFile(QString, QString); void processDownloadedFile(QString, QString);
void addMagnetSkipAddDlg(const QString& uri, const QString& save_path = QString(), const QString& label = QString()); void addMagnetSkipAddDlg(const QString& uri, const QString& save_path = QString(), const QString& label = QString());
void addMagnetInteractive(const QString& uri); void addMagnetInteractive(const QString& uri);

Loading…
Cancel
Save