Skip to content

Commit d2cc339

Browse files
hebastojarolrod
authored andcommitted
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.
1 parent 4f0ae47 commit d2cc339

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/qt/rpcconsole.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
494494
ui->lineEdit->setMaxLength(16 * 1024 * 1024);
495495
ui->messagesWidget->installEventFilter(this);
496496

497-
connect(ui->clearButton, &QPushButton::clicked, [this] { clear(/* clearHistory */ false); });
497+
connect(ui->clearButton, &QPushButton::clicked, [this] { clear(); });
498498
connect(ui->fontBiggerButton, &QPushButton::clicked, this, &RPCConsole::fontBigger);
499499
connect(ui->fontSmallerButton, &QPushButton::clicked, this, &RPCConsole::fontSmaller);
500500
connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear);
@@ -776,19 +776,14 @@ void RPCConsole::setFontSize(int newSize)
776776

777777
// clear console (reset icon sizes, default stylesheet) and re-add the content
778778
float oldPosFactor = 1.0 / ui->messagesWidget->verticalScrollBar()->maximum() * ui->messagesWidget->verticalScrollBar()->value();
779-
clear(false);
779+
clear();
780780
ui->messagesWidget->setHtml(str);
781781
ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum());
782782
}
783783

784-
void RPCConsole::clear(bool clearHistory)
784+
void RPCConsole::clear()
785785
{
786786
ui->messagesWidget->clear();
787-
if(clearHistory)
788-
{
789-
history.clear();
790-
historyPtr = 0;
791-
}
792787
ui->lineEdit->clear();
793788
ui->lineEdit->setFocus();
794789

src/qt/rpcconsole.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private Q_SLOTS:
9999
void updateDetailWidget();
100100

101101
public Q_SLOTS:
102-
void clear(bool clearHistory = true);
102+
void clear();
103103
void fontBigger();
104104
void fontSmaller();
105105
void setFontSize(int newSize);

0 commit comments

Comments
 (0)