Changeset View
Changeset View
Standalone View
Standalone View
src/ViewManager.cpp
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | |||||
106 | void ViewManager::setupActions() | 106 | void ViewManager::setupActions() | ||
107 | { | 107 | { | ||
108 | Q_ASSERT(_actionCollection); | 108 | Q_ASSERT(_actionCollection); | ||
109 | if (_actionCollection == nullptr) { | 109 | if (_actionCollection == nullptr) { | ||
110 | return; | 110 | return; | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | KActionCollection *collection = _actionCollection; | 113 | KActionCollection *collection = _actionCollection; | ||
114 | | ||||
115 | // Let's reuse the pointer, no need not to. | 114 | // Let's reuse the pointer, no need not to. | ||
116 | auto *action = new QAction(this); | 115 | auto *action = new QAction(this); | ||
117 | action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right"))); | 116 | action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right"))); | ||
118 | action->setText(i18nc("@action:inmenu", "Split View Left/Right")); | 117 | action->setText(i18nc("@action:inmenu", "Split View Left/Right")); | ||
119 | connect(action, &QAction::triggered, this, &ViewManager::splitLeftRight); | 118 | connect(action, &QAction::triggered, this, &ViewManager::splitLeftRight); | ||
120 | collection->addAction(QStringLiteral("split-view-left-right"), action); | 119 | collection->addAction(QStringLiteral("split-view-left-right"), action); | ||
121 | collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::Key_ParenLeft); | 120 | collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::Key_ParenLeft); | ||
122 | 121 | | |||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
177 | action = new QAction(i18nc("@action Shortcut entry", "Previous Tab"), this); | 176 | action = new QAction(i18nc("@action Shortcut entry", "Previous Tab"), this); | ||
178 | const QList<QKeySequence> previousViewActionKeys{Qt::SHIFT + Qt::Key_Left, Qt::CTRL + Qt::Key_PageUp}; | 177 | const QList<QKeySequence> previousViewActionKeys{Qt::SHIFT + Qt::Key_Left, Qt::CTRL + Qt::Key_PageUp}; | ||
179 | collection->setDefaultShortcuts(action, previousViewActionKeys); | 178 | collection->setDefaultShortcuts(action, previousViewActionKeys); | ||
180 | collection->addAction(QStringLiteral("previous-tab"), action); | 179 | collection->addAction(QStringLiteral("previous-tab"), action); | ||
181 | connect(action, &QAction::triggered, this, &ViewManager::previousView); | 180 | connect(action, &QAction::triggered, this, &ViewManager::previousView); | ||
182 | _multiTabOnlyActions << action; | 181 | _multiTabOnlyActions << action; | ||
183 | // _viewSplitter->addAction(previousViewAction); | 182 | // _viewSplitter->addAction(previousViewAction); | ||
184 | 183 | | |||
185 | action = new QAction(i18nc("@action Shortcut entry", "Next View Container"), this); | 184 | action = new QAction(i18nc("@action Shortcut entry", "Focus Above Terminal"), this); | ||
186 | connect(action, &QAction::triggered, this, &ViewManager::focusUp); | 185 | connect(action, &QAction::triggered, this, &ViewManager::focusUp); | ||
187 | collection->addAction(QStringLiteral("next-container"), action); | 186 | collection->addAction(QStringLiteral("focus-view-above"), action); | ||
188 | collection->setDefaultShortcut(action, Qt::SHIFT + Qt::CTRL + Qt::Key_Up); | 187 | collection->setDefaultShortcut(action, Qt::SHIFT + Qt::CTRL + Qt::Key_Up); | ||
189 | _viewContainer->addAction(action); | 188 | _viewContainer->addAction(action); | ||
190 | _multiSplitterOnlyActions << action; | 189 | _multiSplitterOnlyActions << action; | ||
191 | 190 | | |||
192 | action = new QAction(QStringLiteral("Focus Down"), this); | 191 | action = new QAction(i18nc("@action Shortcut entry", "Focus Below Terminal"), this); | ||
193 | collection->setDefaultShortcut(action, Qt::SHIFT + Qt::CTRL + Qt::Key_Down); | 192 | collection->setDefaultShortcut(action, Qt::SHIFT + Qt::CTRL + Qt::Key_Down); | ||
193 | collection->addAction(QStringLiteral("focus-view-below"), action); | ||||
194 | connect(action, &QAction::triggered, this, &ViewManager::focusDown); | 194 | connect(action, &QAction::triggered, this, &ViewManager::focusDown); | ||
195 | _multiSplitterOnlyActions << action; | 195 | _multiSplitterOnlyActions << action; | ||
196 | _viewContainer->addAction(action); | 196 | _viewContainer->addAction(action); | ||
197 | 197 | | |||
198 | action = new QAction(i18nc("@action Shortcut entry", "Move Tab Left"), this); | 198 | action = new QAction(i18nc("@action Shortcut entry", "Focus Left Terminal"), this); | ||
199 | collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Konsole::LEFT); | 199 | collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Konsole::LEFT); | ||
200 | connect(action, &QAction::triggered, this, &ViewManager::focusLeft); | 200 | connect(action, &QAction::triggered, this, &ViewManager::focusLeft); | ||
201 | collection->addAction(QStringLiteral("move-view-left"), action); | 201 | collection->addAction(QStringLiteral("focus-view-left"), action); | ||
202 | _multiSplitterOnlyActions << action; | 202 | _multiSplitterOnlyActions << action; | ||
203 | 203 | | |||
204 | action = new QAction(i18nc("@action Shortcut entry", "Move Tab Right"), this); | 204 | action = new QAction(i18nc("@action Shortcut entry", "Focus Right Terminal"), this); | ||
mschiller: "Focus Right Terminal" would be more consistent | |||||
205 | collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Konsole::RIGHT); | 205 | collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Konsole::RIGHT); | ||
206 | connect(action, &QAction::triggered, this, &ViewManager::focusRight); | 206 | connect(action, &QAction::triggered, this, &ViewManager::focusRight); | ||
207 | collection->addAction(QStringLiteral("move-view-right"), action); | 207 | collection->addAction(QStringLiteral("focus-view-right"), action); | ||
208 | _multiSplitterOnlyActions << action; | 208 | _multiSplitterOnlyActions << action; | ||
209 | 209 | | |||
210 | action = new QAction(i18nc("@action Shortcut entry", "Switch to Last Tab"), this); | 210 | action = new QAction(i18nc("@action Shortcut entry", "Switch to Last Tab"), this); | ||
211 | connect(action, &QAction::triggered, this, &ViewManager::lastView); | 211 | connect(action, &QAction::triggered, this, &ViewManager::lastView); | ||
212 | collection->addAction(QStringLiteral("last-tab"), action); | 212 | collection->addAction(QStringLiteral("last-tab"), action); | ||
213 | _multiTabOnlyActions << action; | 213 | _multiTabOnlyActions << action; | ||
214 | 214 | | |||
215 | action = new QAction(i18nc("@action Shortcut entry", "Last Used Tabs"), this); | 215 | action = new QAction(i18nc("@action Shortcut entry", "Last Used Tabs"), this); | ||
Show All 22 Lines | |||||
238 | 238 | | |||
239 | action = new QAction(i18nc("@action Shortcut entry", "Restore other terminals"), this); | 239 | action = new QAction(i18nc("@action Shortcut entry", "Restore other terminals"), this); | ||
240 | collection->addAction(QStringLiteral("restore-other-terminals"), action); | 240 | collection->addAction(QStringLiteral("restore-other-terminals"), action); | ||
241 | collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_Minus); | 241 | collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_Minus); | ||
242 | connect(action, &QAction::triggered, _viewContainer, &TabbedViewContainer::restoreOtherTerminals); | 242 | connect(action, &QAction::triggered, _viewContainer, &TabbedViewContainer::restoreOtherTerminals); | ||
243 | _multiSplitterOnlyActions << action; | 243 | _multiSplitterOnlyActions << action; | ||
244 | _viewContainer->addAction(action); | 244 | _viewContainer->addAction(action); | ||
245 | 245 | | |||
246 | action = new QAction(i18nc("@action Shortcut entry", "Move tab to the right"), this); | ||||
247 | collection->addAction(QStringLiteral("move-tab-to-right"), action); | ||||
mschiller: restore-other-terminal should be something like "move-tab-right" | |||||
248 | collection->setDefaultShortcut(action, Qt::CTRL + Qt::ALT + Qt::Key_Right); | ||||
For many years, moving tabs in konsole was done with Ctrl+Shift+Left/Right. dfaure: For many years, moving tabs in konsole was done with Ctrl+Shift+Left/Right.
Any reason why this… | |||||
hindenburg: I didn't catch the change; Tomaz, was this a mistake? | |||||
249 | connect(action, &QAction::triggered, _viewContainer, &TabbedViewContainer::moveTabRight); | ||||
250 | _multiTabOnlyActions << action; | ||||
251 | _viewContainer->addAction(action); | ||||
252 | | ||||
253 | action = new QAction(i18nc("@action Shortcut entry", "Move tab to the left"), this); | ||||
254 | collection->addAction(QStringLiteral("move-tab-to-left"), action); | ||||
Same here. Also if multiple actions have the same name you can only configure the last one in the shortcut config dialog. mschiller: Same here. Also if multiple actions have the same name you can only configure the last one in… | |||||
255 | collection->setDefaultShortcut(action, Qt::CTRL + Qt::ALT + Qt::Key_Left); | ||||
256 | connect(action, &QAction::triggered, _viewContainer, &TabbedViewContainer::moveTabLeft); | ||||
257 | _multiTabOnlyActions << action; | ||||
258 | _viewContainer->addAction(action); | ||||
259 | | ||||
246 | // _viewSplitter->addAction(lastUsedViewReverseAction); | 260 | // _viewSplitter->addAction(lastUsedViewReverseAction); | ||
247 | const int SWITCH_TO_TAB_COUNT = 19; | 261 | const int SWITCH_TO_TAB_COUNT = 19; | ||
248 | for (int i = 0; i < SWITCH_TO_TAB_COUNT; i++) { | 262 | for (int i = 0; i < SWITCH_TO_TAB_COUNT; i++) { | ||
249 | action = new QAction(i18nc("@action Shortcut entry", "Switch to Tab %1", i + 1), this); | 263 | action = new QAction(i18nc("@action Shortcut entry", "Switch to Tab %1", i + 1), this); | ||
250 | connect(action, &QAction::triggered, this, [this, i]() { switchToView(i); }); | 264 | connect(action, &QAction::triggered, this, [this, i]() { switchToView(i); }); | ||
251 | collection->addAction(QStringLiteral("switch-to-tab-%1").arg(i), action); | 265 | collection->addAction(QStringLiteral("switch-to-tab-%1").arg(i), action); | ||
252 | } | 266 | } | ||
253 | 267 | | |||
▲ Show 20 Lines • Show All 861 Lines • Show Last 20 Lines |
"Focus Right Terminal" would be more consistent