Changeset View
Standalone View
sublime/mainwindow_p.cpp
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 81 | { | |||
---|---|---|---|---|---|
109 | connect(action, &QAction::toggled, this, &MainWindowPrivate::showBottomDock); | 109 | connect(action, &QAction::toggled, this, &MainWindowPrivate::showBottomDock); | ||
110 | ac->addAction(QStringLiteral("show_bottom_dock"), action); | 110 | ac->addAction(QStringLiteral("show_bottom_dock"), action); | ||
111 | 111 | | |||
112 | action = new QAction(i18nc("@action", "Focus Editor"), this); | 112 | action = new QAction(i18nc("@action", "Focus Editor"), this); | ||
113 | ac->setDefaultShortcut(action, Qt::META | Qt::CTRL | Qt::Key_E); | 113 | ac->setDefaultShortcut(action, Qt::META | Qt::CTRL | Qt::Key_E); | ||
114 | connect(action, &QAction::triggered, this, &MainWindowPrivate::focusEditor); | 114 | connect(action, &QAction::triggered, this, &MainWindowPrivate::focusEditor); | ||
115 | ac->addAction(QStringLiteral("focus_editor"), action); | 115 | ac->addAction(QStringLiteral("focus_editor"), action); | ||
116 | 116 | | |||
117 | KConfigGroup config = KSharedConfig::openConfig()->group("UiSettings"); | ||||
apol: What's the difference between this action and "Hide/Restore Docks"? They feel really similar… | |||||
We have 2 old actions:
I don't change them and anything other to keep "old-style" behavior. The patch adds new action which merges presented 2 "old" parts into simple "chain" for usability improvement. I don't understand what you mean about "too similar" - we have difference in logic for both cases. Maybe you mean that new action is combination of old, but it's wide practice: for example, we have "Copy" (CTRL+C) and "Cut" (CTRL+X) actions in any editor. And it't trivial that "Cut" can be replaced by "Copy"+"Del", but we have separable action for such common operation for usability. antonanikin: We have 2 old actions:
1) Focus Editor
2) Hide/Restore Docks.
I don't change them and anything… | |||||
118 | if (config.readEntry(QStringLiteral("FocusEditorOrHideDocks"), false)) { | ||||
119 | action = new QAction(i18nc("@action", "Focus Editor or Hide Unlocked Docks"), this); | ||||
120 | ac->setDefaultShortcut(action, Qt::Key_Escape); | ||||
121 | connect(action, &QAction::triggered, this, &MainWindowPrivate::focusEditorOrHideUnlockedDocks); | ||||
122 | ac->addAction(QStringLiteral("focus_editor_or_hide_unlocked_docks"), action); | ||||
123 | } | ||||
124 | | ||||
117 | action = new QAction(i18n("Hide/Restore Docks"), this); | 125 | action = new QAction(i18n("Hide/Restore Docks"), this); | ||
118 | ac->setDefaultShortcut(action, Qt::META | Qt::CTRL | Qt::Key_Up); | 126 | ac->setDefaultShortcut(action, Qt::META | Qt::CTRL | Qt::Key_Up); | ||
119 | connect(action, &QAction::triggered, this, &MainWindowPrivate::toggleDocksShown); | 127 | connect(action, &QAction::triggered, this, &MainWindowPrivate::toggleDocksShown); | ||
120 | ac->addAction(QStringLiteral("hide_all_docks"), action); | 128 | ac->addAction(QStringLiteral("hide_all_docks"), action); | ||
121 | 129 | | |||
122 | action = new QAction(i18n("Next Tool View"), this); | 130 | action = new QAction(i18n("Next Tool View"), this); | ||
123 | ac->setDefaultShortcut(action, Qt::META | Qt::CTRL | Qt::Key_N); | 131 | ac->setDefaultShortcut(action, Qt::META | Qt::CTRL | Qt::Key_N); | ||
124 | action->setIcon(QIcon::fromTheme(QStringLiteral("go-next"))); | 132 | action->setIcon(QIcon::fromTheme(QStringLiteral("go-next"))); | ||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Line(s) | 279 | if(!bgCentralWidget) | |||
272 | return; | 280 | return; | ||
273 | 281 | | |||
274 | bgCentralWidget->setVisible(v); | 282 | bgCentralWidget->setVisible(v); | ||
275 | splitterCentralWidget->setVisible(!v); | 283 | splitterCentralWidget->setVisible(!v); | ||
276 | } | 284 | } | ||
277 | 285 | | |||
278 | void MainWindowPrivate::focusEditor() | 286 | void MainWindowPrivate::focusEditor() | ||
279 | { | 287 | { | ||
280 | if (View* view = m_mainWindow->activeView()) | 288 | if (View* view = m_mainWindow->activeView()) | ||
I think we didn't understand each other. It's MainWindowPrivate::toggleDocksShown that should be adapted to understand dock locking. apol: I think we didn't understand each other.
It's `MainWindowPrivate::toggleDocksShown` that… | |||||
Done. Thanks for your idea about "right place" for the new code. antonanikin: Done. Thanks for your idea about "right place" for the new code. | |||||
No, I'm not sure what's going on, but still we are talking different things.
apol: No, I'm not sure what's going on, but still we are talking different things.
* `::focusEditor`… | |||||
281 | if (view->hasWidget()) | 289 | if (view->hasWidget()) | ||
282 | view->widget()->setFocus(Qt::ShortcutFocusReason); | 290 | view->widget()->setFocus(Qt::ShortcutFocusReason); | ||
283 | } | 291 | } | ||
284 | 292 | | |||
293 | void MainWindowPrivate::focusEditorOrHideUnlockedDocks() | ||||
294 | { | ||||
295 | View* view = m_mainWindow->activeView(); | ||||
296 | | ||||
297 | if (!view || (view && !view->hasWidget())) { | ||||
298 | hideUnlockedDocks(); | ||||
299 | return; | ||||
300 | } | ||||
301 | | ||||
302 | if (view->widget()->hasFocus()) | ||||
303 | hideUnlockedDocks(); | ||||
304 | else | ||||
305 | focusEditor(); | ||||
306 | } | ||||
307 | | ||||
308 | void MainWindowPrivate::hideUnlockedDocks() | ||||
309 | { | ||||
310 | // Due IdealController::showBottomDock() logic, | ||||
311 | // first call focuses Dock, second - hide it | ||||
312 | // TODO: add 'force' param to showXXXDock() ? | ||||
313 | | ||||
314 | if (!idealController->leftBarWidget->isLocked()) { | ||||
315 | idealController->showLeftDock(false); | ||||
316 | idealController->showLeftDock(false); | ||||
317 | } | ||||
318 | | ||||
319 | if (!idealController->bottomBarWidget->isLocked()) { | ||||
320 | idealController->showBottomDock(false); | ||||
321 | idealController->showBottomDock(false); | ||||
322 | } | ||||
323 | | ||||
324 | if (!idealController->rightBarWidget->isLocked()) { | ||||
325 | idealController->showRightDock(false); | ||||
326 | idealController->showRightDock(false); | ||||
327 | } | ||||
328 | } | ||||
329 | | ||||
285 | void MainWindowPrivate::toggleDocksShown() | 330 | void MainWindowPrivate::toggleDocksShown() | ||
286 | { | 331 | { | ||
287 | idealController->toggleDocksShown(); | 332 | idealController->toggleDocksShown(); | ||
288 | } | 333 | } | ||
289 | 334 | | |||
290 | void MainWindowPrivate::selectNextDock() | 335 | void MainWindowPrivate::selectNextDock() | ||
291 | { | 336 | { | ||
292 | idealController->goPrevNextDock(IdealController::NextDock); | 337 | idealController->goPrevNextDock(IdealController::NextDock); | ||
▲ Show 20 Lines • Show All 508 Lines • Show Last 20 Lines |
What's the difference between this action and "Hide/Restore Docks"? They feel really similar, too similar.