diff --git a/src/executionlog.cpp b/src/executionlog.cpp index 2acfcd686..39614432b 100644 --- a/src/executionlog.cpp +++ b/src/executionlog.cpp @@ -39,11 +39,11 @@ #include "iconprovider.h" #include "loglistwidget.h" -ExecutionLog::ExecutionLog(QWidget *parent) : - QWidget(parent), - ui(new Ui::ExecutionLog), - m_msgList(new LogListWidget(MAX_LOG_MESSAGES)), - m_peerList(new LogListWidget(MAX_LOG_MESSAGES)) +ExecutionLog::ExecutionLog(QWidget *parent) + : QWidget(parent) + , ui(new Ui::ExecutionLog) + , m_msgList(new LogListWidget(MAX_LOG_MESSAGES)) + , m_peerList(new LogListWidget(MAX_LOG_MESSAGES)) { ui->setupUi(this); @@ -54,57 +54,57 @@ ExecutionLog::ExecutionLog(QWidget *parent) : const Logger* const logger = Logger::instance(); foreach (const Log::Msg& msg, logger->getMessages()) - addLogMessage(msg); + addLogMessage(msg); foreach (const Log::Peer& peer, logger->getPeers()) - addPeerMessage(peer); - connect(logger, SIGNAL(newLogMessage(const Log::Msg &)), SLOT(addLogMessage(const Logg:Msg &))); + addPeerMessage(peer); + connect(logger, SIGNAL(newLogMessage(const Log::Msg &)), SLOT(addLogMessage(const Log::Msg &))); connect(logger, SIGNAL(newLogPeer(const Log::Peer &)), SLOT(addPeerMessage(const Log::Peer &))); } ExecutionLog::~ExecutionLog() { - delete m_msgList; - delete m_peerList; - delete ui; + delete m_msgList; + delete m_peerList; + delete ui; } void ExecutionLog::addLogMessage(const Log::Msg &msg) { - QString text; - QDateTime time = QDateTime::fromMSecsSinceEpoch(msg.timestamp); - QColor color; + QString text; + QDateTime time = QDateTime::fromMSecsSinceEpoch(msg.timestamp); + QColor color; - switch (msg.type) { - case Log::INFO: - color.setNamedColor("blue"); - break; - case Log::WARNING: - color.setNamedColor("orange"); - break; - case Log::CRITICAL: - color.setNamedColor("red"); - break; - default: - color = QApplication::palette().color(QPalette::WindowText); - } + switch (msg.type) { + case Log::INFO: + color.setNamedColor("blue"); + break; + case Log::WARNING: + color.setNamedColor("orange"); + break; + case Log::CRITICAL: + color.setNamedColor("red"); + break; + default: + color = QApplication::palette().color(QPalette::WindowText); + } - text = "" + time.toString("dd/MM/yyyy hh:mm:ss") + " - " + msg.message + ""; - m_msgList->appendLine(text); + text = "" + time.toString("dd/MM/yyyy hh:mm:ss") + " - " + msg.message + ""; + m_msgList->appendLine(text); } void ExecutionLog::addPeerMessage(const Log::Peer& peer) { - QString text; - QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp); + QString text; + QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp); - if (peer.blocked) + if (peer.blocked) #if LIBTORRENT_VERSION_NUM < 10000 - text = "" + time.toString("dd/MM/yyyy hh:mm:ss") + " - " + tr("%1 was blocked", "x.y.z.w was blocked").arg(peer.ip); + text = "" + time.toString("dd/MM/yyyy hh:mm:ss") + " - " + tr("%1 was blocked", "x.y.z.w was blocked").arg(peer.ip); #else - text = "" + time.toString("dd/MM/yyyy hh:mm:ss") + " - " + tr("%1 was blocked %2", "x.y.z.w was blocked").arg(peer.ip).arg(peer.reason); + text = "" + time.toString("dd/MM/yyyy hh:mm:ss") + " - " + tr("%1 was blocked %2", "x.y.z.w was blocked").arg(peer.ip).arg(peer.reason); #endif - else - text = "" + time.toString("dd/MM/yyyy hh:mm:ss") + " - " + tr("%1 was banned", "x.y.z.w was banned").arg(peer.ip); + else + text = "" + time.toString("dd/MM/yyyy hh:mm:ss") + " - " + tr("%1 was banned", "x.y.z.w was banned").arg(peer.ip); - m_peerList->appendLine(text); + m_peerList->appendLine(text); } diff --git a/src/executionlog.h b/src/executionlog.h index f0fd2cd2f..9b8b16ead 100644 --- a/src/executionlog.h +++ b/src/executionlog.h @@ -43,11 +43,11 @@ class LogListWidget; namespace Log { - struct Msg; - struct Peer; + struct Msg; + struct Peer; } -class ExecutionLog : public QWidget +class ExecutionLog: public QWidget { Q_OBJECT @@ -56,14 +56,14 @@ public: ~ExecutionLog(); private slots: - void addLogMessage(const Log::Msg &msg); - void addPeerMessage(const Log::Peer &peer); + void addLogMessage(const Log::Msg &msg); + void addPeerMessage(const Log::Peer &peer); private: - Ui::ExecutionLog *ui; + Ui::ExecutionLog *ui; - LogListWidget *m_msgList; - LogListWidget *m_peerList; + LogListWidget *m_msgList; + LogListWidget *m_peerList; }; #endif // EXECUTIONLOG_H