From 2e89dcae9e7d280afe2c588beb1c41bc59020584 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 17 Aug 2019 15:58:32 -0400 Subject: [PATCH] Add shortcut to focus filter rooms field --- TODO.md | 2 ++ src/python/config_files.py | 3 ++- src/qml/Shortcuts.qml | 5 +++++ src/qml/SidePane/PaneToolBar.qml | 1 + src/qml/SidePane/SidePane.qml | 2 ++ src/qml/UI.qml | 2 ++ 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 8e24d355..d3204b89 100644 --- a/TODO.md +++ b/TODO.md @@ -33,6 +33,8 @@ - Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb` - UI + - Highlight selected account/room + - Popup: - label size - Accept/cancel buttons diff --git a/src/python/config_files.py b/src/python/config_files.py index cea336de..a0b6b6ba 100644 --- a/src/python/config_files.py +++ b/src/python/config_files.py @@ -115,9 +115,10 @@ class UISettings(JSONConfigFile): "theme": "Default.qpl", "writeAliases": {}, "keys": { - "reloadConfig": ["Alt+R"], + "reloadConfig": ["Alt+Shift+R"], "scrollUp": ["Alt+Up", "Alt+K"], "scrollDown": ["Alt+Down", "Alt+J"], + "filterRooms": ["Alt+R", "Ctrl+R"], "startDebugger": ["Alt+Shift+D"], }, } diff --git a/src/qml/Shortcuts.qml b/src/qml/Shortcuts.qml index 6a44eaa4..73f5d2f6 100644 --- a/src/qml/Shortcuts.qml +++ b/src/qml/Shortcuts.qml @@ -29,6 +29,11 @@ Item { onActivated: smartVerticalFlick(335) } + Shortcut { + sequences: settings.keys ? settings.keys.filterRooms : [] + onActivated: mainUI.sidePane.paneToolBar.filterField.forceActiveFocus() + } + Shortcut { sequences: settings.keys ? settings.keys.startDebugger : [] onActivated: if (debugMode) { py.call("APP.pdb") } diff --git a/src/qml/SidePane/PaneToolBar.qml b/src/qml/SidePane/PaneToolBar.qml index 69e1e3cd..1b55544d 100644 --- a/src/qml/SidePane/PaneToolBar.qml +++ b/src/qml/SidePane/PaneToolBar.qml @@ -5,6 +5,7 @@ import "../Base" HRowLayout { id: toolBar + property alias filterField: filterField property alias roomFilter: filterField.text Layout.fillWidth: true diff --git a/src/qml/SidePane/SidePane.qml b/src/qml/SidePane/SidePane.qml index dc3ecd7d..9919f5dc 100644 --- a/src/qml/SidePane/SidePane.qml +++ b/src/qml/SidePane/SidePane.qml @@ -10,6 +10,8 @@ HRectangle { color: theme.sidePane.background + property alias paneToolBar: paneToolBar + property real autoWidthRatio: theme.sidePane.autoWidthRatio property bool manuallyResizing: false property bool manuallyResized: false diff --git a/src/qml/UI.qml b/src/qml/UI.qml index 9a6dae5a..09e76264 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -10,6 +10,8 @@ HRectangle { color: theme.ui.background Component.onCompleted: window.mainUI = mainUI + property alias sidePane: sidePane + property alias pageStack: pageStack property alias pressAnimation: _pressAnimation SequentialAnimation {