mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 03:53:23 +02:00
misc: improve touch screen support
Support single tap for showing call overlay and long press to show context menu for the smartlist Change-Id: I31a77169827860c07ec9d60e076c0c5c4e875408
This commit is contained in:
parent
3b4e09d43a
commit
964af7fe3c
2 changed files with 38 additions and 26 deletions
|
@ -485,9 +485,9 @@ Rectangle {
|
|||
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
acceptedButtons: Qt.LeftButton
|
||||
|
||||
onEntered: {
|
||||
function resetStates() {
|
||||
if (overlayUpperPartRect.state !== 'entered') {
|
||||
overlayUpperPartRect.state = 'entered'
|
||||
}
|
||||
|
@ -497,14 +497,15 @@ Rectangle {
|
|||
callOverlayTimer.restart()
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
resetStates()
|
||||
}
|
||||
onEntered: {
|
||||
resetStates()
|
||||
}
|
||||
|
||||
onMouseXChanged: {
|
||||
if (overlayUpperPartRect.state !== 'entered') {
|
||||
overlayUpperPartRect.state = 'entered'
|
||||
}
|
||||
if (callOverlayButtonGroup.state !== 'entered') {
|
||||
callOverlayButtonGroup.state = 'entered'
|
||||
}
|
||||
callOverlayTimer.restart()
|
||||
resetStates()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ ItemDelegate {
|
|||
|
||||
signal updateContactAvatarUidRequested(string uid)
|
||||
|
||||
property bool openedMenu: false
|
||||
|
||||
function convUid() {
|
||||
return UID
|
||||
}
|
||||
|
@ -190,6 +192,26 @@ ItemDelegate {
|
|||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
|
||||
function openContextMenu(mouse) {
|
||||
openedMenu = true
|
||||
smartListContextMenu.parent = mouseAreaSmartListItemDelegate
|
||||
|
||||
// Make menu pos at mouse.
|
||||
var relativeMousePos = mapToItem(itemSmartListBackground,
|
||||
mouse.x, mouse.y)
|
||||
smartListContextMenu.x = relativeMousePos.x
|
||||
smartListContextMenu.y = relativeMousePos.y
|
||||
smartListContextMenu.responsibleAccountId = AccountAdapter.currentAccountId
|
||||
smartListContextMenu.responsibleConvUid = UID
|
||||
smartListContextMenu.contactType = ContactType
|
||||
userProfile.responsibleConvUid = UID
|
||||
userProfile.aliasText = DisplayName
|
||||
userProfile.registeredNameText = DisplayID
|
||||
userProfile.idText = URI
|
||||
userProfile.contactImageUid = UID
|
||||
smartListContextMenu.openMenu()
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
if (!InCall) {
|
||||
itemSmartListBackground.color = JamiTheme.pressColor
|
||||
|
@ -207,31 +229,20 @@ ItemDelegate {
|
|||
communicationPageMessageWebView.setSendContactRequestButtonVisible(false)
|
||||
}
|
||||
}
|
||||
onPressAndHold: {
|
||||
openContextMenu(mouse)
|
||||
}
|
||||
onReleased: {
|
||||
if (!InCall) {
|
||||
itemSmartListBackground.color = JamiTheme.selectionBlue
|
||||
}
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
smartListContextMenu.parent = mouseAreaSmartListItemDelegate
|
||||
|
||||
// Make menu pos at mouse.
|
||||
var relativeMousePos = mapToItem(itemSmartListBackground,
|
||||
mouse.x, mouse.y)
|
||||
smartListContextMenu.x = relativeMousePos.x
|
||||
smartListContextMenu.y = relativeMousePos.y
|
||||
smartListContextMenu.responsibleAccountId = AccountAdapter.currentAccountId
|
||||
smartListContextMenu.responsibleConvUid = UID
|
||||
smartListContextMenu.contactType = ContactType
|
||||
userProfile.responsibleConvUid = UID
|
||||
userProfile.aliasText = DisplayName
|
||||
userProfile.registeredNameText = DisplayID
|
||||
userProfile.idText = URI
|
||||
userProfile.contactImageUid = UID
|
||||
smartListContextMenu.openMenu()
|
||||
} else if (mouse.button === Qt.LeftButton) {
|
||||
openContextMenu(mouse)
|
||||
} else if (mouse.button === Qt.LeftButton && !openedMenu) {
|
||||
conversationSmartListView.currentIndex = -1
|
||||
conversationSmartListView.currentIndex = index
|
||||
}
|
||||
openedMenu = false
|
||||
}
|
||||
onEntered: {
|
||||
if (!InCall) {
|
||||
|
|
Loading…
Add table
Reference in a new issue