From 804a790392319ef89cfb01b0b2ab269f9134c2d5 Mon Sep 17 00:00:00 2001 From: pokamest Date: Sat, 24 Dec 2022 16:41:53 +0000 Subject: [PATCH] FlickableType added --- client/resources.qrc | 1 + client/ui/qml/Controls/FlickableType.qml | 14 ++++++++++++++ .../qml/Pages/InstallSettings/SelectContainer.qml | 2 +- client/ui/qml/Pages/PageAppSetting.qml | 6 +----- client/ui/qml/Pages/PageGeneralSettings.qml | 2 +- client/ui/qml/Pages/PageServerContainers.qml | 2 +- client/ui/qml/Pages/PageServerList.qml | 2 +- client/ui/qml/Pages/PageSetupWizard.qml | 2 +- client/ui/qml/Pages/PageSetupWizardHighLevel.qml | 2 +- client/ui/qml/Pages/PageSetupWizardLowLevel.qml | 2 +- client/ui/qml/Pages/PageSetupWizardMediumLevel.qml | 2 +- client/ui/qml/Pages/PageSetupWizardVPNMode.qml | 2 +- client/ui/qml/Pages/PageShareConnection.qml | 2 +- client/ui/qml/Pages/PageViewConfig.qml | 2 +- client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml | 2 +- .../ui/qml/Pages/Share/PageShareProtoAmnezia.qml | 2 +- client/ui/qml/Pages/Share/PageShareProtoCloak.qml | 2 +- client/ui/qml/Pages/Share/PageShareProtoIkev2.qml | 2 +- .../ui/qml/Pages/Share/PageShareProtoOpenVPN.qml | 2 +- .../qml/Pages/Share/PageShareProtoShadowSocks.qml | 2 +- .../ui/qml/Pages/Share/PageShareProtoWireGuard.qml | 2 +- 21 files changed, 34 insertions(+), 23 deletions(-) create mode 100644 client/ui/qml/Controls/FlickableType.qml diff --git a/client/resources.qrc b/client/resources.qrc index a7e67e398..a049e180c 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -160,5 +160,6 @@ ui/qml/Pages/PageQrDecoderIos.qml server_scripts/website_tor/Dockerfile ui/qml/Pages/PageViewConfig.qml + ui/qml/Controls/FlickableType.qml diff --git a/client/ui/qml/Controls/FlickableType.qml b/client/ui/qml/Controls/FlickableType.qml new file mode 100644 index 000000000..12c5eb086 --- /dev/null +++ b/client/ui/qml/Controls/FlickableType.qml @@ -0,0 +1,14 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 + +Flickable { + id: fl + + Keys.onUpPressed: scrollBar.decrease() + Keys.onDownPressed: scrollBar.increase() + + ScrollBar.vertical: ScrollBar { + id: scrollBar + policy: fl.height > fl.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn + } +} diff --git a/client/ui/qml/Pages/InstallSettings/SelectContainer.qml b/client/ui/qml/Pages/InstallSettings/SelectContainer.qml index 83efaec1c..8a99c7aca 100644 --- a/client/ui/qml/Pages/InstallSettings/SelectContainer.qml +++ b/client/ui/qml/Pages/InstallSettings/SelectContainer.qml @@ -50,7 +50,7 @@ Drawer { } - Flickable { + FlickableType { clip: true anchors.fill: parent contentHeight: col.height diff --git a/client/ui/qml/Pages/PageAppSetting.qml b/client/ui/qml/Pages/PageAppSetting.qml index 1b0f05c05..97ed063b6 100644 --- a/client/ui/qml/Pages/PageAppSetting.qml +++ b/client/ui/qml/Pages/PageAppSetting.qml @@ -19,7 +19,7 @@ PageBase { text: qsTr("Application Settings") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom @@ -162,10 +162,6 @@ PageBase { } } } - - ScrollBar.vertical: ScrollBar { - policy: fl.height > content.height? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn - } } Logo { diff --git a/client/ui/qml/Pages/PageGeneralSettings.qml b/client/ui/qml/Pages/PageGeneralSettings.qml index 04bf44728..50b9d6c4f 100644 --- a/client/ui/qml/Pages/PageGeneralSettings.qml +++ b/client/ui/qml/Pages/PageGeneralSettings.qml @@ -17,7 +17,7 @@ PageBase { z: -1 } - Flickable { + FlickableType { id: fl width: root.width anchors.top: back.bottom diff --git a/client/ui/qml/Pages/PageServerContainers.qml b/client/ui/qml/Pages/PageServerContainers.qml index 4b05568a3..d61d2a7fc 100644 --- a/client/ui/qml/Pages/PageServerContainers.qml +++ b/client/ui/qml/Pages/PageServerContainers.qml @@ -178,7 +178,7 @@ PageBase { - Flickable { + FlickableType { visible: container_selector.selectedIndex <= 0 clip: true width: parent.width diff --git a/client/ui/qml/Pages/PageServerList.qml b/client/ui/qml/Pages/PageServerList.qml index 7791cc05a..bde343aa3 100644 --- a/client/ui/qml/Pages/PageServerList.qml +++ b/client/ui/qml/Pages/PageServerList.qml @@ -176,7 +176,7 @@ PageBase { } ScrollBar.vertical: ScrollBar { - policy: ScrollBar.AlwaysOn + policy: ScrollBar.AsNeeded } } } diff --git a/client/ui/qml/Pages/PageSetupWizard.qml b/client/ui/qml/Pages/PageSetupWizard.qml index 8a13d6678..b6aab471c 100644 --- a/client/ui/qml/Pages/PageSetupWizard.qml +++ b/client/ui/qml/Pages/PageSetupWizard.qml @@ -19,7 +19,7 @@ PageBase { text: qsTr("Setup your server to use VPN") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/PageSetupWizardHighLevel.qml b/client/ui/qml/Pages/PageSetupWizardHighLevel.qml index 1729aff06..bd8c72d64 100644 --- a/client/ui/qml/Pages/PageSetupWizardHighLevel.qml +++ b/client/ui/qml/Pages/PageSetupWizardHighLevel.qml @@ -19,7 +19,7 @@ PageBase { text: qsTr("Setup Wizard") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/PageSetupWizardLowLevel.qml b/client/ui/qml/Pages/PageSetupWizardLowLevel.qml index 8b7ee7442..f6c345587 100644 --- a/client/ui/qml/Pages/PageSetupWizardLowLevel.qml +++ b/client/ui/qml/Pages/PageSetupWizardLowLevel.qml @@ -19,7 +19,7 @@ PageBase { text: qsTr("Setup Wizard") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/PageSetupWizardMediumLevel.qml b/client/ui/qml/Pages/PageSetupWizardMediumLevel.qml index 01721cdc7..21b0e8f85 100644 --- a/client/ui/qml/Pages/PageSetupWizardMediumLevel.qml +++ b/client/ui/qml/Pages/PageSetupWizardMediumLevel.qml @@ -19,7 +19,7 @@ PageBase { text: qsTr("Setup Wizard") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/PageSetupWizardVPNMode.qml b/client/ui/qml/Pages/PageSetupWizardVPNMode.qml index 2445819e1..d307aacf5 100644 --- a/client/ui/qml/Pages/PageSetupWizardVPNMode.qml +++ b/client/ui/qml/Pages/PageSetupWizardVPNMode.qml @@ -19,7 +19,7 @@ PageBase { text: qsTr("Setup Wizard") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/PageShareConnection.qml b/client/ui/qml/Pages/PageShareConnection.qml index b643a7eed..59ca378dd 100644 --- a/client/ui/qml/Pages/PageShareConnection.qml +++ b/client/ui/qml/Pages/PageShareConnection.qml @@ -28,7 +28,7 @@ PageBase { } - Flickable { + FlickableType { clip: true width: parent.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/PageViewConfig.qml b/client/ui/qml/Pages/PageViewConfig.qml index acefb9b3b..198e1a09e 100644 --- a/client/ui/qml/Pages/PageViewConfig.qml +++ b/client/ui/qml/Pages/PageViewConfig.qml @@ -20,7 +20,7 @@ PageBase { text: qsTr("Check config") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml b/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml index 9c00172ce..67a095fb3 100644 --- a/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml +++ b/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml @@ -19,7 +19,7 @@ PageProtocolBase { text: qsTr("OpenVPN Settings") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/Share/PageShareProtoAmnezia.qml b/client/ui/qml/Pages/Share/PageShareProtoAmnezia.qml index 2afecbadd..9de5d5b3b 100644 --- a/client/ui/qml/Pages/Share/PageShareProtoAmnezia.qml +++ b/client/ui/qml/Pages/Share/PageShareProtoAmnezia.qml @@ -18,7 +18,7 @@ PageShareProtocolBase { text: qsTr("Share for Amnezia") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/Share/PageShareProtoCloak.qml b/client/ui/qml/Pages/Share/PageShareProtoCloak.qml index fe92c1e7d..0ba7d1eee 100644 --- a/client/ui/qml/Pages/Share/PageShareProtoCloak.qml +++ b/client/ui/qml/Pages/Share/PageShareProtoCloak.qml @@ -18,7 +18,7 @@ PageShareProtocolBase { text: qsTr("Share Cloak Settings") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/Share/PageShareProtoIkev2.qml b/client/ui/qml/Pages/Share/PageShareProtoIkev2.qml index ffa300aab..1c44b2cb9 100644 --- a/client/ui/qml/Pages/Share/PageShareProtoIkev2.qml +++ b/client/ui/qml/Pages/Share/PageShareProtoIkev2.qml @@ -42,7 +42,7 @@ PageShareProtocolBase { visible: false } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/Share/PageShareProtoOpenVPN.qml b/client/ui/qml/Pages/Share/PageShareProtoOpenVPN.qml index ab4a9a3d9..67a917759 100644 --- a/client/ui/qml/Pages/Share/PageShareProtoOpenVPN.qml +++ b/client/ui/qml/Pages/Share/PageShareProtoOpenVPN.qml @@ -18,7 +18,7 @@ PageShareProtocolBase { text: qsTr("Share OpenVPN Settings") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/Share/PageShareProtoShadowSocks.qml b/client/ui/qml/Pages/Share/PageShareProtoShadowSocks.qml index f8d83ae38..9956609bd 100644 --- a/client/ui/qml/Pages/Share/PageShareProtoShadowSocks.qml +++ b/client/ui/qml/Pages/Share/PageShareProtoShadowSocks.qml @@ -18,7 +18,7 @@ PageShareProtocolBase { text: qsTr("Share ShadowSocks Settings") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom diff --git a/client/ui/qml/Pages/Share/PageShareProtoWireGuard.qml b/client/ui/qml/Pages/Share/PageShareProtoWireGuard.qml index 336964ac3..f9f98a6a1 100644 --- a/client/ui/qml/Pages/Share/PageShareProtoWireGuard.qml +++ b/client/ui/qml/Pages/Share/PageShareProtoWireGuard.qml @@ -18,7 +18,7 @@ PageShareProtocolBase { text: qsTr("Share WireGuard Settings") } - Flickable { + FlickableType { id: fl width: root.width anchors.top: caption.bottom