2019-07-21 08:08:58 +10:00
|
|
|
import QtQuick 2.12
|
2019-08-23 03:03:26 +10:00
|
|
|
import "Base"
|
|
|
|
import "utils.js" as Utils
|
2019-07-21 08:08:58 +10:00
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcutHandler {
|
2019-09-20 06:47:35 +10:00
|
|
|
property Item flickTarget
|
|
|
|
property DebugConsole debugConsole
|
2019-07-21 08:08:58 +10:00
|
|
|
|
2019-08-23 04:16:49 +10:00
|
|
|
// App
|
2019-08-20 03:55:21 +10:00
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcut {
|
|
|
|
enabled: debugMode
|
2019-09-06 05:05:57 +10:00
|
|
|
sequences: settings.keys.startPythonDebugger
|
2019-08-23 03:03:26 +10:00
|
|
|
onPressed: py.call("APP.pdb")
|
2019-07-21 08:08:58 +10:00
|
|
|
}
|
|
|
|
|
2019-09-06 05:05:57 +10:00
|
|
|
HShortcut {
|
2019-09-20 06:47:35 +10:00
|
|
|
enabled: debugMode && debugConsole
|
2019-09-06 05:05:57 +10:00
|
|
|
sequences: settings.keys.toggleDebugConsole
|
2019-09-20 06:47:35 +10:00
|
|
|
onPressed: debugConsole.visible = ! debugConsole.visible
|
2019-09-06 05:05:57 +10:00
|
|
|
}
|
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcut {
|
|
|
|
sequences: settings.keys.reloadConfig
|
|
|
|
onPressed: py.loadSettings(() => { mainUI.pressAnimation.start() })
|
2019-07-21 08:08:58 +10:00
|
|
|
}
|
2019-07-24 16:14:34 +10:00
|
|
|
|
2019-11-09 07:01:09 +11:00
|
|
|
// Pages
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: settings.keys.goToLastPage
|
|
|
|
onPressed: mainUI.pageLoader.showPrevious()
|
|
|
|
}
|
|
|
|
|
2019-08-23 04:16:49 +10:00
|
|
|
// Page scrolling
|
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcut {
|
2019-09-20 06:47:35 +10:00
|
|
|
enabled: flickTarget
|
2019-08-23 03:03:26 +10:00
|
|
|
sequences: settings.keys.scrollUp
|
|
|
|
onPressed: Utils.smartVerticalFlick(flickTarget, -335)
|
2019-08-23 04:16:49 +10:00
|
|
|
onHeld: pressed(event)
|
2019-08-20 04:05:59 +10:00
|
|
|
}
|
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcut {
|
2019-09-20 06:47:35 +10:00
|
|
|
enabled: flickTarget
|
2019-08-23 03:03:26 +10:00
|
|
|
sequences: settings.keys.scrollDown
|
|
|
|
onPressed: Utils.smartVerticalFlick(flickTarget, 335)
|
2019-08-23 04:16:49 +10:00
|
|
|
onHeld: pressed(event)
|
2019-08-20 03:09:05 +10:00
|
|
|
}
|
|
|
|
|
2019-08-31 03:06:54 +10:00
|
|
|
HShortcut {
|
2019-09-20 06:47:35 +10:00
|
|
|
enabled: flickTarget
|
2019-08-31 03:06:54 +10:00
|
|
|
sequences: settings.keys.scrollPageUp
|
|
|
|
onPressed: Utils.smartVerticalFlick(
|
2019-09-07 07:03:52 +10:00
|
|
|
flickTarget, -2.3 * flickTarget.height, 8,
|
2019-08-31 03:06:54 +10:00
|
|
|
)
|
|
|
|
onHeld: pressed(event)
|
2019-09-07 07:03:52 +10:00
|
|
|
// Ensure only a slight slip after releasing the key
|
|
|
|
onReleased: Utils.smartVerticalFlick(flickTarget, -335)
|
2019-08-31 03:06:54 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
2019-09-20 06:47:35 +10:00
|
|
|
enabled: flickTarget
|
2019-08-31 03:06:54 +10:00
|
|
|
sequences: settings.keys.scrollPageDown
|
|
|
|
onPressed: Utils.smartVerticalFlick(
|
2019-09-07 07:03:52 +10:00
|
|
|
flickTarget, 2.3 * flickTarget.height, 8,
|
2019-08-31 03:06:54 +10:00
|
|
|
)
|
|
|
|
onHeld: pressed(event)
|
2019-09-07 07:03:52 +10:00
|
|
|
onReleased: Utils.smartVerticalFlick(flickTarget, 335)
|
2019-08-31 03:06:54 +10:00
|
|
|
}
|
|
|
|
|
2019-08-31 03:40:56 +10:00
|
|
|
HShortcut {
|
2019-09-20 06:47:35 +10:00
|
|
|
enabled: flickTarget
|
2019-08-31 03:40:56 +10:00
|
|
|
sequences: settings.keys.scrollToTop
|
|
|
|
onPressed: Utils.flickToTop(flickTarget)
|
|
|
|
onHeld: pressed(event)
|
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
2019-09-20 06:47:35 +10:00
|
|
|
enabled: flickTarget
|
2019-08-31 03:40:56 +10:00
|
|
|
sequences: settings.keys.scrollToBottom
|
|
|
|
onPressed: Utils.flickToBottom(flickTarget)
|
|
|
|
onHeld: pressed(event)
|
|
|
|
}
|
|
|
|
|
2019-08-31 03:06:54 +10:00
|
|
|
|
2019-08-23 04:16:49 +10:00
|
|
|
// SidePane
|
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcut {
|
2019-08-24 01:06:19 +10:00
|
|
|
enabled: mainUI.accountsPresent
|
2019-08-23 03:03:26 +10:00
|
|
|
sequences: settings.keys.focusSidePane
|
|
|
|
onPressed: mainUI.sidePane.setFocus()
|
2019-08-18 10:29:56 +10:00
|
|
|
}
|
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcut {
|
2019-08-24 01:06:19 +10:00
|
|
|
enabled: mainUI.accountsPresent
|
2019-08-23 03:03:26 +10:00
|
|
|
sequences: settings.keys.clearRoomFilter
|
2019-08-31 01:05:11 +10:00
|
|
|
onPressed: mainUI.sidePane.toolBar.roomFilter = ""
|
2019-08-20 04:28:12 +10:00
|
|
|
}
|
|
|
|
|
2019-08-24 01:02:22 +10:00
|
|
|
HShortcut {
|
2019-08-24 01:06:19 +10:00
|
|
|
enabled: mainUI.accountsPresent
|
2019-08-24 01:02:22 +10:00
|
|
|
sequences: settings.keys.addNewAccount
|
2019-08-31 01:05:11 +10:00
|
|
|
onPressed: mainUI.sidePane.toolBar.addAccountButton.clicked()
|
2019-08-24 01:02:22 +10:00
|
|
|
}
|
|
|
|
|
2019-11-10 23:32:17 +11:00
|
|
|
HShortcut {
|
|
|
|
enabled: mainUI.accountsPresent
|
|
|
|
sequences: settings.keys.addNewChat
|
|
|
|
onPressed: mainUI.sidePane.sidePaneList.addNewChat()
|
|
|
|
}
|
|
|
|
|
2019-11-10 23:54:45 +11:00
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
enabled: mainUI.accountsPresent
|
|
|
|
sequences: settings.keys.accountSettings
|
|
|
|
onPressed: mainUI.sidePane.sidePaneList.accountSettings()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
enabled: mainUI.accountsPresent
|
|
|
|
sequences: settings.keys.toggleCollapseAccount
|
|
|
|
onPressed: mainUI.sidePane.sidePaneList.toggleCollapseAccount()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcut {
|
2019-08-24 01:06:19 +10:00
|
|
|
enabled: mainUI.accountsPresent
|
2019-08-23 03:03:26 +10:00
|
|
|
sequences: settings.keys.goToPreviousRoom
|
2019-08-31 01:05:11 +10:00
|
|
|
onPressed: mainUI.sidePane.sidePaneList.previous()
|
2019-08-23 04:16:49 +10:00
|
|
|
onHeld: pressed(event)
|
2019-07-24 16:14:34 +10:00
|
|
|
}
|
|
|
|
|
2019-08-23 03:03:26 +10:00
|
|
|
HShortcut {
|
2019-08-24 01:06:19 +10:00
|
|
|
enabled: mainUI.accountsPresent
|
2019-08-23 03:03:26 +10:00
|
|
|
sequences: settings.keys.goToNextRoom
|
2019-08-31 01:05:11 +10:00
|
|
|
onPressed: mainUI.sidePane.sidePaneList.next()
|
2019-08-23 04:16:49 +10:00
|
|
|
onHeld: pressed(event)
|
2019-07-24 16:14:34 +10:00
|
|
|
}
|
|
|
|
|
2019-09-09 01:49:47 +10:00
|
|
|
|
|
|
|
// Chat
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
enabled: window.uiState.page == "Chat/Chat.qml"
|
|
|
|
sequences: settings.keys.clearRoomMessages
|
2019-09-09 20:23:46 +10:00
|
|
|
onPressed: Utils.makePopup(
|
2019-09-09 22:57:38 +10:00
|
|
|
"Popups/ClearMessagesPopup.qml",
|
2019-09-09 20:23:46 +10:00
|
|
|
mainUI,
|
|
|
|
{
|
|
|
|
userId: window.uiState.pageProperties.userId,
|
|
|
|
roomId: window.uiState.pageProperties.roomId,
|
|
|
|
}
|
2019-09-09 01:49:47 +10:00
|
|
|
)
|
|
|
|
}
|
2019-11-07 07:45:33 +11:00
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
enabled: window.uiState.page == "Chat/Chat.qml"
|
|
|
|
sequences: settings.keys.sendFile
|
|
|
|
onPressed: Utils.makeObject(
|
|
|
|
"Dialogs/SendFilePicker.qml",
|
|
|
|
mainUI,
|
|
|
|
{
|
2019-11-07 08:03:34 +11:00
|
|
|
userId: window.uiState.pageProperties.userId,
|
|
|
|
roomId: window.uiState.pageProperties.roomId,
|
2019-11-07 07:45:33 +11:00
|
|
|
destroyWhenDone: true,
|
|
|
|
},
|
|
|
|
picker => { picker.dialog.open() }
|
|
|
|
)
|
|
|
|
}
|
2019-11-07 08:03:34 +11:00
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
enabled: window.uiState.page == "Chat/Chat.qml"
|
|
|
|
sequences: settings.keys.sendFileFromPathInClipboard
|
|
|
|
onPressed: Utils.sendFile(
|
|
|
|
window.uiState.pageProperties.userId,
|
|
|
|
window.uiState.pageProperties.roomId,
|
|
|
|
Clipboard.text.trim(),
|
|
|
|
)
|
|
|
|
}
|
2019-07-21 08:08:58 +10:00
|
|
|
}
|