Move composer alias "?" icon to be inside field

Be more consistent with the user ID field and its copy button.
This commit is contained in:
miruka
2020-11-05 22:00:08 -04:00
parent 28b25a53ea
commit 0eb57c5986
5 changed files with 48 additions and 52 deletions

View File

@@ -0,0 +1,19 @@
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import ".."
HButton {
property string helpText
icon.name: "field-help"
iconItem.small: true
toolTip.text: helpText
onClicked: toolTip.instantShow()
onActiveFocusChanged: if (! activeFocus && toolTip.visible) toolTip.hide()
Layout.fillHeight: true
}

View File

@@ -13,7 +13,6 @@ HColumnLayout {
readonly property Item item: itemHolder.children[0]
readonly property alias label: label
readonly property alias errorLabel: errorLabel
readonly property alias toolTip: toolTip
spacing: theme.spacing / 2
@@ -29,32 +28,6 @@ HColumnLayout {
Layout.fillWidth: true
}
HIcon {
svgName: "field-tooltip-available"
opacity: elementsOpacity
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
}
HLoader {
source: "HBusyIndicator.qml"
active: loading

View File

@@ -33,8 +33,8 @@ HFlickableColumnPage {
)
}
if (aliasField.item.changed) {
window.settings.writeAliases[userId] = aliasField.item.text
if (aliasFieldItem.changed) {
window.settings.writeAliases[userId] = aliasFieldItem.text
window.settingsChanged()
}
@@ -57,7 +57,7 @@ HFlickableColumnPage {
function cancel() {
nameField.item.reset()
aliasField.item.reset()
aliasFieldItem.reset()
fileDialog.selectedFile = ""
fileDialog.file = ""
}
@@ -75,7 +75,7 @@ HFlickableColumnPage {
enabled:
avatar.changed ||
nameField.item.changed ||
(aliasField.item.changed && ! aliasField.item.error)
(aliasFieldItem.changed && ! aliasFieldItem.error)
onClicked: applyChanges()
}
@@ -270,25 +270,33 @@ HFlickableColumnPage {
alreadyTakenBy ? qsTr("Taken by %1").arg(alreadyTakenBy) :
""
toolTip.text: qsTr(
"From any chat, start a message with specified alias " +
"followed by a space to type and send as this " +
"account.\n" +
"The account must have permission to talk in the room.\n"+
"To ignore the alias when typing, prepend it with a space."
)
Layout.fillWidth: true
HTextField {
HRowLayout {
width: parent.width
error: aliasField.hasWhiteSpace || aliasField.alreadyTakenBy
defaultText: aliasField.currentAlias
placeholderText: qsTr("e.g. %1").arg((
nameField.item.text ||
(ready && account.display_name) ||
userId.substring(1)
)[0])
HTextField {
id: aliasFieldItem
error: aliasField.hasWhiteSpace || aliasField.alreadyTakenBy
defaultText: aliasField.currentAlias
placeholderText: qsTr("e.g. %1").arg((
nameField.item.text ||
(ready && account.display_name) ||
userId.substring(1)
)[0])
Layout.fillWidth: true
Layout.fillHeight: true
}
FieldHelpButton {
helpText: qsTr(
"From any chat, start a message with specified alias " +
"followed by a space to type and send as this account.\n" +
"The account must have permission to talk in the room.\n"+
"To ignore the alias when typing, prepend it with a space."
)
}
}
}
}