added 'insert' button and 'show password' button for PageSetupWizardCredentials

This commit is contained in:
vladimir.kuznetsov 2023-07-31 14:29:49 +09:00
parent 66f9a82f31
commit aa66133813
10 changed files with 53 additions and 11 deletions

View file

@ -11,17 +11,17 @@ Item {
readonly property int defaultMargin: 20
function isMobile() {
if (Qt.platform.os == "android" ||
Qt.platform.os == "ios") {
if (Qt.platform.os === "android" ||
Qt.platform.os === "ios") {
return true
}
return false
}
function isDesktop() {
if (Qt.platform.os == "windows" ||
Qt.platform.os == "linux" ||
Qt.platform.os == "osx") {
if (Qt.platform.os === "windows" ||
Qt.platform.os === "linux" ||
Qt.platform.os === "osx") {
return true
}
return false

View file

@ -54,7 +54,11 @@ Button {
contentItem: Item {
anchors.fill: background
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight
RowLayout {
id: content
anchors.centerIn: parent
Image {
@ -72,6 +76,7 @@ Button {
ButtonTextType {
color: textColor
text: root.text
visible: root.text === "" ? false : true
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter

View file

@ -14,6 +14,7 @@ Item {
property alias errorText: errorField.text
property string buttonText
property string buttonImageSource
property var clickedFunc
property alias textField: textField
@ -101,7 +102,7 @@ Item {
}
BasicButtonType {
visible: root.buttonText !== ""
visible: (root.buttonText !== "") || (root.buttonImageSource !== "")
defaultColor: "transparent"
hoveredColor: Qt.rgba(1, 1, 1, 0.08)
@ -111,8 +112,10 @@ Item {
borderWidth: 0
text: root.buttonText
imageSource: root.buttonImageSource
Layout.rightMargin: 24
Layout.preferredHeight: 32
onClicked: {
if (root.clickedFunc && typeof root.clickedFunc === "function") {

View file

@ -76,9 +76,9 @@ It's okay if a friend passed the code.")
DividerType {}
//todo ifdef mobile platforms
LabelWithButtonType {
Layout.fillWidth: true
visible: GC.isMobile()
text: qsTr("QR-code")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
@ -90,7 +90,9 @@ It's okay if a friend passed the code.")
}
}
DividerType {}
DividerType {
visible: GC.isMobile()
}
LabelWithButtonType {
Layout.fillWidth: true

View file

@ -53,6 +53,12 @@ PageType {
textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressPortRegExp()
}
buttonText: qsTr("Insert")
clickedFunc: function() {
textField.text = ""
textField.paste()
}
}
TextFieldWithHeaderType {
@ -61,14 +67,27 @@ PageType {
Layout.fillWidth: true
headerText: qsTr("Login to connect via SSH")
textFieldPlaceholderText: "root"
buttonText: qsTr("Insert")
clickedFunc: function() {
textField.text = ""
textField.paste()
}
}
TextFieldWithHeaderType {
id: secretData
property bool hidePassword: true
Layout.fillWidth: true
headerText: qsTr("Password / SSH private key")
textField.echoMode: TextInput.Password
textField.echoMode: hidePassword ? TextInput.Password : TextInput.Normal
buttonImageSource: hidePassword ? "qrc:/images/controls/eye.svg" : "qrc:/images/controls/eye-off.svg"
clickedFunc: function() {
hidePassword = !hidePassword
}
}
BasicButtonType {