Skip to content

Commit

Permalink
qt, rpc: Do not accept command while executing another one
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Oct 28, 2020
1 parent 3f512f3 commit 0dadb82
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ void RPCConsole::clear(bool clearHistory)
historyPtr = 0;
}
ui->lineEdit->clear();
ui->lineEdit->setEnabled(true);
ui->lineEdit->setFocus();

// Add smoothly scaled icon images.
Expand Down Expand Up @@ -890,8 +891,10 @@ void RPCConsole::on_lineEdit_returnPressed()
{
QString cmd = ui->lineEdit->text();

if(!cmd.isEmpty())
{
if (!cmd.isEmpty()) {
ui->lineEdit->setEnabled(false);
ui->lineEdit->setText("executing...");

std::string strFilteredCmd;
try {
std::string dummy;
Expand All @@ -904,8 +907,6 @@ void RPCConsole::on_lineEdit_returnPressed()
return;
}

ui->lineEdit->clear();

cmdBeforeBrowsing = QString();

#ifdef ENABLE_WALLET
Expand Down Expand Up @@ -968,7 +969,12 @@ void RPCConsole::startExecutor()
executor->moveToThread(&thread);

// Replies from executor object must go to this object
connect(executor, &RPCExecutor::reply, this, static_cast<void (RPCConsole::*)(int, const QString&)>(&RPCConsole::message));
connect(executor, &RPCExecutor::reply, this, [this](int category, const QString& command) {
message(category, command);
ui->lineEdit->clear();
ui->lineEdit->setEnabled(true);
ui->lineEdit->setFocus();
});

// Requests from this object must go to executor
connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request);
Expand Down

0 comments on commit 0dadb82

Please sign in to comment.