Add explanation tooltip for composer alias
This commit is contained in:
@@ -1,21 +1,54 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
Column {
|
||||
HColumnLayout {
|
||||
spacing: theme.spacing / 2
|
||||
|
||||
property alias label: fieldLabel
|
||||
property alias field: textField
|
||||
|
||||
HLabel {
|
||||
id: fieldLabel
|
||||
property alias label: label
|
||||
property alias field: field
|
||||
property alias toolTip: toolTip
|
||||
|
||||
|
||||
HRowLayout {
|
||||
HLabel {
|
||||
id: label
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
HIcon {
|
||||
svgName: "field-tooltip-available"
|
||||
visible: toolTip.text
|
||||
|
||||
Binding on colorize {
|
||||
value: theme.colors.accentElement
|
||||
when: hoverHandler.hovered || toolTip.visible
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hoverHandler
|
||||
enabled: toolTip.text
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: toolTip.instantShow()
|
||||
enabled: toolTip.text
|
||||
}
|
||||
|
||||
HToolTip {
|
||||
id: toolTip
|
||||
visible: toolTip.text && hoverHandler.hovered
|
||||
}
|
||||
}
|
||||
|
||||
HTextField {
|
||||
id: textField
|
||||
id: field
|
||||
radius: 2
|
||||
width: parent.width
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
@@ -6,18 +6,9 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
ToolTip {
|
||||
id: toolTip
|
||||
delay: theme.controls.toolTip.delay
|
||||
delay: instant ? 0 : theme.controls.toolTip.delay
|
||||
padding: background.border.width
|
||||
|
||||
|
||||
property alias label: label
|
||||
property alias backgroundColor: background.color
|
||||
|
||||
readonly property bool hideNow: ! window.hovered
|
||||
|
||||
onHideNowChanged: if (visible && hideNow) toolTip.hide()
|
||||
|
||||
|
||||
background: Rectangle {
|
||||
id: background
|
||||
color: theme.controls.toolTip.background
|
||||
@@ -50,6 +41,25 @@ ToolTip {
|
||||
HNumberAnimation { property: "opacity"; to: 0.0 }
|
||||
}
|
||||
|
||||
onHideNowChanged: if (visible && hideNow) toolTip.hide()
|
||||
|
||||
|
||||
property bool instant: false
|
||||
|
||||
property alias label: label
|
||||
property alias backgroundColor: background.color
|
||||
|
||||
readonly property bool hideNow: ! window.hovered
|
||||
|
||||
|
||||
function instantShow() {
|
||||
if (visible) return
|
||||
instant = true
|
||||
open()
|
||||
instant = false
|
||||
}
|
||||
|
||||
|
||||
TapHandler {
|
||||
onTapped: toolTip.hide()
|
||||
}
|
||||
|
@@ -172,9 +172,16 @@ HGridLayout {
|
||||
property bool changed: field.text !== currentAlias
|
||||
|
||||
id: aliasField
|
||||
label.text: qsTr("Write alias:")
|
||||
label.text: qsTr("Multi-account composer alias:")
|
||||
field.onAccepted: applyChanges()
|
||||
|
||||
toolTip.text: qsTr(
|
||||
"From any account, start a message with specified alias " +
|
||||
"followed by a space to type and send as this account.\n" +
|
||||
"This account must a member of the room too.\n" +
|
||||
"To ignore the alias when typing, prepend it with a space."
|
||||
)
|
||||
|
||||
Component.onCompleted: field.text = currentAlias
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
Reference in New Issue
Block a user