From 74169ef7b305a3ef04d5b03d734e2224c430d712 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Thu, 21 Nov 2024 14:45:28 +0700 Subject: [PATCH 1/2] added scroll on page with services list --- client/ui/qml/Controls2/CardWithIconsType.qml | 1 + .../Pages2/PageSetupWizardApiServicesList.qml | 125 +++++++++--------- .../Pages2/PageSetupWizardConfigSource.qml | 1 - 3 files changed, 66 insertions(+), 61 deletions(-) diff --git a/client/ui/qml/Controls2/CardWithIconsType.qml b/client/ui/qml/Controls2/CardWithIconsType.qml index fea65116..18a29b87 100644 --- a/client/ui/qml/Controls2/CardWithIconsType.qml +++ b/client/ui/qml/Controls2/CardWithIconsType.qml @@ -145,6 +145,7 @@ Button { cursorShape: Qt.PointingHandCursor hoverEnabled: true + enabled: root.enabled onEntered: { backgroundRect.color = root.hoveredColor diff --git a/client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml b/client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml index 85a50393..081f2e56 100644 --- a/client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml +++ b/client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml @@ -16,83 +16,88 @@ PageType { defaultActiveFocusItem: focusItem - FlickableType { - id: fl + ColumnLayout { + id: header + anchors.top: parent.top - anchors.bottom: parent.bottom - contentHeight: content.height + anchors.left: parent.left + anchors.right: parent.right - ColumnLayout { - id: content + spacing: 0 - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + Item { + id: focusItem + KeyNavigation.tab: backButton + } - spacing: 0 - - Item { - id: focusItem - KeyNavigation.tab: backButton - } - - BackButtonType { - id: backButton - Layout.topMargin: 20 + BackButtonType { + id: backButton + Layout.topMargin: 20 // KeyNavigation.tab: fileButton.rightButton - } + } - HeaderType { - Layout.fillWidth: true - Layout.topMargin: 8 - Layout.rightMargin: 16 - Layout.leftMargin: 16 - Layout.bottomMargin: 32 + HeaderType { + Layout.fillWidth: true + Layout.topMargin: 8 + Layout.rightMargin: 16 + Layout.leftMargin: 16 + Layout.bottomMargin: 16 - headerText: qsTr("VPN by Amnezia") - descriptionText: qsTr("Choose a VPN service that suits your needs.") - } + headerText: qsTr("VPN by Amnezia") + descriptionText: qsTr("Choose a VPN service that suits your needs.") + } + } - ListView { - id: containers - width: parent.width - height: containers.contentItem.height - spacing: 16 + ListView { + id: servicesListView + anchors.top: header.bottom + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.topMargin: 16 + anchors.bottomMargin: 16 + spacing: 16 - currentIndex: 1 - interactive: false - model: ApiServicesModel + currentIndex: 1 + clip: true + model: ApiServicesModel - delegate: Item { - implicitWidth: containers.width - implicitHeight: delegateContent.implicitHeight + ScrollBar.vertical: ScrollBar { + id: scrollBar + policy: servicesListView.height >= servicesListView.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn + } - ColumnLayout { - id: delegateContent + Keys.onUpPressed: scrollBar.decrease() + Keys.onDownPressed: scrollBar.increase() - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + delegate: Item { + implicitWidth: servicesListView.width + implicitHeight: delegateContent.implicitHeight - CardWithIconsType { - id: card + ColumnLayout { + id: delegateContent - Layout.fillWidth: true - Layout.rightMargin: 16 - Layout.leftMargin: 16 + anchors.fill: parent - headerText: name - bodyText: cardDescription - footerText: price + CardWithIconsType { + id: card - rightImageSource: "qrc:/images/controls/chevron-right.svg" + Layout.fillWidth: true + Layout.rightMargin: 16 + Layout.leftMargin: 16 - onClicked: { - if (isServiceAvailable) { - ApiServicesModel.setServiceIndex(index) - PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo) - } - } + headerText: name + bodyText: cardDescription + footerText: price + + rightImageSource: "qrc:/images/controls/chevron-right.svg" + + enabled: isServiceAvailable + + onClicked: { + if (isServiceAvailable) { + ApiServicesModel.setServiceIndex(index) + PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo) } } } diff --git a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml index 7c031997..f973c89c 100644 --- a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml +++ b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml @@ -47,7 +47,6 @@ PageType { KeyNavigation.tab: textKey.textField } - HeaderType { property bool isVisible: SettingsController.getInstallationUuid() !== "" || PageController.isStartPageVisible() From 7420226b7c280ff29453238fa68d2a38d284a6db Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 25 Nov 2024 12:39:24 +0700 Subject: [PATCH 2/2] fixed margins on PageSetupWizardApiServicesList --- .../ui/qml/Pages2/PageSetupWizardApiServicesList.qml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml b/client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml index 081f2e56..f726cd49 100644 --- a/client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml +++ b/client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml @@ -55,20 +55,13 @@ PageType { anchors.left: parent.left anchors.bottom: parent.bottom anchors.topMargin: 16 - anchors.bottomMargin: 16 - spacing: 16 + spacing: 0 currentIndex: 1 clip: true model: ApiServicesModel - ScrollBar.vertical: ScrollBar { - id: scrollBar - policy: servicesListView.height >= servicesListView.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn - } - - Keys.onUpPressed: scrollBar.decrease() - Keys.onDownPressed: scrollBar.increase() + ScrollBar.vertical: ScrollBar {} delegate: Item { implicitWidth: servicesListView.width @@ -85,6 +78,7 @@ PageType { Layout.fillWidth: true Layout.rightMargin: 16 Layout.leftMargin: 16 + Layout.bottomMargin: 16 headerText: name bodyText: cardDescription