From d2cc3390054616c73f72a59f864700f6de14067b Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sat, 17 Apr 2021 14:28:39 +0300 Subject: qt, refactor: Drop redundant history cleaning in RPC console The default clearHistory=true argument is passed in the RPCConsole ctor only. This is needless, as the history and historyPtr members are initialized properly. --- src/qt/rpcconsole.cpp | 11 +++-------- src/qt/rpcconsole.h | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src/qt') diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index c2604d68ea..378328d1b2 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -494,7 +494,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty ui->lineEdit->setMaxLength(16 * 1024 * 1024); ui->messagesWidget->installEventFilter(this); - connect(ui->clearButton, &QPushButton::clicked, [this] { clear(/* clearHistory */ false); }); + connect(ui->clearButton, &QPushButton::clicked, [this] { clear(); }); connect(ui->fontBiggerButton, &QPushButton::clicked, this, &RPCConsole::fontBigger); connect(ui->fontSmallerButton, &QPushButton::clicked, this, &RPCConsole::fontSmaller); connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear); @@ -776,19 +776,14 @@ void RPCConsole::setFontSize(int newSize) // clear console (reset icon sizes, default stylesheet) and re-add the content float oldPosFactor = 1.0 / ui->messagesWidget->verticalScrollBar()->maximum() * ui->messagesWidget->verticalScrollBar()->value(); - clear(false); + clear(); ui->messagesWidget->setHtml(str); ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum()); } -void RPCConsole::clear(bool clearHistory) +void RPCConsole::clear() { ui->messagesWidget->clear(); - if(clearHistory) - { - history.clear(); - historyPtr = 0; - } ui->lineEdit->clear(); ui->lineEdit->setFocus(); diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index b9806e40c9..b686154818 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -99,7 +99,7 @@ private Q_SLOTS: void updateDetailWidget(); public Q_SLOTS: - void clear(bool clearHistory = true); + void clear(); void fontBigger(); void fontSmaller(); void setFontSize(int newSize); -- cgit v1.2.3