MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / initActions

Method initActions

src/plugins/codeeditor/gui/workspacewidget.cpp:66–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void WorkspaceWidgetPrivate::initActions()
67{
68 auto &ctx = dpfInstance.serviceContext();
69 WindowService *windowService = ctx.service<WindowService>(WindowService::name());
70 if (!windowService)
71 return;
72
73 // add/del comment
74 QAction *commentAction = new QAction(tr("Add/Delete Comment"), q);
75 auto cmd = ActionManager::instance()->registerAction(commentAction, "TextEditor.AddAndRemoveComment", { kTextEditorContext });
76 cmd->setDefaultKeySequence(Qt::CTRL | Qt::Key_Slash);
77 connect(commentAction, &QAction::triggered, this, &WorkspaceWidgetPrivate::handleSetComment);
78
79 // show opened files
80 QAction *showOpenedAction = new QAction(tr("Show opened files"), q);
81 cmd = ActionManager::instance()->registerAction(showOpenedAction, "TextEditor.ShowOpenedFiles", { kTextEditorContext });
82 cmd->setDefaultKeySequence(Qt::CTRL | Qt::Key_Tab);
83 connect(showOpenedAction, &QAction::triggered, this, &WorkspaceWidgetPrivate::handleShowOpenedFiles);
84
85 QMetaEnum me = QMetaEnum::fromType<QsciCommand::Command>();
86 for (int i = 0; i < me.keyCount(); ++i) {
87 QList<QKeySequence> ksList;
88 QString actionText;
89 QsciCommand::Command val = static_cast<QsciCommand::Command>(me.value(i));
90 switch (val) {
91 case QsciCommand::LineDownExtend:
92 actionText = tr("Extend selection down one line");
93 ksList.append(Qt::Key_Down | Qt::SHIFT);
94 break;
95 case QsciCommand::LineDownRectExtend:
96 actionText = tr("Extend rectangular selection down one line");
97 ksList.append(Qt::Key_Down | Qt::ALT | Qt::SHIFT);
98 break;
99 case QsciCommand::LineScrollDown:
100 actionText = tr("Scroll view down one line");
101 ksList.append(Qt::Key_Down | Qt::CTRL);
102 break;
103 case QsciCommand::LineUpExtend:
104 actionText = tr("Extend selection up one line");
105 ksList.append(Qt::Key_Up | Qt::SHIFT);
106 break;
107 case QsciCommand::LineUpRectExtend:
108 actionText = tr("Extend rectangular selection up one line");
109 ksList.append(Qt::Key_Up | Qt::ALT | Qt::SHIFT);
110 break;
111 case QsciCommand::LineScrollUp:
112 actionText = tr("Scroll view up one line");
113 ksList.append(Qt::Key_Up | Qt::CTRL);
114 break;
115 case QsciCommand::ScrollToStart:
116 actionText = tr("Scroll to start of document");
117 break;
118 case QsciCommand::ScrollToEnd:
119 actionText = tr("Scroll to end of document");
120 break;
121 case QsciCommand::VerticalCentreCaret:
122 actionText = tr("Scroll vertically to centre current line");
123 break;

Callers 1

WorkspaceWidgetMethod · 0.45

Calls 11

connectFunction · 0.85
registerActionMethod · 0.80
setDefaultKeySequenceMethod · 0.80
nameFunction · 0.50
QStringClass · 0.50
valueMethod · 0.45
appendMethod · 0.45
isEmptyMethod · 0.45
currentEditorMethod · 0.45
SendScintillaMethod · 0.45

Tested by

no test coverage detected