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.
This commit is contained in:
Hennadii Stepanov 2021-04-17 14:28:39 +03:00 committed by Jarol Rodriguez
parent 4f0ae472e2
commit d2cc339005
2 changed files with 4 additions and 9 deletions

View file

@ -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();

View file

@ -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);