Commit a4a4f75f authored by Eric Armbruster's avatar Eric Armbruster 🍁 Committed by Christoph Cullmann
Browse files

Assign default shortcuts for some actions

parent c2526a27
Pipeline #252136 passed with stage
in 7 minutes and 14 seconds
......@@ -215,50 +215,60 @@ KatePluginGDBView::KatePluginGDBView(KTextEditor::Plugin *plugin, KTextEditor::M
QAction *a = actionCollection()->addAction(QStringLiteral("debug"));
a->setText(i18n("Start Debugging"));
a->setIcon(QIcon::fromTheme(QStringLiteral("debug-run")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::CTRL | Qt::Key_F7)));
connect(a, &QAction::triggered, this, &KatePluginGDBView::slotDebug);
a = actionCollection()->addAction(QStringLiteral("kill"));
a->setText(i18n("Kill / Stop Debugging"));
a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-stop")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::ALT | Qt::Key_F7)));
connect(a, &QAction::triggered, m_debugView, &DebugViewInterface::slotKill);
a = actionCollection()->addAction(QStringLiteral("rerun"));
a->setText(i18n("Restart Debugging"));
a->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::CTRL | Qt::SHIFT | Qt::Key_F7)));
connect(a, &QAction::triggered, this, &KatePluginGDBView::slotRestart);
a = actionCollection()->addAction(QStringLiteral("toggle_breakpoint"));
a->setText(i18n("Toggle Breakpoint / Break"));
a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::SHIFT | Qt::Key_F11)));
connect(a, &QAction::triggered, this, &KatePluginGDBView::slotToggleBreakpoint);
a = actionCollection()->addAction(QStringLiteral("step_in"));
a->setText(i18n("Step In"));
a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-into")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::Key_F10)));
connect(a, &QAction::triggered, m_debugView, &DebugViewInterface::slotStepInto);
a = actionCollection()->addAction(QStringLiteral("step_over"));
a->setText(i18n("Step Over"));
a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-over")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::Key_F9)));
connect(a, &QAction::triggered, m_debugView, &DebugViewInterface::slotStepOver);
a = actionCollection()->addAction(QStringLiteral("step_out"));
a->setText(i18n("Step Out"));
a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-out")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::SHIFT | Qt::Key_F10)));
connect(a, &QAction::triggered, m_debugView, &DebugViewInterface::slotStepOut);
a = actionCollection()->addAction(QStringLiteral("move_pc"));
a->setText(i18nc("Move Program Counter (next execution)", "Move PC"));
connect(a, &QAction::triggered, this, &KatePluginGDBView::slotMovePC);
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::ALT | Qt::Key_F9)));
a = actionCollection()->addAction(QStringLiteral("run_to_cursor"));
a->setText(i18n("Run To Cursor"));
a->setIcon(QIcon::fromTheme(QStringLiteral("debug-run-cursor")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::SHIFT | Qt::Key_F9)));
connect(a, &QAction::triggered, this, &KatePluginGDBView::slotRunToCursor);
a = actionCollection()->addAction(QStringLiteral("continue"));
a->setText(i18n("Continue"));
a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
actionCollection()->setDefaultShortcut(a, QKeySequence((Qt::CTRL | Qt::Key_F7)));
connect(a, &QAction::triggered, m_debugView, &DebugViewInterface::slotContinue);
a = actionCollection()->addAction(QStringLiteral("print_value"));
......
......@@ -608,6 +608,7 @@ public:
m_findTypeDef->setText(i18n("Go to Type Definition"));
m_findRef = actionCollection()->addAction(QStringLiteral("lspclient_find_references"), this, &self_type::findReferences);
m_findRef->setText(i18n("Find References"));
actionCollection()->setDefaultShortcut(m_findRef, QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_L));
m_findImpl = actionCollection()->addAction(QStringLiteral("lspclient_find_implementations"), this, &self_type::findImplementation);
m_findImpl->setText(i18n("Find Implementations"));
m_triggerHighlight = actionCollection()->addAction(QStringLiteral("lspclient_highlight"), this, &self_type::highlight);
......@@ -616,7 +617,7 @@ public:
m_triggerSymbolInfo->setText(i18n("Symbol Info"));
m_triggerGotoSymbol = actionCollection()->addAction(QStringLiteral("lspclient_goto_workspace_symbol"), this, &self_type::gotoWorkSpaceSymbol);
m_triggerGotoSymbol->setText(i18n("Search and Go to Symbol"));
actionCollection()->setDefaultShortcut(m_triggerGotoSymbol, Qt::ALT | Qt::CTRL | Qt::Key_P);
actionCollection()->setDefaultShortcut(m_triggerGotoSymbol, QKeySequence(Qt::ALT | Qt::CTRL | Qt::Key_P));
m_triggerFormat = actionCollection()->addAction(QStringLiteral("lspclient_format"), this, [this]() {
format();
});
......@@ -624,11 +625,14 @@ public:
actionCollection()->setDefaultShortcut(m_triggerFormat, QKeySequence(QStringLiteral("Ctrl+T, F"), QKeySequence::PortableText));
m_triggerRename = actionCollection()->addAction(QStringLiteral("lspclient_rename"), this, &self_type::rename);
m_triggerRename->setText(i18n("Rename"));
actionCollection()->setDefaultShortcut(m_triggerRename, QKeySequence(Qt::Key_F2));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5, 95, 0)
m_expandSelection = actionCollection()->addAction(QStringLiteral("lspclient_expand_selection"), this, &self_type::expandSelection);
m_expandSelection->setText(i18n("Expand Selection"));
actionCollection()->setDefaultShortcut(m_expandSelection, QKeySequence(Qt::CTRL | Qt::Key_2));
m_shrinkSelection = actionCollection()->addAction(QStringLiteral("lspclient_shrink_selection"), this, &self_type::shrinkSelection);
m_shrinkSelection->setText(i18n("Shrink Selection"));
actionCollection()->setDefaultShortcut(m_shrinkSelection, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_2));
#endif
m_switchSourceHeader = actionCollection()->addAction(QStringLiteral("lspclient_clangd_switchheader"), this, &self_type::clangdSwitchSourceHeader);
m_switchSourceHeader->setText(i18n("Switch Source Header"));
......@@ -637,8 +641,10 @@ public:
m_expandMacro->setText(i18n("Expand Macro"));
m_quickFix = actionCollection()->addAction(QStringLiteral("lspclient_quick_fix"), this, &self_type::quickFix);
m_quickFix->setText(i18n("Quick Fix"));
actionCollection()->setDefaultShortcut(m_quickFix, QKeySequence((Qt::CTRL | Qt::Key_Period)));
m_requestCodeAction = actionCollection()->add<KActionMenu>(QStringLiteral("lspclient_code_action"));
m_requestCodeAction->setText(i18n("Code Action"));
actionCollection()->setDefaultShortcut(m_requestCodeAction, QKeySequence((Qt::ALT | Qt::Key_Enter)));
connect(m_requestCodeAction->menu(), &QMenu::aboutToShow, this, &self_type::requestCodeAction);
// general options
......
......@@ -64,6 +64,7 @@
#include <QApplication>
#include <QDir>
#include <QFontDatabase>
#include <QKeySequence>
#include <QList>
#include <QMenu>
#include <QMenuBar>
......@@ -397,6 +398,7 @@ void KateMainWindow::setupActions()
a = actionCollection()->addAction(QStringLiteral("view_new_view"));
a->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
a->setText(i18n("&New Window"));
actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
connect(a, &QAction::triggered, this, &KateMainWindow::newWindow);
a->setWhatsThis(i18n("Create a new window."));
......@@ -490,6 +492,7 @@ void KateMainWindow::setupActions()
a = actionCollection()->addAction(QStringLiteral("view_history_back"));
a->setIcon(QIcon::fromTheme(QStringLiteral("arrow-left")));
a->setText(i18n("Go to Previous Location"));
actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL | Qt::Key_1));
connect(a, &QAction::triggered, this, [this] {
m_viewManager->activeViewSpace()->goBack();
});
......@@ -498,6 +501,7 @@ void KateMainWindow::setupActions()
a = actionCollection()->addAction(QStringLiteral("view_history_forward"));
a->setIcon(QIcon::fromTheme(QStringLiteral("arrow-right")));
a->setText(i18n("Go to Next Location"));
actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_1));
connect(a, &QAction::triggered, this, [this] {
m_viewManager->activeViewSpace()->goForward();
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment