debugConsole: add toggle() conveniance function
This commit is contained in:
parent
f838bdf96d
commit
4602366b9c
2
TODO.md
2
TODO.md
|
@ -1,7 +1,5 @@
|
|||
# TODO
|
||||
|
||||
- Fix escape to unselect events
|
||||
|
||||
## Refactoring
|
||||
|
||||
- Rewrite account settings using `HTabbedContainer`
|
||||
|
|
|
@ -73,6 +73,18 @@ HDrawer {
|
|||
readonly property alias commandsView: commandsView
|
||||
|
||||
|
||||
function toggle(targetItem=mainUI, js="", addToHistory=false) {
|
||||
if (debugConsole.visible) {
|
||||
debugConsole.visible = false
|
||||
return
|
||||
}
|
||||
|
||||
debugConsole.visible = true
|
||||
debugConsole.target = targetItem
|
||||
if (js) debugConsole.runJS(js, addToHistory)
|
||||
}
|
||||
|
||||
|
||||
function runJS(input, addToHistory=true) {
|
||||
if (addToHistory && history.slice(-1)[0] !== input) {
|
||||
history.push(input)
|
||||
|
@ -119,7 +131,7 @@ HDrawer {
|
|||
|
||||
HShortcut {
|
||||
sequences: settings.keys.toggleDebugConsole
|
||||
onActivated: debugConsole.visible = ! debugConsole.visible
|
||||
onActivated: debugConsole.toggle()
|
||||
}
|
||||
|
||||
HColumnLayout {
|
||||
|
|
|
@ -221,11 +221,8 @@ HColumnLayout {
|
|||
HMenuItem {
|
||||
icon.name: "debug"
|
||||
text: qsTr("Debug this event")
|
||||
onTriggered: {
|
||||
mainUI.debugConsole.visible = true
|
||||
mainUI.debugConsole.target = eventContent
|
||||
mainUI.debugConsole.runJS("t.parent.json()", false)
|
||||
}
|
||||
onTriggered:
|
||||
mainUI.debugConsole.toggle(eventContent, "t.parent.json()")
|
||||
}
|
||||
|
||||
HMenuItemPopupSpawner {
|
||||
|
|
Loading…
Reference in New Issue
Block a user