aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/clientmodel.cpp1
-rw-r--r--src/qt/clientmodel.h1
-rw-r--r--src/qt/forms/rpcconsole.ui8
-rw-r--r--src/qt/rpcconsole.cpp32
-rw-r--r--src/qt/rpcconsole.h7
5 files changed, 28 insertions, 21 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 7f5dea0ef9..2af8226c12 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
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index 627bdf862d..6f7b2de3a3 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -91,6 +91,7 @@ Q_SIGNALS:
void numBlocksChanged(int count, const QDateTime& blockDate);
void alertsChanged(const QString &warnings);
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
+ void banListChanged();
//! Fired when a message should be reported to the user
void message(const QString &title, const QString &message, unsigned int style);
diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui
index 39230aee6f..c920e6130f 100644
--- a/src/qt/forms/rpcconsole.ui
+++ b/src/qt/forms/rpcconsole.ui
@@ -752,7 +752,7 @@
</property>
<property name="font">
<font>
- <pointsize>14</pointsize>
+ <pointsize>12</pointsize>
</font>
</property>
<property name="cursor">
@@ -780,12 +780,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 5658cf8752..3f20f67f24 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -352,7 +352,7 @@ void RPCConsole::setClientModel(ClientModel *model)
ui->peerWidget->setColumnWidth(PeerTableModel::Address, ADDRESS_COLUMN_WIDTH);
ui->peerWidget->setColumnWidth(PeerTableModel::Subversion, SUBVERSION_COLUMN_WIDTH);
ui->peerWidget->setColumnWidth(PeerTableModel::Ping, PING_COLUMN_WIDTH);
- ui->peerWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
+ ui->peerWidget->horizontalHeader()->setStretchLastSection(true);
// create context menu actions
QAction* disconnectAction = new QAction(tr("&Disconnect Node"), this);
@@ -373,8 +373,9 @@ void RPCConsole::setClientModel(ClientModel *model)
connect(ui->peerWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showPeersTableContextMenu(const QPoint&)));
connect(disconnectAction, SIGNAL(triggered()), this, SLOT(disconnectSelectedNode()));
- //add a signal mapping, use int instead of int64_t for bantime because signalmapper only supports int or objects
- //int is sufficient for our case
+ //add a signal mapping to allow a dynamic argument
+ //we need to use int (instead of int64_t) because signal mapper only supports int or objects
+ //this is okay because max bantime (1 Year) is smaler then int_max
QSignalMapper* signalMapper = new QSignalMapper(this);
signalMapper->setMapping(banAction1h, 60*60);
signalMapper->setMapping(banAction24h, 60*60*24);
@@ -395,14 +396,14 @@ void RPCConsole::setClientModel(ClientModel *model)
ui->banlistWidget->setModel(model->getBanTableModel());
ui->banlistWidget->verticalHeader()->hide();
ui->banlistWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
- ui->banlistWidget->setColumnWidth(BanTableModel::Address, ADDRESS_COLUMN_WIDTH);
- ui->banlistWidget->setColumnWidth(BanTableModel::Bantime, PING_COLUMN_WIDTH);
+ ui->banlistWidget->setColumnWidth(BanTableModel::Address, BANSUBNET_COLUMN_WIDTH);
+ ui->banlistWidget->setColumnWidth(BanTableModel::Bantime, BANTIME_COLUMN_WIDTH);
ui->banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection);
ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu);
- ui->banlistWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
+ ui->banlistWidget->horizontalHeader()->setStretchLastSection(true);
- // create context menu actions
+ // create banlist context menu actions
QAction* unbanAction = new QAction(tr("&Unban Node"), this);
banTableContextMenu = new QMenu();
banTableContextMenu->addAction(unbanAction);
@@ -419,11 +420,8 @@ void RPCConsole::setClientModel(ClientModel *model)
ui->startupTime->setText(model->formatClientStartupTime());
ui->networkName->setText(QString::fromStdString(Params().NetworkIDString()));
- if (!clientModel->getBanTableModel()->shouldShow())
- {
- ui->banlistWidget->hide();
- ui->banHeading->hide();
- }
+ connect(model, SIGNAL(banListChanged()), this, SLOT(showOrHideBanTableIfRequired()));
+ showOrHideBanTableIfRequired();
}
}
@@ -810,7 +808,7 @@ void RPCConsole::banSelectedNode(int bantime)
void RPCConsole::unbanSelectedNode()
{
- // Get currently selected peer address
+ // Get currently selected ban address
QString strNode = GUIUtil::getEntryData(ui->banlistWidget, 0, BanTableModel::Address);
CSubNet possibleSubnet(strNode.toStdString());
@@ -818,6 +816,7 @@ void RPCConsole::unbanSelectedNode()
{
CNode::Unban(possibleSubnet);
clientModel->updateBanlist();
+ showOrHideBanTableIfRequired();
}
}
@@ -828,3 +827,10 @@ void RPCConsole::clearSelectedNode()
ui->detailWidget->hide();
ui->peerHeading->setText(tr("Select a peer to view detailed information."));
}
+
+void RPCConsole::showOrHideBanTableIfRequired()
+{
+ bool visible = clientModel->getBanTableModel()->shouldShow();
+ ui->banlistWidget->setVisible(visible);
+ ui->banHeading->setVisible(visible);
+} \ No newline at end of file
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index db1f3d433d..9674cc5275 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -64,6 +64,8 @@ private Q_SLOTS:
void showPeersTableContextMenu(const QPoint& point);
/** Show custom context menu on Bans tab */
void showBanTableContextMenu(const QPoint& point);
+ /** Hides ban table if no bans are present */
+ void showOrHideBanTableIfRequired();
public Q_SLOTS:
void clear();
@@ -105,7 +107,10 @@ private:
{
ADDRESS_COLUMN_WIDTH = 200,
SUBVERSION_COLUMN_WIDTH = 100,
- PING_COLUMN_WIDTH = 80
+ PING_COLUMN_WIDTH = 80,
+ BANSUBNET_COLUMN_WIDTH = 300,
+ BANTIME_COLUMN_WIDTH = 150
+
};
Ui::RPCConsole *ui;