diff --git a/src/gui/Base/Buttons/FieldHelpButton.qml b/src/gui/Base/Buttons/FieldHelpButton.qml new file mode 100644 index 00000000..f77ca6bd --- /dev/null +++ b/src/gui/Base/Buttons/FieldHelpButton.qml @@ -0,0 +1,19 @@ +// Copyright Mirage authors & contributors +// 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 +} diff --git a/src/gui/Base/HLabeledItem.qml b/src/gui/Base/HLabeledItem.qml index 87ee9988..bddcee09 100644 --- a/src/gui/Base/HLabeledItem.qml +++ b/src/gui/Base/HLabeledItem.qml @@ -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 diff --git a/src/gui/Pages/AccountSettings/Account.qml b/src/gui/Pages/AccountSettings/Account.qml index 7fb7be23..f37b394f 100644 --- a/src/gui/Pages/AccountSettings/Account.qml +++ b/src/gui/Pages/AccountSettings/Account.qml @@ -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." + ) + } } } } diff --git a/src/icons/thin/field-help.svg b/src/icons/thin/field-help.svg new file mode 100644 index 00000000..88630def --- /dev/null +++ b/src/icons/thin/field-help.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/thin/field-tooltip-available.svg b/src/icons/thin/field-tooltip-available.svg deleted file mode 100644 index c8654c91..00000000 --- a/src/icons/thin/field-tooltip-available.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - -