Skip to content

Commit

Permalink
qt: Add shortcuts for console font resize buttons
Browse files Browse the repository at this point in the history
Co-authored-by: Jarol Rodriguez <[email protected]>
  • Loading branch information
hebasto and jarolrod committed May 17, 2021
1 parent a2e122f commit 2a45134
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,18 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
ui->openDebugLogfileButton->setIcon(platformStyle->SingleColorIcon(":/icons/export"));
}
ui->clearButton->setIcon(platformStyle->SingleColorIcon(":/icons/remove"));

ui->fontBiggerButton->setIcon(platformStyle->SingleColorIcon(":/icons/fontbigger"));
//: Main shortcut to increase the RPC console font size.
ui->fontBiggerButton->setShortcut(tr("Ctrl++"));
//: Secondary shortcut to increase the RPC console font size.
GUIUtil::AddButtonShortcut(ui->fontBiggerButton, tr("Ctrl+="));

ui->fontSmallerButton->setIcon(platformStyle->SingleColorIcon(":/icons/fontsmaller"));
//: Main shortcut to decrease the RPC console font size.
ui->fontSmallerButton->setShortcut(tr("Ctrl+-"));
//: Secondary shortcut to decrease the RPC console font size.
GUIUtil::AddButtonShortcut(ui->fontSmallerButton, tr("Ctrl+_"));

// Install event filter for up and down arrow
ui->lineEdit->installEventFilter(this);
Expand Down Expand Up @@ -816,14 +826,23 @@ void RPCConsole::clear(bool clearHistory)
).arg(fixedFontInfo.family(), QString("%1pt").arg(consoleFontSize))
);

message(CMD_REPLY, (tr("Welcome to the %1 RPC console.").arg(PACKAGE_NAME) + "<br>" +
tr("Use up and down arrows to navigate history, and %1 to clear screen.").arg("<b>" + ui->clearButton->shortcut().toString(QKeySequence::NativeText) + "</b>") + "<br>" +
tr("Type %1 for an overview of available commands.").arg("<b>help</b>") + "<br>" +
tr("For more information on using this console type %1.").arg("<b>help-console</b>") +
"<br><span class=\"secwarning\"><br>" +
tr("WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramifications of a command.") +
"</span>"),
true);
message(CMD_REPLY,
tr("Welcome to the %1 RPC console.").arg(PACKAGE_NAME) +
"<br>" +
tr("Use up and down arrows to navigate history, and %1 to clear screen.")
.arg("<b>" + ui->clearButton->shortcut().toString(QKeySequence::NativeText) + "</b>") +
"<br>" +
tr("Use %1 and %2 to increase or decrease the font size.")
.arg("<b>" + ui->fontBiggerButton->shortcut().toString(QKeySequence::NativeText) + "</b>")
.arg("<b>" + ui->fontSmallerButton->shortcut().toString(QKeySequence::NativeText) + "</b>") +
"<br>" +
tr("Type %1 for an overview of available commands.").arg("<b>help</b>") +
"<br>" +
tr("For more information on using this console type %1.").arg("<b>help-console</b>") +
"<br><span class=\"secwarning\"><br>" +
tr("WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramifications of a command.") +
"</span>",
true);
}

void RPCConsole::keyPressEvent(QKeyEvent *event)
Expand Down

0 comments on commit 2a45134

Please sign in to comment.