diff options
author | DeepBlueV7.X <nicolas.werner@hotmail.de> | 2024-01-08 21:19:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-08 21:19:32 +0100 |
commit | 066c9f159370f1fda83fd68c49f57397335fd658 (patch) | |
tree | 3e2da067bdf2807470eb61382928ae10fc9e32fc /resources | |
parent | Translated using Weblate (Chinese (Simplified)) (diff) | |
parent | LoginPage: add button to show/hide the password (diff) | |
download | nheko-066c9f159370f1fda83fd68c49f57397335fd658.tar.xz |
Merge pull request #1656 from Bubu/show_pw_button
Add show/hide password button on login page
Diffstat (limited to 'resources')
-rw-r--r-- | resources/icons/ui/eye-hide.svg | 3 | ||||
-rw-r--r-- | resources/icons/ui/eye-show.svg | 1 | ||||
-rw-r--r-- | resources/qml/pages/LoginPage.qml | 37 | ||||
-rw-r--r-- | resources/res.qrc | 2 |
4 files changed, 35 insertions, 8 deletions
diff --git a/resources/icons/ui/eye-hide.svg b/resources/icons/ui/eye-hide.svg new file mode 100644 index 00000000..05d26d96 --- /dev/null +++ b/resources/icons/ui/eye-hide.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> + <path d="M2.22 2.22a.75.75 0 0 0-.073.976l.073.084 4.034 4.035a9.986 9.986 0 0 0-3.955 5.75.75.75 0 0 0 1.455.364 8.49 8.49 0 0 1 3.58-5.034l1.81 1.81A4 4 0 0 0 14.8 15.86l5.919 5.92a.75.75 0 0 0 1.133-.977l-.073-.084-6.113-6.114.001-.002-6.95-6.946.002-.002-1.133-1.13L3.28 2.22a.75.75 0 0 0-1.06 0ZM12 5.5c-1 0-1.97.148-2.889.425l1.237 1.236a8.503 8.503 0 0 1 9.899 6.272.75.75 0 0 0 1.455-.363A10.003 10.003 0 0 0 12 5.5Zm.195 3.51 3.801 3.8a4.003 4.003 0 0 0-3.801-3.8Z" fill="#212121"/> +</svg> \ No newline at end of file diff --git a/resources/icons/ui/eye-show.svg b/resources/icons/ui/eye-show.svg new file mode 100644 index 00000000..c4dabfa5 --- /dev/null +++ b/resources/icons/ui/eye-show.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 9.005a4 4 0 1 1 0 8 4 4 0 0 1 0-8ZM12 5.5c4.613 0 8.596 3.15 9.701 7.564a.75.75 0 1 1-1.455.365 8.503 8.503 0 0 0-16.493.004.75.75 0 0 1-1.455-.363A10.003 10.003 0 0 1 12 5.5Z" fill="#212121"/></svg> \ No newline at end of file diff --git a/resources/qml/pages/LoginPage.qml b/resources/qml/pages/LoginPage.qml index 86188918..8607b8dc 100644 --- a/resources/qml/pages/LoginPage.qml +++ b/resources/qml/pages/LoginPage.qml @@ -82,15 +82,36 @@ Item { visible: text wrapMode: TextEdit.Wrap } + RowLayout { - MatrixTextField { - id: passwordLabel - Layout.fillWidth: true - label: qsTr("Password") - echoMode: TextInput.Password - ToolTip.text: qsTr("Your password.") - visible: login.passwordSupported - Keys.forwardTo: [pwBtn, ssoRepeater] + MatrixTextField { + id: passwordLabel + Layout.fillWidth: true + label: qsTr("Password") + echoMode: TextInput.Password + ToolTip.text: qsTr("Your password.") + visible: login.passwordSupported + Keys.forwardTo: [pwBtn, ssoRepeater] + } + + ImageButton { + id: showPwButton + Layout.preferredWidth: 30 + Layout.preferredHeight: 30 + visible: login.passwordSupported + Layout.alignment: Qt.AlignBottom + image: passwordLabel.echoMode === TextInput.Password ? ":/icons/icons/ui/eye-show.svg" : ":/icons/icons/ui/eye-hide.svg" + ToolTip.visible: hovered + ToolTip.text: qsTr("Show/Hide Password") + onClicked: { + if (passwordLabel.echoMode === TextInput.Normal) { + passwordLabel.echoMode = TextInput.Password + } + else { + passwordLabel.echoMode = TextInput.Normal + } + } + } } MatrixTextField { diff --git a/resources/res.qrc b/resources/res.qrc index fb857d4a..642bc220 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -18,6 +18,8 @@ <file>icons/ui/edit.svg</file> <file>icons/ui/end-call.svg</file> <file>icons/ui/expanded.svg</file> + <file>icons/ui/eye-hide.svg</file> + <file>icons/ui/eye-show.svg</file> <file>icons/ui/go-to.svg</file> <file>icons/ui/image-failed.svg</file> <file>icons/ui/image.svg</file> |