-
Notifications
You must be signed in to change notification settings - Fork 314
Hide peer detail view if multiple are selected #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jonasschnelli
merged 1 commit into
bitcoin-core:master
from
promag:2020-06-peer-detail-view
Nov 20, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -492,9 +492,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty | |||||||
m_node.rpcSetTimerInterfaceIfUnset(rpcTimerInterface); | ||||||||
|
||||||||
setTrafficGraphRange(INITIAL_TRAFFIC_GRAPH_MINS); | ||||||||
|
||||||||
ui->detailWidget->hide(); | ||||||||
ui->peerHeading->setText(tr("Select a peer to view detailed information.")); | ||||||||
updateDetailWidget(); | ||||||||
|
||||||||
consoleFontSize = settings.value(fontSizeSettingsKey, QFont().pointSize()).toInt(); | ||||||||
clear(); | ||||||||
|
@@ -625,7 +623,7 @@ void RPCConsole::setClientModel(ClientModel *model) | |||||||
connect(disconnectAction, &QAction::triggered, this, &RPCConsole::disconnectSelectedNode); | ||||||||
|
||||||||
// peer table signal handling - update peer details when selecting new node | ||||||||
connect(ui->peerWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RPCConsole::peerSelected); | ||||||||
connect(ui->peerWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RPCConsole::updateDetailWidget); | ||||||||
// peer table signal handling - update peer details when new nodes are added to the model | ||||||||
connect(model->getPeerTableModel(), &PeerTableModel::layoutChanged, this, &RPCConsole::peerLayoutChanged); | ||||||||
// peer table signal handling - cache selected node ids | ||||||||
|
@@ -1017,18 +1015,6 @@ void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut) | |||||||
ui->lblBytesOut->setText(GUIUtil::formatBytes(totalBytesOut)); | ||||||||
} | ||||||||
|
||||||||
void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelection &deselected) | ||||||||
{ | ||||||||
Q_UNUSED(deselected); | ||||||||
|
||||||||
if (!clientModel || !clientModel->getPeerTableModel() || selected.indexes().isEmpty()) | ||||||||
return; | ||||||||
|
||||||||
const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(selected.indexes().first().row()); | ||||||||
if (stats) | ||||||||
updateNodeDetail(stats); | ||||||||
} | ||||||||
|
||||||||
void RPCConsole::peerLayoutAboutToChange() | ||||||||
{ | ||||||||
QModelIndexList selected = ui->peerWidget->selectionModel()->selectedIndexes(); | ||||||||
|
@@ -1045,7 +1031,6 @@ void RPCConsole::peerLayoutChanged() | |||||||
if (!clientModel || !clientModel->getPeerTableModel()) | ||||||||
return; | ||||||||
|
||||||||
const CNodeCombinedStats *stats = nullptr; | ||||||||
bool fUnselect = false; | ||||||||
bool fReselect = false; | ||||||||
|
||||||||
|
@@ -1076,9 +1061,6 @@ void RPCConsole::peerLayoutChanged() | |||||||
fUnselect = true; | ||||||||
fReselect = true; | ||||||||
} | ||||||||
|
||||||||
// get fresh stats on the detail node. | ||||||||
stats = clientModel->getPeerTableModel()->getNodeStats(detailNodeRow); | ||||||||
} | ||||||||
|
||||||||
if (fUnselect && selectedRow >= 0) { | ||||||||
|
@@ -1093,12 +1075,20 @@ void RPCConsole::peerLayoutChanged() | |||||||
} | ||||||||
} | ||||||||
|
||||||||
if (stats) | ||||||||
updateNodeDetail(stats); | ||||||||
updateDetailWidget(); | ||||||||
} | ||||||||
|
||||||||
void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats) | ||||||||
void RPCConsole::updateDetailWidget() | ||||||||
{ | ||||||||
QModelIndexList selected_rows; | ||||||||
auto selection_model = ui->peerWidget->selectionModel(); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||||
if (selection_model) selected_rows = selection_model->selectedRows(); | ||||||||
if (!clientModel || !clientModel->getPeerTableModel() || selected_rows.size() != 1) { | ||||||||
ui->detailWidget->hide(); | ||||||||
ui->peerHeading->setText(tr("Select a peer to view detailed information.")); | ||||||||
return; | ||||||||
} | ||||||||
const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(selected_rows.first().row()); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nanonit:
Suggested change
or even use |
||||||||
// update the detail ui with latest node information | ||||||||
QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName) + " "); | ||||||||
peerAddrDetails += tr("(node id: %1)").arg(QString::number(stats->nodeStats.nodeid)); | ||||||||
|
@@ -1251,8 +1241,7 @@ void RPCConsole::clearSelectedNode() | |||||||
{ | ||||||||
ui->peerWidget->selectionModel()->clearSelection(); | ||||||||
cachedNodeids.clear(); | ||||||||
ui->detailWidget->hide(); | ||||||||
ui->peerHeading->setText(tr("Select a peer to view detailed information.")); | ||||||||
updateDetailWidget(); | ||||||||
} | ||||||||
|
||||||||
void RPCConsole::showOrHideBanTableIfRequired() | ||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.