From ad204df1a9077327ab1142fbc9bf41369c1a73d1 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sat, 20 Jun 2015 20:27:03 +0200 Subject: [Qt] add banlist table below peers table --- src/qt/clientmodel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 97d671156..62c35130f 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -4,6 +4,7 @@ #include "clientmodel.h" +#include "bantablemodel.h" #include "guiconstants.h" #include "peertablemodel.h" @@ -26,6 +27,7 @@ ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) : QObject(parent), optionsModel(optionsModel), peerTableModel(0), + banTableModel(0), cachedNumBlocks(0), cachedBlockDate(QDateTime()), cachedReindexing(0), @@ -33,6 +35,7 @@ ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) : pollTimer(0) { peerTableModel = new PeerTableModel(this); + banTableModel = new BanTableModel(this); pollTimer = new QTimer(this); connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer())); pollTimer->start(MODEL_UPDATE_DELAY); @@ -176,6 +179,11 @@ PeerTableModel *ClientModel::getPeerTableModel() return peerTableModel; } +BanTableModel *ClientModel::getBanTableModel() +{ + return banTableModel; +} + QString ClientModel::formatFullVersion() const { return QString::fromStdString(FormatFullVersion()); @@ -206,6 +214,11 @@ QString ClientModel::formatClientStartupTime() const return QDateTime::fromTime_t(nClientStartupTime).toString(); } +void ClientModel::updateBanlist() +{ + banTableModel->refresh(); +} + // Handlers for core signals static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress) { -- cgit v1.2.3 From 5f421329508d6e86c410282c7de39d7e80b0b289 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sat, 20 Jun 2015 20:27:28 +0200 Subject: [Qt] add ui signal for banlist changes --- src/qt/clientmodel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 62c35130f..7f5dea0ef 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -243,12 +243,19 @@ static void NotifyAlertChanged(ClientModel *clientmodel, const uint256 &hash, Ch Q_ARG(int, status)); } +static void BannedListChanged(ClientModel *clientmodel) +{ + qDebug() << "BannedListChanged"; + QMetaObject::invokeMethod(clientmodel, "updateBanlist", Qt::QueuedConnection); +} + void ClientModel::subscribeToCoreSignals() { // Connect signals to client uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2)); uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1)); uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this, _1, _2)); + uiInterface.BannedListChanged.connect(boost::bind(BannedListChanged, this)); } void ClientModel::unsubscribeFromCoreSignals() @@ -257,4 +264,5 @@ void ClientModel::unsubscribeFromCoreSignals() uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1)); uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this, _1, _2)); + uiInterface.BannedListChanged.disconnect(boost::bind(BannedListChanged, this)); } -- cgit v1.2.3 From 6135309816208740888b25bc27ea123c1c825a04 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sat, 20 Jun 2015 21:48:10 +0200 Subject: [Qt] banlist, UI optimizing and better signal handling --- src/qt/clientmodel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 7f5dea0ef..2af8226c1 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -217,6 +217,7 @@ QString ClientModel::formatClientStartupTime() const void ClientModel::updateBanlist() { banTableModel->refresh(); + emit banListChanged(); } // Handlers for core signals -- cgit v1.2.3 From 9e521c173586257f57764b479beb5923c33ed0eb Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 23 Jun 2015 21:10:42 +0200 Subject: [Qt] polish ban table --- src/qt/clientmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 2af8226c1..851e9f186 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -246,7 +246,7 @@ static void NotifyAlertChanged(ClientModel *clientmodel, const uint256 &hash, Ch static void BannedListChanged(ClientModel *clientmodel) { - qDebug() << "BannedListChanged"; + qDebug() << QString("%1: Requesting update for peer banlist").arg(__func__); QMetaObject::invokeMethod(clientmodel, "updateBanlist", Qt::QueuedConnection); } -- cgit v1.2.3 From cdd72cd5fbc2b287559f7230d1616339e9ff2d6d Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 26 Jun 2015 10:23:51 +0200 Subject: [Qt] simplify ban list signal handling - remove banListChanged signal from client model - directly call clientModel->getBanTableModel()->refresh() without the way over clientModel->updateBanlist() - also fix clearing peer detail window, when selecting (clicking) peers in the ban list --- src/qt/clientmodel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/qt/clientmodel.cpp') diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 851e9f186..0900a35cc 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -217,7 +217,6 @@ QString ClientModel::formatClientStartupTime() const void ClientModel::updateBanlist() { banTableModel->refresh(); - emit banListChanged(); } // Handlers for core signals -- cgit v1.2.3