From 6ffb522d86aa5fb779730aebc34511af1fb20f27 Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Sat, 6 Feb 2021 21:58:08 -0500 Subject: [PATCH] Add shortcuts --- assets/qml/Widgets/LogView.qml | 14 +++++++++- assets/qml/Windows/Console.qml | 16 ++++++++++++ assets/qml/main.qml | 48 ++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/assets/qml/Widgets/LogView.qml b/assets/qml/Widgets/LogView.qml index 7ee0222f..f6fd251c 100644 --- a/assets/qml/Widgets/LogView.qml +++ b/assets/qml/Widgets/LogView.qml @@ -94,7 +94,7 @@ Rectangle { } // - // Selects all the text + // Selects all the text // function selectAll() { var item = null @@ -105,6 +105,18 @@ Rectangle { } } + // + // De-selects all the text + // + function deselect() { + var item = null + for (var i = 0; i < listView.count; ++i) { + item = listView.itemAtIndex(i) + if (item !== null) + item.selected = false + } + } + // // Updates the caret line location so that its shown in the vertical location of // the given @a mouse area diff --git a/assets/qml/Windows/Console.qml b/assets/qml/Windows/Console.qml index c72beb4f..d3313ac5 100644 --- a/assets/qml/Windows/Console.qml +++ b/assets/qml/Windows/Console.qml @@ -81,6 +81,22 @@ Control { onActivated: Cpp_IO_Console.save() } + // + // Clear console data shortcut + // + Shortcut { + sequence: StandardKey.Delete + onActivated: Cpp_IO_Console.clear() + } + + // + // Deselect text with escape key + // + Shortcut { + sequences: ["escape", "space"] + onActivated: logView.deselect() + } + // // Right-click context menu // diff --git a/assets/qml/main.qml b/assets/qml/main.qml index 53a38583..04910d02 100644 --- a/assets/qml/main.qml +++ b/assets/qml/main.qml @@ -128,6 +128,54 @@ ApplicationWindow { Cpp_IO_Console.append(Cpp_Misc_Translator.welcomeConsoleText()) } + // + // Shortcut to show/hide setup panel + // + Shortcut { + sequence: "Ctrl+," + onActivated: toolbar.setupClicked() + } + + // + // Shortcut to show/hide dashboard + // + Shortcut { + sequence: "Ctrl+d" + onActivated: toolbar.dataClicked() + } + + // + // Shortcut to show/hide widgets + // + Shortcut { + sequence: "Ctrl+w" + onActivated: toolbar.widgetsClicked() + } + + // + // Shortcut to show/hide terminal + // + Shortcut { + sequence: "Ctrl+t" + onActivated: toolbar.consoleClicked() + } + + // + // Shortcut to show/hide terminal + // + Shortcut { + sequence: "F1" + onActivated: about.show() + } + + // + // Shortcut to open CSV file + // + Shortcut { + sequence: StandardKey.Open + onActivated: Cpp_CSV_Player.openFile() + } + // // Startup timer //