Have labels for text fields
This commit is contained in:
parent
8452bdd5e7
commit
d96304dc33
|
@ -37,7 +37,7 @@ HFileDialogOpener {
|
|||
|
||||
PasswordPopup {
|
||||
id: exportPasswordPopup
|
||||
details.text: qsTr("Please enter a passphrase to protect this file:")
|
||||
details.text: qsTr("Passphrase to protect this file:")
|
||||
okText: qsTr("Export")
|
||||
|
||||
onAcceptedPasswordChanged: exportKeys(file, acceptedPassword)
|
||||
|
|
|
@ -19,9 +19,7 @@ HFileDialogOpener {
|
|||
|
||||
PasswordPopup {
|
||||
id: importPasswordPopup
|
||||
details.text: qsTr(
|
||||
"Please enter the passphrase that was used to protect this file:"
|
||||
)
|
||||
details.text: qsTr("Passphrase used to protect this file:")
|
||||
okText: qsTr("Import")
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ HBox {
|
|||
id: signInBox
|
||||
clickButtonOnEnter: "apply"
|
||||
|
||||
onFocusChanged: idField.forceActiveFocus()
|
||||
onFocusChanged: idField.field.forceActiveFocus()
|
||||
|
||||
buttonModel: [
|
||||
{
|
||||
|
@ -31,8 +31,8 @@ HBox {
|
|||
errorMessage.text = ""
|
||||
|
||||
const args = [
|
||||
idField.text.trim(), passwordField.text,
|
||||
undefined, serverField.text.trim(),
|
||||
idField.field.text.trim(), passwordField.field.text,
|
||||
undefined, serverField.field.text.trim(),
|
||||
]
|
||||
|
||||
loginFuture = py.callCoro("login_client", args, userId => {
|
||||
|
@ -82,8 +82,8 @@ HBox {
|
|||
property string signInWith: "username"
|
||||
|
||||
readonly property bool canSignIn:
|
||||
serverField.text.trim() && idField.text.trim() && passwordField.text &&
|
||||
! serverField.error
|
||||
serverField.field.text.trim() && idField.field.text.trim() &&
|
||||
passwordField.field.text && ! serverField.field.error
|
||||
|
||||
|
||||
Timer {
|
||||
|
@ -124,35 +124,35 @@ HBox {
|
|||
}
|
||||
}
|
||||
|
||||
HTextField {
|
||||
HLabeledTextField {
|
||||
id: idField
|
||||
placeholderText: qsTr(
|
||||
signInWith === "email" ? "Email" :
|
||||
signInWith === "phone" ? "Phone" :
|
||||
"Username"
|
||||
label.text: qsTr(
|
||||
signInWith === "email" ? "Email:" :
|
||||
signInWith === "phone" ? "Phone:" :
|
||||
"Username:"
|
||||
)
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
HTextField {
|
||||
HLabeledTextField {
|
||||
id: passwordField
|
||||
placeholderText: qsTr("Password")
|
||||
echoMode: HTextField.Password
|
||||
label.text: qsTr("Password:")
|
||||
field.echoMode: HTextField.Password
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
HTextField {
|
||||
HLabeledTextField {
|
||||
id: serverField
|
||||
placeholderText: qsTr("Homeserver URL")
|
||||
text: "https://matrix.org"
|
||||
error: ! /.+:\/\/.+/.test(cleanText)
|
||||
label.text: qsTr("Homeserver:")
|
||||
field.text: "https://matrix.org"
|
||||
field.error: ! /.+:\/\/.+/.test(cleanText)
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
||||
readonly property string cleanText: text.toLowerCase().trim()
|
||||
readonly property string cleanText: field.text.toLowerCase().trim()
|
||||
|
||||
// 2019-11-11 https://www.hello-matrix.net/public_servers.php
|
||||
readonly property var knownServers: [
|
||||
|
@ -186,6 +186,8 @@ HBox {
|
|||
)
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: theme.spacing / 2
|
||||
Layout.bottomMargin: Layout.topMargin
|
||||
}
|
||||
|
||||
HLabel {
|
||||
|
|
|
@ -8,7 +8,7 @@ HBox {
|
|||
id: addChatBox
|
||||
clickButtonOnEnter: "apply"
|
||||
|
||||
onFocusChanged: nameField.forceActiveFocus()
|
||||
onFocusChanged: nameField.field.forceActiveFocus()
|
||||
|
||||
buttonModel: [
|
||||
{ name: "apply", text: qsTr("Create"), iconName: "room-create" },
|
||||
|
@ -21,8 +21,8 @@ HBox {
|
|||
errorMessage.text = ""
|
||||
|
||||
const args = [
|
||||
nameField.text,
|
||||
topicField.text,
|
||||
nameField.field.text,
|
||||
topicField.field.text,
|
||||
publicCheckBox.checked,
|
||||
encryptCheckBox.checked,
|
||||
! blockOtherServersCheckBox.checked,
|
||||
|
@ -40,8 +40,8 @@ HBox {
|
|||
},
|
||||
|
||||
cancel: button => {
|
||||
nameField.text = ""
|
||||
topicField.text = ""
|
||||
nameField.field.text = ""
|
||||
topicField.field.text = ""
|
||||
publicCheckBox.checked = false
|
||||
encryptCheckBox.checked = false
|
||||
blockOtherServersCheckBox.checked = false
|
||||
|
@ -57,7 +57,7 @@ HBox {
|
|||
HRoomAvatar {
|
||||
id: avatar
|
||||
roomId: ""
|
||||
displayName: nameField.text
|
||||
displayName: nameField.field.text
|
||||
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
Layout.preferredWidth: 128
|
||||
|
@ -66,24 +66,25 @@ HBox {
|
|||
CurrentUserAvatar {
|
||||
anchors.fill: parent
|
||||
z: 10
|
||||
opacity: nameField.text ? 0 : 1
|
||||
opacity: nameField.field.text ? 0 : 1
|
||||
visible: opacity > 0
|
||||
|
||||
Behavior on opacity { HNumberAnimation {} }
|
||||
}
|
||||
}
|
||||
|
||||
HTextField {
|
||||
HLabeledTextField {
|
||||
id: nameField
|
||||
placeholderText: qsTr("Name")
|
||||
maximumLength: 255
|
||||
label.text: qsTr("Name:")
|
||||
field.maximumLength: 255
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
HTextField {
|
||||
HLabeledTextField {
|
||||
id: topicField
|
||||
placeholderText: qsTr("Topic (optional)")
|
||||
label.text: qsTr("Topic:")
|
||||
field.placeholderText: qsTr("This room is about...")
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ HBox {
|
|||
id: addChatBox
|
||||
clickButtonOnEnter: "apply"
|
||||
|
||||
onFocusChanged: userField.forceActiveFocus()
|
||||
onFocusChanged: userField.field.forceActiveFocus()
|
||||
|
||||
buttonModel: [
|
||||
{
|
||||
name: "apply",
|
||||
text: qsTr("Start chat"),
|
||||
iconName: "start-direct-chat",
|
||||
enabled: Boolean(userField.text.trim())
|
||||
enabled: Boolean(userField.field.text.trim())
|
||||
},
|
||||
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
||||
]
|
||||
|
@ -25,7 +25,7 @@ HBox {
|
|||
button.loading = true
|
||||
errorMessage.text = ""
|
||||
|
||||
const args = [userField.text.trim(), encryptCheckBox.checked]
|
||||
const args = [userField.field.text.trim(), encryptCheckBox.checked]
|
||||
|
||||
py.callClientCoro(userId, "new_direct_chat", args, roomId => {
|
||||
button.loading = false
|
||||
|
@ -52,8 +52,8 @@ HBox {
|
|||
},
|
||||
|
||||
cancel: button => {
|
||||
userField.text = ""
|
||||
errorMessage.text = ""
|
||||
userField.field.text = ""
|
||||
errorMessage.text = ""
|
||||
pageLoader.showPrevious()
|
||||
}
|
||||
})
|
||||
|
@ -68,10 +68,11 @@ HBox {
|
|||
Layout.preferredHeight: Layout.preferredWidth
|
||||
}
|
||||
|
||||
HTextField {
|
||||
HLabeledTextField {
|
||||
id: userField
|
||||
placeholderText: qsTr("Peer user ID (e.g. @bob:matrix.org)")
|
||||
error: Boolean(errorMessage.text)
|
||||
label.text: qsTr("Peer user ID:")
|
||||
field.placeholderText: qsTr("@example:matrix.org")
|
||||
field.error: Boolean(errorMessage.text)
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ HBox {
|
|||
id: addChatBox
|
||||
clickButtonOnEnter: "apply"
|
||||
|
||||
onFocusChanged: roomField.forceActiveFocus()
|
||||
onFocusChanged: roomField.field.forceActiveFocus()
|
||||
|
||||
buttonModel: [
|
||||
{
|
||||
name: "apply",
|
||||
text: qsTr("Join"),
|
||||
iconName: "room-join",
|
||||
enabled: Boolean(roomField.text.trim()),
|
||||
enabled: Boolean(roomField.field.text.trim()),
|
||||
},
|
||||
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
||||
]
|
||||
|
@ -25,7 +25,7 @@ HBox {
|
|||
button.loading = true
|
||||
errorMessage.text = ""
|
||||
|
||||
const args = [roomField.text.trim()]
|
||||
const args = [roomField.field.text.trim()]
|
||||
|
||||
py.callClientCoro(userId, "room_join", args, roomId => {
|
||||
button.loading = false
|
||||
|
@ -51,8 +51,8 @@ HBox {
|
|||
},
|
||||
|
||||
cancel: button => {
|
||||
roomField.text = ""
|
||||
errorMessage.text = ""
|
||||
roomField.field.text = ""
|
||||
errorMessage.text = ""
|
||||
pageLoader.showPrevious()
|
||||
}
|
||||
})
|
||||
|
@ -67,10 +67,11 @@ HBox {
|
|||
Layout.preferredHeight: Layout.preferredWidth
|
||||
}
|
||||
|
||||
HTextField {
|
||||
HLabeledTextField {
|
||||
id: roomField
|
||||
placeholderText: qsTr("Alias (e.g. #example:matrix.org), URL or ID")
|
||||
error: Boolean(errorMessage.text)
|
||||
label.text: qsTr("Alias, URL or room ID:")
|
||||
field.placeholderText: qsTr("#example:matrix.org")
|
||||
field.error: Boolean(errorMessage.text)
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import QtQuick.Layouts 1.12
|
|||
import "../../../Base"
|
||||
|
||||
HBox {
|
||||
color: theme.chat.roomPane.roomSettings.background
|
||||
color: theme.chat.roomPane.roomSettings.background
|
||||
|
||||
buttonModel: [
|
||||
{
|
||||
|
@ -37,8 +37,8 @@ HBox {
|
|||
saveFuture = null
|
||||
}
|
||||
|
||||
nameField.reset()
|
||||
topicField.reset()
|
||||
nameField.field.reset()
|
||||
topicField.field.reset()
|
||||
encryptCheckBox.reset()
|
||||
requireInviteCheckbox.reset()
|
||||
forbidGuestsCheckBox.reset()
|
||||
|
@ -49,8 +49,9 @@ HBox {
|
|||
property var saveFuture: null
|
||||
|
||||
readonly property bool anyChange:
|
||||
nameField.changed || topicField.changed || encryptCheckBox.changed ||
|
||||
requireInviteCheckbox.changed || forbidGuestsCheckBox.changed
|
||||
nameField.field.changed || topicField.field.changed ||
|
||||
encryptCheckBox.changed || requireInviteCheckbox.changed ||
|
||||
forbidGuestsCheckBox.changed
|
||||
|
||||
|
||||
HRoomAvatar {
|
||||
|
@ -65,21 +66,22 @@ HBox {
|
|||
Layout.maximumWidth: 256 * theme.uiScale
|
||||
}
|
||||
|
||||
HTextField {
|
||||
HLabeledTextField {
|
||||
id: nameField
|
||||
placeholderText: qsTr("Room name")
|
||||
maximumLength: 255
|
||||
defaultText: chat.roomInfo.given_name
|
||||
enabled: chat.roomInfo.can_set_name
|
||||
label.text: qsTr("Name:")
|
||||
field.maximumLength: 255
|
||||
field.defaultText: chat.roomInfo.given_name
|
||||
field.enabled: chat.roomInfo.can_set_name
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
HScrollableTextArea {
|
||||
HLabeledTextField {
|
||||
id: topicField
|
||||
placeholderText: qsTr("Room topic")
|
||||
defaultText: chat.roomInfo.plain_topic
|
||||
enabled: chat.roomInfo.can_set_topic
|
||||
label.text: qsTr("Topic:")
|
||||
field.placeholderText: qsTr("This room is about...")
|
||||
field.defaultText: chat.roomInfo.plain_topic
|
||||
field.enabled: chat.roomInfo.can_set_topic
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ BoxPopup {
|
|||
|
||||
HTextField {
|
||||
id: passwordField
|
||||
placeholderText: qsTr("Passphrase")
|
||||
echoMode: TextInput.Password
|
||||
focus: true
|
||||
error: passwordValid === false
|
||||
|
|
Loading…
Reference in New Issue
Block a user