From aa66133813e375c9ec151967a80b04ae6f51bf25 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 31 Jul 2023 14:29:49 +0900 Subject: [PATCH] added 'insert' button and 'show password' button for PageSetupWizardCredentials --- .gitignore | 1 + CMakeLists.txt | 4 ++-- client/images/controls/eye-off.svg | 6 ++++++ client/images/controls/eye.svg | 4 ++++ client/resources.qrc | 2 ++ client/ui/qml/Config/GlobalConfig.qml | 10 ++++----- client/ui/qml/Controls2/BasicButtonType.qml | 5 +++++ .../qml/Controls2/TextFieldWithHeaderType.qml | 5 ++++- .../Pages2/PageSetupWizardConfigSource.qml | 6 ++++-- .../qml/Pages2/PageSetupWizardCredentials.qml | 21 ++++++++++++++++++- 10 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 client/images/controls/eye-off.svg create mode 100644 client/images/controls/eye.svg diff --git a/.gitignore b/.gitignore index 88a3b3977..7de64e4b2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ deploy/build/* deploy/build_32/* deploy/build_64/* winbuild*.bat +.cache/ # Qt-es diff --git a/CMakeLists.txt b/CMakeLists.txt index ad9866e0e..2ff60079b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR) set(PROJECT AmneziaVPN) -project(${PROJECT} VERSION 3.0.8.1 +project(${PROJECT} VERSION 4.0.0.1 DESCRIPTION "AmneziaVPN" HOMEPAGE_URL "https://amnezia.org/" ) -set(RELEASE_DATE "2023-07-15") +set(RELEASE_DATE "2023-07-31") set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") diff --git a/client/images/controls/eye-off.svg b/client/images/controls/eye-off.svg new file mode 100644 index 000000000..d05e0b850 --- /dev/null +++ b/client/images/controls/eye-off.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/client/images/controls/eye.svg b/client/images/controls/eye.svg new file mode 100644 index 000000000..a01452af0 --- /dev/null +++ b/client/images/controls/eye.svg @@ -0,0 +1,4 @@ + + + + diff --git a/client/resources.qrc b/client/resources.qrc index 85ee838f2..625292c2e 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -278,5 +278,7 @@ images/controls/copy.svg ui/qml/Pages2/PageServiceTorWebsiteSettings.qml ui/qml/Pages2/PageSetupWizardQrReader.qml + images/controls/eye.svg + images/controls/eye-off.svg diff --git a/client/ui/qml/Config/GlobalConfig.qml b/client/ui/qml/Config/GlobalConfig.qml index 5bb71b6fe..a9edd543d 100644 --- a/client/ui/qml/Config/GlobalConfig.qml +++ b/client/ui/qml/Config/GlobalConfig.qml @@ -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 diff --git a/client/ui/qml/Controls2/BasicButtonType.qml b/client/ui/qml/Controls2/BasicButtonType.qml index aa05774e8..c69d51d7c 100644 --- a/client/ui/qml/Controls2/BasicButtonType.qml +++ b/client/ui/qml/Controls2/BasicButtonType.qml @@ -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 diff --git a/client/ui/qml/Controls2/TextFieldWithHeaderType.qml b/client/ui/qml/Controls2/TextFieldWithHeaderType.qml index 13a7ea6e5..1414b5ecd 100644 --- a/client/ui/qml/Controls2/TextFieldWithHeaderType.qml +++ b/client/ui/qml/Controls2/TextFieldWithHeaderType.qml @@ -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") { diff --git a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml index 2d6b249d1..cd0c08fbc 100644 --- a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml +++ b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml @@ -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 diff --git a/client/ui/qml/Pages2/PageSetupWizardCredentials.qml b/client/ui/qml/Pages2/PageSetupWizardCredentials.qml index b72fe9889..cc1197adf 100644 --- a/client/ui/qml/Pages2/PageSetupWizardCredentials.qml +++ b/client/ui/qml/Pages2/PageSetupWizardCredentials.qml @@ -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 {