Terminal: Refactor actions

Change actions to use ActionBuilder and
use ToggleAspects for tool buttons.

Change-Id: I0f4a58c3a98cb2804e3d387ea02cac043bd71ae7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-11-27 07:51:39 +01:00
parent daa85c3166
commit a0c05cabcc
8 changed files with 163 additions and 186 deletions

View File

@@ -5,6 +5,7 @@
namespace Terminal::Constants {
constexpr char NEWTERMINAL[] = "Terminal.NewTerminal";
constexpr char CLOSETERMINAL[] = "Terminal.CloseTerminal";
constexpr char NEXTTERMINAL[] = "Terminal.NextTerminal";
constexpr char PREVTERMINAL[] = "Terminal.PrevTerminal";
constexpr char MINMAX[] = "Terminal.MinMax";

View File

@@ -4,7 +4,6 @@
#include "terminalpane.h"
#include "shellmodel.h"
#include "shortcutmap.h"
#include "terminalconstants.h"
#include "terminalicons.h"
#include "terminalsettings.h"
@@ -15,7 +14,6 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <coreplugin/locator/locatorconstants.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectmanager.h>
@@ -57,13 +55,16 @@ TerminalPane::TerminalPane(QObject *parent)
currentTerminal()->zoomOut();
});
createShellMenu();
initActions();
m_newTerminalButton = new QToolButton();
m_newTerminalButton->setDefaultAction(&newTerminal);
m_newTerminalButton->setDefaultAction(m_newTerminalAction);
m_newTerminalButton->setMenu(&m_shellMenu);
m_newTerminalButton->setPopupMode(QToolButton::MenuButtonPopup);
m_closeTerminalButton = new QToolButton();
m_closeTerminalButton->setDefaultAction(&closeTerminal);
m_closeTerminalButton->setDefaultAction(m_closeTerminalAction);
m_openSettingsButton = new QToolButton();
m_openSettingsButton->setToolTip(Tr::tr("Configure..."));
@@ -73,66 +74,11 @@ TerminalPane::TerminalPane(QObject *parent)
ICore::showOptionsDialog("Terminal.General");
});
const auto updateEscButton = [this] {
m_escSettingButton->setChecked(settings().sendEscapeToTerminal());
static const QString escKey
= QKeySequence(Qt::Key_Escape).toString(QKeySequence::NativeText);
static const QString shiftEsc = QKeySequence(
QKeyCombination(Qt::ShiftModifier, Qt::Key_Escape))
.toString(QKeySequence::NativeText);
if (settings().sendEscapeToTerminal()) {
m_escSettingButton->setText(escKey);
//: %1 is the application name (Qt Creator)
m_escSettingButton->setToolTip(Tr::tr("Sends Esc to terminal instead of %1.")
.arg(QGuiApplication::applicationDisplayName()));
} else {
m_escSettingButton->setText(shiftEsc);
m_escSettingButton->setToolTip(
Tr::tr("Press %1 to send Esc to terminal.").arg(shiftEsc));
}
};
m_escSettingButton = new QToolButton();
m_escSettingButton->setCheckable(true);
updateEscButton();
connect(m_escSettingButton, &QToolButton::toggled, this, [this, updateEscButton] {
settings().sendEscapeToTerminal.setValue(m_escSettingButton->isChecked());
updateEscButton();
});
connect(&settings(), &TerminalSettings::applied, this, updateEscButton);
const auto updateLockButton = [this] {
m_lockKeyboardButton->setChecked(settings().lockKeyboard());
if (settings().lockKeyboard()) {
m_lockKeyboardButton->setIcon(LOCK_KEYBOARD_ICON.icon());
m_lockKeyboardButton->setToolTip(
//: %1 is the application name (Qt Creator)
Tr::tr("%1 shortcuts are blocked when focus is inside the terminal.")
.arg(QGuiApplication::applicationDisplayName()));
} else {
m_lockKeyboardButton->setIcon(UNLOCK_KEYBOARD_ICON.icon());
//: %1 is the application name (Qt Creator)
m_lockKeyboardButton->setToolTip(Tr::tr("%1 shortcuts take precedence.")
.arg(QGuiApplication::applicationDisplayName()));
}
};
m_escSettingButton->setDefaultAction(settings().sendEscapeToTerminal.action());
m_lockKeyboardButton = new QToolButton();
m_lockKeyboardButton->setCheckable(true);
updateLockButton();
connect(&toggleKeyboardLock, &QAction::triggered, m_lockKeyboardButton, &QToolButton::toggle);
connect(m_lockKeyboardButton, &QToolButton::toggled, this, [this, updateLockButton] {
settings().lockKeyboard.setValue(m_lockKeyboardButton->isChecked());
updateLockButton();
});
connect(&settings(), &TerminalSettings::applied, this, updateLockButton);
m_lockKeyboardButton->setDefaultAction(m_toggleKeyboardLockAction);
}
TerminalPane::~TerminalPane() {}
@@ -164,7 +110,6 @@ void TerminalPane::openTerminal(const OpenTerminalParameters &parameters)
using namespace Constants;
terminalWidget->unlockGlobalAction("Coreplugin.OutputPane.minmax");
terminalWidget->unlockGlobalAction(Core::Constants::LOCATE);
terminalWidget->unlockGlobalAction(NEWTERMINAL);
terminalWidget->unlockGlobalAction(NEXTTERMINAL);
terminalWidget->unlockGlobalAction(PREVTERMINAL);
@@ -281,55 +226,51 @@ void TerminalPane::setupTerminalWidget(TerminalWidget *terminal)
void TerminalPane::initActions()
{
createShellMenu();
newTerminal.setText(Tr::tr("New Terminal"));
newTerminal.setIcon(NEW_TERMINAL_ICON.icon());
newTerminal.setToolTip(Tr::tr("Create a new Terminal."));
newTerminal.setMenu(&m_shellMenu);
nextTerminal.setText(Tr::tr("Next Terminal"));
prevTerminal.setText(Tr::tr("Previous Terminal"));
closeTerminal.setIcon(CLOSE_TERMINAL_ICON.icon());
closeTerminal.setToolTip(Tr::tr("Close the current Terminal."));
toggleKeyboardLock.setText(Tr::tr("Toggle Keyboard Lock"));
using namespace Constants;
Command *cmd = ActionManager::registerAction(&newTerminal, NEWTERMINAL, m_selfContext);
cmd->setDefaultKeySequences({QKeySequence(
ActionBuilder newTerminalAction(this, NEWTERMINAL);
newTerminalAction.setText(Tr::tr("New Terminal"));
newTerminalAction.setIcon(NEW_TERMINAL_ICON.icon());
newTerminalAction.setToolTip(Tr::tr("Create a new Terminal."));
newTerminalAction.setDefaultKeySequences({QKeySequence(
HostOsInfo::isMacHost() ? QLatin1String("Ctrl+T") : QLatin1String("Ctrl+Shift+T"))});
newTerminalAction.setOnTriggered(this, [this] { openTerminal({}); });
m_newTerminalAction = newTerminalAction.commandAction();
ActionManager::registerAction(&nextTerminal, NEXTTERMINAL, m_selfContext)
->setDefaultKeySequences(
{QKeySequence("Alt+Tab"),
QKeySequence(HostOsInfo::isMacHost() ? QLatin1String("Ctrl+Shift+[")
: QLatin1String("Ctrl+PgUp"))});
ActionBuilder closeTerminalAction(this, CLOSETERMINAL);
closeTerminalAction.setText(Tr::tr("Close Terminal"));
closeTerminalAction.setIcon(CLOSE_TERMINAL_ICON.icon());
closeTerminalAction.setToolTip(Tr::tr("Close the current Terminal."));
closeTerminalAction.setOnTriggered(this, [this] { removeTab(m_tabWidget.currentIndex()); });
m_closeTerminalAction = closeTerminalAction.commandAction();
ActionManager::registerAction(&prevTerminal, PREVTERMINAL, m_selfContext)
->setDefaultKeySequences(
{QKeySequence("Alt+Shift+Tab"),
QKeySequence(HostOsInfo::isMacHost() ? QLatin1String("Ctrl+Shift+]")
: QLatin1String("Ctrl+PgDown"))});
ActionManager::registerAction(&toggleKeyboardLock,
TOGGLE_KEYBOARD_LOCK,
m_selfContext);
connect(&newTerminal, &QAction::triggered, this, [this] { openTerminal({}); });
connect(&closeTerminal, &QAction::triggered, this, [this] {
removeTab(m_tabWidget.currentIndex());
});
connect(&nextTerminal, &QAction::triggered, this, [this] {
ActionBuilder nextTerminalAction(this, NEXTTERMINAL);
nextTerminalAction.setText(Tr::tr("Next Terminal"));
nextTerminalAction.setDefaultKeySequences(
{QKeySequence("Alt+Tab"),
QKeySequence(HostOsInfo::isMacHost() ? QLatin1String("Ctrl+Shift+[")
: QLatin1String("Ctrl+PgUp"))});
nextTerminalAction.setOnTriggered(this, [this] {
if (canNavigate())
goToNext();
});
connect(&prevTerminal, &QAction::triggered, this, [this] {
ActionBuilder prevTerminalAction(this, PREVTERMINAL);
prevTerminalAction.setText(Tr::tr("Previous Terminal"));
prevTerminalAction.setDefaultKeySequences(
{QKeySequence("Alt+Shift+Tab"),
QKeySequence(HostOsInfo::isMacHost() ? QLatin1String("Ctrl+Shift+]")
: QLatin1String("Ctrl+PgDown"))});
prevTerminalAction.setOnTriggered(this, [this] {
if (canPrevious())
goToPrev();
});
Command *cmd = ActionManager::registerAction(settings().lockKeyboard.action(),
TOGGLE_KEYBOARD_LOCK);
m_toggleKeyboardLockAction = cmd->action();
cmd->setAttribute(Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateIcon);
}
void TerminalPane::createShellMenu()

View File

@@ -62,11 +62,9 @@ private:
QToolButton *m_escSettingButton{nullptr};
QToolButton *m_lockKeyboardButton{nullptr};
QAction newTerminal;
QAction nextTerminal;
QAction prevTerminal;
QAction closeTerminal;
QAction toggleKeyboardLock;
QAction *m_newTerminalAction{nullptr};
QAction *m_closeTerminalAction{nullptr};
QAction *m_toggleKeyboardLockAction{nullptr};
QMenu m_shellMenu;

View File

@@ -44,7 +44,7 @@ public:
m_terminalPane = new TerminalPane;
ExtensionSystem::PluginManager::addObject(m_terminalPane);
TerminalWidget::initActions();
TerminalWidget::initActions(this);
auto enable = [this] {
Utils::Terminal::Hooks::instance()

View File

@@ -3,6 +3,7 @@
#include "terminalsettings.h"
#include "terminalicons.h"
#include "terminaltr.h"
#include <coreplugin/icore.h>
@@ -19,6 +20,7 @@
#include <utils/theme/theme.h>
#include <QFontComboBox>
#include <QGuiApplication>
#include <QJsonDocument>
#include <QJsonObject>
#include <QLoggingCategory>
@@ -486,12 +488,34 @@ TerminalSettings::TerminalSettings()
"instead of closing the terminal."));
sendEscapeToTerminal.setDefaultValue(false);
static const QString escKey = QKeySequence(Qt::Key_Escape).toString(QKeySequence::NativeText);
static const QString shiftEsc = QKeySequence(QKeyCombination(Qt::ShiftModifier, Qt::Key_Escape))
.toString(QKeySequence::NativeText);
sendEscapeToTerminal.setOnText(escKey);
sendEscapeToTerminal.setOffText(shiftEsc);
sendEscapeToTerminal.setOnTooltip(Tr::tr("Sends Esc to terminal instead of %1.")
.arg(QGuiApplication::applicationDisplayName()));
sendEscapeToTerminal.setOffTooltip(Tr::tr("Press %1 to send Esc to terminal.").arg(shiftEsc));
QObject::connect(&sendEscapeToTerminal,
&ToggleAspect::changed,
this,
&TerminalSettings::writeSettings);
lockKeyboard.setSettingsKey("LockKeyboard");
lockKeyboard.setLabelText(Tr::tr("Block shortcuts in terminal"));
lockKeyboard.setToolTip(
Tr::tr("Keeps Qt Creator shortcuts from interfering with the terminal."));
lockKeyboard.setDefaultValue(true);
lockKeyboard.setIcon(LOCK_KEYBOARD_ICON.icon());
lockKeyboard.setOffIcon(UNLOCK_KEYBOARD_ICON.icon());
lockKeyboard.setOnTooltip(Tr::tr("%1 shortcuts are blocked when focus is inside the terminal.")
.arg(qApp->applicationDisplayName()));
lockKeyboard.setOffTooltip(
Tr::tr("%1 shortcuts take precedence.").arg(qApp->applicationDisplayName()));
QObject::connect(&lockKeyboard, &ToggleAspect::changed, this, &TerminalSettings::writeSettings);
audibleBell.setSettingsKey("AudibleBell");
audibleBell.setLabelText(Tr::tr("Audible bell"));
audibleBell.setToolTip(Tr::tr("Makes the terminal beep when a bell "

View File

@@ -28,9 +28,9 @@ public:
Utils::BoolAspect allowBlinkingCursor{this};
Utils::BoolAspect sendEscapeToTerminal{this};
Utils::ToggleAspect sendEscapeToTerminal{this};
Utils::BoolAspect audibleBell{this};
Utils::BoolAspect lockKeyboard{this};
Utils::ToggleAspect lockKeyboard{this};
Utils::BoolAspect enableMouseTracking{this};
};

View File

@@ -14,6 +14,7 @@
#include <coreplugin/fileutils.h>
#include <coreplugin/find/textfindconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/locator/locatorconstants.h>
#include <coreplugin/messagemanager.h>
#include <utils/algorithm.h>
@@ -256,44 +257,57 @@ void TerminalWidget::registerShortcut(Command *cmd)
});
}
RegisteredAction TerminalWidget::registerAction(Id commandId, const Context &context)
{
QAction *action = new QAction;
Command *cmd = ActionManager::registerAction(action, commandId, context);
registerShortcut(cmd);
return RegisteredAction(action, [commandId](QAction *a) {
ActionManager::unregisterAction(a, commandId);
delete a;
});
}
void TerminalWidget::setupActions()
{
m_copy = registerAction(Constants::COPY, m_context);
m_paste = registerAction(Constants::PASTE, m_context);
m_close = registerAction(Core::Constants::CLOSE, m_context);
m_clearTerminal = registerAction(Constants::CLEAR_TERMINAL, m_context);
m_clearSelection = registerAction(Constants::CLEARSELECTION, m_context);
m_moveCursorWordLeft = registerAction(Constants::MOVECURSORWORDLEFT, m_context);
m_moveCursorWordRight = registerAction(Constants::MOVECURSORWORDRIGHT, m_context);
m_selectAll = registerAction(Constants::SELECTALL, m_context);
auto make_registered = [this](ActionBuilder &actionBuilder) {
registerShortcut(actionBuilder.command());
connect(m_copy.get(), &QAction::triggered, this, &TerminalWidget::copyToClipboard);
connect(m_paste.get(), &QAction::triggered, this, &TerminalWidget::pasteFromClipboard);
connect(m_close.get(), &QAction::triggered, this, &TerminalWidget::closeTerminal);
connect(m_clearTerminal.get(), &QAction::triggered, this, &TerminalWidget::clearContents);
connect(m_selectAll.get(), &QAction::triggered, this, &TerminalWidget::selectAll);
connect(m_clearSelection.get(), &QAction::triggered, this, &TerminalWidget::clearSelection);
connect(m_moveCursorWordLeft.get(),
&QAction::triggered,
this,
&TerminalWidget::moveCursorWordLeft);
connect(m_moveCursorWordRight.get(),
&QAction::triggered,
this,
&TerminalWidget::moveCursorWordRight);
return RegisteredAction(actionBuilder.contextAction(),
[cmdId = actionBuilder.command()->id()](QAction *a) {
ActionManager::unregisterAction(a, cmdId);
delete a;
});
};
ActionBuilder copyAction(this, Constants::COPY);
copyAction.setContext(m_context);
copyAction.setOnTriggered(this, &TerminalWidget::copyToClipboard);
m_copy = make_registered(copyAction);
ActionBuilder pasteAction(this, Constants::PASTE);
pasteAction.setContext(m_context);
pasteAction.setOnTriggered(this, &TerminalWidget::pasteFromClipboard);
m_paste = make_registered(pasteAction);
ActionBuilder closeAction(this, Core::Constants::CLOSE);
closeAction.setContext(m_context);
closeAction.setOnTriggered(this, &TerminalWidget::closeTerminal);
m_close = make_registered(closeAction);
ActionBuilder clearTerminalAction(this, Constants::CLEAR_TERMINAL);
clearTerminalAction.setContext(m_context);
clearTerminalAction.setOnTriggered(this, &TerminalWidget::clearContents);
m_clearTerminal = make_registered(clearTerminalAction);
ActionBuilder clearSelectionAction(this, Constants::CLEARSELECTION);
clearSelectionAction.setContext(m_context);
clearSelectionAction.setOnTriggered(this, &TerminalWidget::clearSelection);
m_clearSelection = make_registered(clearSelectionAction);
ActionBuilder moveCursorWordLeftAction(this, Constants::MOVECURSORWORDLEFT);
moveCursorWordLeftAction.setContext(m_context);
moveCursorWordLeftAction.setOnTriggered(this, &TerminalWidget::moveCursorWordLeft);
m_moveCursorWordLeft = make_registered(moveCursorWordLeftAction);
ActionBuilder moveCursorWordRightAction(this, Constants::MOVECURSORWORDRIGHT);
moveCursorWordRightAction.setContext(m_context);
moveCursorWordRightAction.setOnTriggered(this, &TerminalWidget::moveCursorWordRight);
m_moveCursorWordRight = make_registered(moveCursorWordRightAction);
ActionBuilder selectAllAction(this, Constants::SELECTALL);
selectAllAction.setContext(m_context);
selectAllAction.setOnTriggered(this, &TerminalWidget::selectAll);
m_selectAll = make_registered(selectAllAction);
// Ctrl+Q, the default "Quit" shortcut, is a useful key combination in a shell.
// It can be used in combination with Ctrl+S to pause a program, and resume it with Ctrl+Q.
@@ -303,6 +317,7 @@ void TerminalWidget::setupActions()
unlockGlobalAction(Core::Constants::OPTIONS);
unlockGlobalAction("Preferences.Terminal.General");
unlockGlobalAction(Core::Constants::FIND_IN_DOCUMENT);
unlockGlobalAction(Core::Constants::LOCATE);
}
void TerminalWidget::closeTerminal()
@@ -607,57 +622,56 @@ bool TerminalWidget::event(QEvent *event)
return TerminalView::event(event);
}
void TerminalWidget::initActions()
void TerminalWidget::initActions(QObject *parent)
{
Core::Context context(Utils::Id("TerminalWidget"));
static QAction copy;
static QAction paste;
static QAction clearSelection;
static QAction clearTerminal;
static QAction selectAll;
static QAction moveCursorWordLeft;
static QAction moveCursorWordRight;
static QAction close;
auto keySequence = [](const QChar &key) -> QList<QKeySequence> {
if (HostOsInfo::isMacHost()) {
return {QKeySequence(QLatin1String("Ctrl+") + key)};
} else if (HostOsInfo::isLinuxHost()) {
return {QKeySequence(QLatin1String("Ctrl+Shift+") + key)};
} else if (HostOsInfo::isWindowsHost()) {
return {QKeySequence(QLatin1String("Ctrl+") + key),
QKeySequence(QLatin1String("Ctrl+Shift+") + key)};
}
};
copy.setText(Tr::tr("Copy"));
paste.setText(Tr::tr("Paste"));
clearSelection.setText(Tr::tr("Clear Selection"));
clearTerminal.setText(Tr::tr("Clear Terminal"));
selectAll.setText(Tr::tr("Select All"));
moveCursorWordLeft.setText(Tr::tr("Move Cursor Word Left"));
moveCursorWordRight.setText(Tr::tr("Move Cursor Word Right"));
close.setText(Tr::tr("Close Terminal"));
ActionBuilder copyAction(parent, Constants::COPY);
copyAction.setText(Tr::tr("Copy"));
copyAction.setContext(context);
copyAction.setDefaultKeySequences(keySequence('C'));
auto copyCmd = ActionManager::registerAction(&copy, Constants::COPY, context);
auto pasteCmd = ActionManager::registerAction(&paste, Constants::PASTE, context);
auto selectAllCmd = ActionManager::registerAction(&selectAll, Constants::SELECTALL, context);
ActionBuilder pasteAction(parent, Constants::PASTE);
pasteAction.setText(Tr::tr("Paste"));
pasteAction.setContext(context);
pasteAction.setDefaultKeySequences(keySequence('V'));
if (HostOsInfo::isMacHost()) {
copyCmd->setDefaultKeySequence(QKeySequence(QLatin1String("Ctrl+C")));
pasteCmd->setDefaultKeySequence(QKeySequence(QLatin1String("Ctrl+V")));
selectAllCmd->setDefaultKeySequence(QKeySequence(QLatin1String("Ctrl+A")));
} else if (HostOsInfo::isLinuxHost()) {
copyCmd->setDefaultKeySequence(QKeySequence(QLatin1String("Ctrl+Shift+C")));
pasteCmd->setDefaultKeySequence(QKeySequence(QLatin1String("Ctrl+Shift+V")));
selectAllCmd->setDefaultKeySequence(QKeySequence(QLatin1String("Ctrl+Shift+A")));
} else if (HostOsInfo::isWindowsHost()) {
copyCmd->setDefaultKeySequences(
{QKeySequence(QLatin1String("Ctrl+C")), QKeySequence(QLatin1String("Ctrl+Shift+C"))});
pasteCmd->setDefaultKeySequences(
{QKeySequence(QLatin1String("Ctrl+V")), QKeySequence(QLatin1String("Ctrl+Shift+V"))});
selectAllCmd->setDefaultKeySequence(QKeySequence(QLatin1String("Ctrl+Shift+A")));
}
ActionBuilder clearTerminalAction(parent, Constants::CLEAR_TERMINAL);
clearTerminalAction.setText(Tr::tr("Clear Terminal"));
clearTerminalAction.setContext(context);
ActionManager::registerAction(&clearSelection, Constants::CLEARSELECTION, context);
ActionBuilder selectAllAction(parent, Constants::SELECTALL);
selectAllAction.setText(Tr::tr("Select All"));
selectAllAction.setContext(context);
selectAllAction.setDefaultKeySequences(keySequence('A'));
ActionManager::registerAction(&moveCursorWordLeft, Constants::MOVECURSORWORDLEFT, context)
->setDefaultKeySequences({QKeySequence("Alt+Left")});
ActionBuilder clearSelectionAction(parent, Constants::CLEARSELECTION);
clearSelectionAction.setText(Tr::tr("Clear Selection"));
clearSelectionAction.setContext(context);
ActionManager::registerAction(&moveCursorWordRight, Constants::MOVECURSORWORDRIGHT, context)
->setDefaultKeySequences({QKeySequence("Alt+Right")});
ActionBuilder moveCursorWordLeftAction(parent, Constants::MOVECURSORWORDLEFT);
moveCursorWordLeftAction.setText(Tr::tr("Move Cursor Word Left"));
moveCursorWordLeftAction.setContext(context);
moveCursorWordLeftAction.setDefaultKeySequence({QKeySequence("Alt+Left")});
ActionManager::registerAction(&clearTerminal, Constants::CLEAR_TERMINAL, context);
ActionBuilder moveCursorWordRightAction(parent, Constants::MOVECURSORWORDRIGHT);
moveCursorWordRightAction.setText(Tr::tr("Move Cursor Word Right"));
moveCursorWordRightAction.setContext(context);
moveCursorWordRightAction.setDefaultKeySequence({QKeySequence("Alt+Right")});
ActionBuilder closeAction(parent, Core::Constants::CLOSE);
closeAction.setText(Tr::tr("Close Terminal"));
}
void TerminalWidget::unlockGlobalAction(const Utils::Id &commandId)

View File

@@ -44,7 +44,7 @@ public:
void restart(const Utils::Terminal::OpenTerminalParameters &openParameters);
static void initActions();
static void initActions(QObject *parent);
void unlockGlobalAction(const Utils::Id &commandId);
@@ -81,7 +81,6 @@ protected:
void setClipboard(const QString &text) override;
std::optional<TerminalView::Link> toLink(const QString &text) override;
RegisteredAction registerAction(Utils::Id commandId, const Core::Context &context);
void registerShortcut(Core::Command *command);
void updateCopyState();