|
|
@ -343,7 +343,6 @@ RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) :
|
|
|
|
ui(new Ui::RPCConsole),
|
|
|
|
ui(new Ui::RPCConsole),
|
|
|
|
clientModel(0),
|
|
|
|
clientModel(0),
|
|
|
|
historyPtr(0),
|
|
|
|
historyPtr(0),
|
|
|
|
cachedNodeid(-1),
|
|
|
|
|
|
|
|
platformStyle(_platformStyle),
|
|
|
|
platformStyle(_platformStyle),
|
|
|
|
peersTableContextMenu(0),
|
|
|
|
peersTableContextMenu(0),
|
|
|
|
banTableContextMenu(0),
|
|
|
|
banTableContextMenu(0),
|
|
|
@ -514,6 +513,8 @@ void RPCConsole::setClientModel(ClientModel *model)
|
|
|
|
this, SLOT(peerSelected(const QItemSelection &, const QItemSelection &)));
|
|
|
|
this, SLOT(peerSelected(const QItemSelection &, const QItemSelection &)));
|
|
|
|
// peer table signal handling - update peer details when new nodes are added to the model
|
|
|
|
// peer table signal handling - update peer details when new nodes are added to the model
|
|
|
|
connect(model->getPeerTableModel(), SIGNAL(layoutChanged()), this, SLOT(peerLayoutChanged()));
|
|
|
|
connect(model->getPeerTableModel(), SIGNAL(layoutChanged()), this, SLOT(peerLayoutChanged()));
|
|
|
|
|
|
|
|
// peer table signal handling - cache selected node ids
|
|
|
|
|
|
|
|
connect(model->getPeerTableModel(), SIGNAL(layoutAboutToChange()), this, SLOT(peerLayoutAboutToChange()));
|
|
|
|
|
|
|
|
|
|
|
|
// set up ban table
|
|
|
|
// set up ban table
|
|
|
|
ui->banlistWidget->setModel(model->getBanTableModel());
|
|
|
|
ui->banlistWidget->setModel(model->getBanTableModel());
|
|
|
@ -825,6 +826,17 @@ void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelecti
|
|
|
|
updateNodeDetail(stats);
|
|
|
|
updateNodeDetail(stats);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RPCConsole::peerLayoutAboutToChange()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QModelIndexList selected = ui->peerWidget->selectionModel()->selectedIndexes();
|
|
|
|
|
|
|
|
cachedNodeids.clear();
|
|
|
|
|
|
|
|
for(int i = 0; i < selected.size(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(selected.at(i).row());
|
|
|
|
|
|
|
|
cachedNodeids.append(stats->nodeStats.nodeid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RPCConsole::peerLayoutChanged()
|
|
|
|
void RPCConsole::peerLayoutChanged()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!clientModel || !clientModel->getPeerTableModel())
|
|
|
|
if (!clientModel || !clientModel->getPeerTableModel())
|
|
|
@ -834,7 +846,7 @@ void RPCConsole::peerLayoutChanged()
|
|
|
|
bool fUnselect = false;
|
|
|
|
bool fUnselect = false;
|
|
|
|
bool fReselect = false;
|
|
|
|
bool fReselect = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (cachedNodeid == -1) // no node selected yet
|
|
|
|
if (cachedNodeids.empty()) // no node selected yet
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// find the currently selected row
|
|
|
|
// find the currently selected row
|
|
|
@ -846,7 +858,7 @@ void RPCConsole::peerLayoutChanged()
|
|
|
|
|
|
|
|
|
|
|
|
// check if our detail node has a row in the table (it may not necessarily
|
|
|
|
// check if our detail node has a row in the table (it may not necessarily
|
|
|
|
// be at selectedRow since its position can change after a layout change)
|
|
|
|
// be at selectedRow since its position can change after a layout change)
|
|
|
|
int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeid);
|
|
|
|
int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeids.first());
|
|
|
|
|
|
|
|
|
|
|
|
if (detailNodeRow < 0)
|
|
|
|
if (detailNodeRow < 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -872,7 +884,10 @@ void RPCConsole::peerLayoutChanged()
|
|
|
|
|
|
|
|
|
|
|
|
if (fReselect)
|
|
|
|
if (fReselect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ui->peerWidget->selectRow(detailNodeRow);
|
|
|
|
for(int i = 0; i < cachedNodeids.size(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ui->peerWidget->selectRow(clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeids.at(i)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (stats)
|
|
|
|
if (stats)
|
|
|
@ -881,9 +896,6 @@ void RPCConsole::peerLayoutChanged()
|
|
|
|
|
|
|
|
|
|
|
|
void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
|
|
|
|
void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Update cached nodeid
|
|
|
|
|
|
|
|
cachedNodeid = stats->nodeStats.nodeid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// update the detail ui with latest node information
|
|
|
|
// update the detail ui with latest node information
|
|
|
|
QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName) + " ");
|
|
|
|
QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName) + " ");
|
|
|
|
peerAddrDetails += tr("(node id: %1)").arg(QString::number(stats->nodeStats.nodeid));
|
|
|
|
peerAddrDetails += tr("(node id: %1)").arg(QString::number(stats->nodeStats.nodeid));
|
|
|
@ -1038,7 +1050,7 @@ void RPCConsole::unbanSelectedNode()
|
|
|
|
void RPCConsole::clearSelectedNode()
|
|
|
|
void RPCConsole::clearSelectedNode()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ui->peerWidget->selectionModel()->clearSelection();
|
|
|
|
ui->peerWidget->selectionModel()->clearSelection();
|
|
|
|
cachedNodeid = -1;
|
|
|
|
cachedNodeids.clear();
|
|
|
|
ui->detailWidget->hide();
|
|
|
|
ui->detailWidget->hide();
|
|
|
|
ui->peerHeading->setText(tr("Select a peer to view detailed information."));
|
|
|
|
ui->peerHeading->setText(tr("Select a peer to view detailed information."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|