mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge bitcoin-core/gui#256: Save/restore column sizes of the tables in the Peers tab
fb1b1e0f3eae32b087347889ed7502b7f2c48549 qt: Save/restore column sizes of the tables in the Peers tab (Hennadii Stepanov) Pull request description: ACKs for top commit: jonatack: ACK fb1b1e0f3eae32b087347889ed7502b7f2c48549 code review, debug-built and tested jarolrod: ACK fb1b1e0f3eae32b087347889ed7502b7f2c48549 Tree-SHA512: f93495ecd13e4202aba61b407fffbeec855f5b0c1cc027197c78edddd7d11c87ebdb0fcb1daac242f0407323b31f4e7e0313bd76113a5241e4c868a8829af20a
This commit is contained in:
parent
f4fccd31cb
commit
3be79a9ed9
@ -505,6 +505,9 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags
|
||||
ui->splitter->restoreState(settings.value("RPCConsoleWidgetPeersTabSplitterSizes").toByteArray());
|
||||
}
|
||||
|
||||
m_peer_widget_header_state = settings.value("PeersTabPeerHeaderState").toByteArray();
|
||||
m_banlist_widget_header_state = settings.value("PeersTabBanlistHeaderState").toByteArray();
|
||||
|
||||
constexpr QChar nonbreaking_hyphen(8209);
|
||||
const std::vector<QString> CONNECTION_TYPE_DOC{
|
||||
//: Explanatory text for an inbound peer connection.
|
||||
@ -610,6 +613,9 @@ RPCConsole::~RPCConsole()
|
||||
settings.setValue("RPCConsoleWidgetPeersTabSplitterSizes", ui->splitter->saveState());
|
||||
}
|
||||
|
||||
settings.setValue("PeersTabPeerHeaderState", m_peer_widget_header_state);
|
||||
settings.setValue("PeersTabBanlistHeaderState", m_banlist_widget_header_state);
|
||||
|
||||
m_node.rpcUnsetTimerInterface(rpcTimerInterface);
|
||||
delete rpcTimerInterface;
|
||||
delete pageButtons;
|
||||
@ -701,9 +707,12 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
||||
ui->peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->peerWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
ui->peerWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
if (!ui->peerWidget->horizontalHeader()->restoreState(m_peer_widget_header_state)) {
|
||||
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()->setStretchLastSection(true);
|
||||
ui->peerWidget->setItemDelegateForColumn(PeerTableModel::NetNodeId, new PeerIdViewDelegate(this));
|
||||
|
||||
@ -726,8 +735,11 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
||||
ui->banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
if (!ui->banlistWidget->horizontalHeader()->restoreState(m_banlist_widget_header_state)) {
|
||||
ui->banlistWidget->setColumnWidth(BanTableModel::Address, BANSUBNET_COLUMN_WIDTH);
|
||||
ui->banlistWidget->setColumnWidth(BanTableModel::Bantime, BANTIME_COLUMN_WIDTH);
|
||||
}
|
||||
ui->banlistWidget->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
// create ban table context menu
|
||||
@ -1357,6 +1369,11 @@ void RPCConsole::showEvent(QShowEvent *event)
|
||||
|
||||
void RPCConsole::hideEvent(QHideEvent *event)
|
||||
{
|
||||
// It is too late to call QHeaderView::saveState() in ~RPCConsole(), as all of
|
||||
// the columns of QTableView child widgets will have zero width at that moment.
|
||||
m_peer_widget_header_state = ui->peerWidget->horizontalHeader()->saveState();
|
||||
m_banlist_widget_header_state = ui->banlistWidget->horizontalHeader()->saveState();
|
||||
|
||||
QWidget::hideEvent(event);
|
||||
|
||||
if (!clientModel || !clientModel->getPeerTableModel())
|
||||
|
@ -12,9 +12,10 @@
|
||||
#include <net.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QByteArray>
|
||||
#include <QCompleter>
|
||||
#include <QThread>
|
||||
#include <QWidget>
|
||||
|
||||
class ClientModel;
|
||||
class RPCTimerInterface;
|
||||
@ -190,6 +191,8 @@ private:
|
||||
QThread thread;
|
||||
WalletModel* m_last_wallet_model{nullptr};
|
||||
bool m_is_executing{false};
|
||||
QByteArray m_peer_widget_header_state;
|
||||
QByteArray m_banlist_widget_header_state;
|
||||
|
||||
/** Update UI with latest network info from model. */
|
||||
void updateNetworkState();
|
||||
|
Loading…
Reference in New Issue
Block a user