Skip to content

Commit c26cc8f

Browse files
committed
fix(LateNightQML): improve menu keyboard navigation
1 parent 0ccbedb commit c26cc8f

4 files changed

Lines changed: 335 additions & 21 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
pragma ComponentBehavior: Bound
2+
3+
import Mixxx 1.0 as Mixxx
4+
import QtQuick
5+
6+
Item {
7+
id: root
8+
9+
readonly property var shortcuts: [["FileMenu_LoadDeck1", "Ctrl+O"], ["FileMenu_LoadDeck2", "Ctrl+Shift+O"], ["FileMenu_Quit", "Ctrl+Q"], ["LibraryMenu_Rescan", "Ctrl+Shift+L"], ["LibraryMenu_SearchInCurrentView", "Ctrl+F"], ["LibraryMenu_SearchInAllTracks", "Ctrl+Shift+F"], ["LibraryMenu_NewPlaylist", "Ctrl+N"], ["LibraryMenu_NewCrate", "Ctrl+Shift+N"], ["ViewMenu_ShowMicrophone", "Ctrl+2"], ["ViewMenu_ShowVinylControl", "Ctrl+3"], ["ViewMenu_ShowPreviewDeck", "Ctrl+4"], ["ViewMenu_ShowCoverArt", "Ctrl+6"], ["ViewMenu_ShowKeywheel", "F12"], ["ViewMenu_MaximizeLibrary", "Space"], ["ViewMenu_ShowAutoDJ", "Ctrl+9"], ["ViewMenu_FullScreen", "F11"], ["OptionsMenu_EnableVinyl1", "Ctrl+T"], ["OptionsMenu_EnableVinyl2", "Ctrl+Y"], ["OptionsMenu_EnableVinyl3", "Ctrl+U"], ["OptionsMenu_EnableVinyl4", "Ctrl+I"], ["OptionsMenu_RecordMix", "Ctrl+R"], ["OptionsMenu_EnableLiveBroadcasting", "Ctrl+L"], ["OptionsMenu_EnableShortcuts", "Ctrl+`"], ["OptionsMenu_Preferences", "Ctrl+P"], ["OptionsMenu_ReloadSkin", "Ctrl+Shift+R"], ["OptionsMenu_DeveloperTools", "Ctrl+Shift+T"], ["OptionsMenu_DeveloperStatsExperiment", "Ctrl+Shift+E"], ["OptionsMenu_DeveloperStatsBase", "Ctrl+Shift+B"], ["DeveloperMenu_EnableDebugger", "Ctrl+Shift+D"]]
10+
11+
signal applicationMenuRequested
12+
signal shortcutTriggered(string command)
13+
14+
function shortcutEnabled(command) {
15+
switch (command) {
16+
case "OptionsMenu_ReloadSkin":
17+
case "OptionsMenu_DeveloperTools":
18+
case "OptionsMenu_DeveloperStatsExperiment":
19+
case "OptionsMenu_DeveloperStatsBase":
20+
case "DeveloperMenu_EnableDebugger":
21+
return Mixxx.Application.developerMode;
22+
default:
23+
return true;
24+
}
25+
}
26+
27+
height: 0
28+
width: 0
29+
30+
Connections {
31+
function onApplicationMenuRequested() {
32+
root.applicationMenuRequested();
33+
}
34+
35+
target: Mixxx.Application
36+
}
37+
Shortcut {
38+
context: Qt.ApplicationShortcut
39+
enabled: Qt.platform.os !== "osx"
40+
sequence: "F10"
41+
42+
onActivated: root.applicationMenuRequested()
43+
}
44+
Instantiator {
45+
model: root.shortcuts
46+
47+
delegate: Shortcut {
48+
required property var modelData
49+
50+
context: Qt.ApplicationShortcut
51+
enabled: Qt.platform.os !== "osx" && root.shortcutEnabled(modelData[0])
52+
sequence: Mixxx.Application.menuShortcut(modelData[0], modelData[1])
53+
54+
onActivated: {
55+
root.shortcutTriggered(modelData[0]);
56+
}
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)