aboutsummaryrefslogtreecommitdiff
path: root/src/qt/rpcconsole.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r--src/qt/rpcconsole.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 6f2efa0097..9528e72d26 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -180,7 +180,7 @@ void RPCExecutor::request(const QString &command)
emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
}
- catch (json_spirit::Object& objError)
+ catch (const json_spirit::Object& objError)
{
try // Nice formatting for standard-format error
{
@@ -188,19 +188,19 @@ void RPCExecutor::request(const QString &command)
std::string message = find_value(objError, "message").get_str();
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")");
}
- catch(std::runtime_error &) // raised when converting to invalid type, i.e. missing code or message
+ catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message
{ // Show raw JSON object
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
}
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what()));
}
}
RPCConsole::RPCConsole(QWidget *parent) :
- QDialog(parent),
+ QWidget(parent),
ui(new Ui::RPCConsole),
clientModel(0),
historyPtr(0),
@@ -278,7 +278,7 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
}
}
}
- return QDialog::eventFilter(obj, event);
+ return QWidget::eventFilter(obj, event);
}
void RPCConsole::setClientModel(ClientModel *model)
@@ -361,16 +361,17 @@ void RPCConsole::clear()
"b { color: #006060; } "
);
- message(CMD_REPLY, (tr("Welcome to the Bitcoin RPC console.") + "<br>" +
+ message(CMD_REPLY, (tr("Welcome to the Bitcoin Core RPC console.") + "<br>" +
tr("Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.") + "<br>" +
tr("Type <b>help</b> for an overview of available commands.")), true);
}
-void RPCConsole::reject()
+void RPCConsole::keyPressEvent(QKeyEvent *event)
{
- // Ignore escape keypress if this is not a seperate window
- if(windowType() != Qt::Widget)
- QDialog::reject();
+ if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape)
+ {
+ close();
+ }
}
void RPCConsole::message(int category, const QString &message, bool html)