added transparent-background, for blocking clicked event

This commit is contained in:
ronoaer 2023-10-15 15:17:04 +08:00
parent 384ce9853b
commit 8c1835950b
15 changed files with 134 additions and 34 deletions

View file

@ -12,9 +12,12 @@ Drawer2Type {
id: root id: root
width: parent.width width: parent.width
height: parent.height * 0.4375 height: parent.height
contentHeight: parent.height * 0.4375
ColumnLayout { ColumnLayout {
parent: root.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -17,9 +17,12 @@ Drawer2Type {
property var noButtonFunction property var noButtonFunction
width: parent.width width: parent.width
height: parent.height * 0.5 height: parent.height
contentHeight: parent.height * 0.5
ColumnLayout { ColumnLayout {
parent: root.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -27,6 +30,8 @@ Drawer2Type {
anchors.rightMargin: 16 anchors.rightMargin: 16
anchors.leftMargin: 16 anchors.leftMargin: 16
// visible: false
spacing: 8 spacing: 8
Header2TextType { Header2TextType {

View file

@ -9,11 +9,14 @@ Drawer2Type {
id: root id: root
width: parent.width width: parent.width
height: parent.height * 0.9 height: parent.height
contentHeight: parent.height * 0.9
ColumnLayout { ColumnLayout {
id: backButton id: backButton
parent: root.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -28,6 +31,7 @@ Drawer2Type {
} }
FlickableType { FlickableType {
parent: root.contentParent
anchors.top: backButton.bottom anchors.top: backButton.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -28,7 +28,8 @@ Drawer2Type {
property string configFileName: "amnezia_config.vpn" property string configFileName: "amnezia_config.vpn"
width: parent.width width: parent.width
height: parent.height * 0.9 height: parent.height
contentHeight: parent.height * 0.9
onClose: { onClose: {
configExtension = ".vpn" configExtension = ".vpn"
@ -41,6 +42,9 @@ Drawer2Type {
Header2Type { Header2Type {
id: header id: header
parent: root.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -50,6 +54,8 @@ Drawer2Type {
} }
FlickableType { FlickableType {
parent: root.contentParent
anchors.top: header.bottom anchors.top: header.bottom
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
contentHeight: content.height + 32 contentHeight: content.height + 32
@ -135,11 +141,15 @@ Drawer2Type {
parent: root parent: root
width: parent.width width: parent.width
height: parent.height * 0.9 height: parent.height
contentHeight: parent.height * 0.9
BackButtonType { BackButtonType {
id: backButton id: backButton
parent: configContentDrawer.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -151,6 +161,8 @@ Drawer2Type {
} }
FlickableType { FlickableType {
parent: configContentDrawer.contentParent
anchors.top: backButton.bottom anchors.top: backButton.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -16,8 +16,6 @@ Item {
visible: false visible: false
parent: Overlay.overlay
signal close() signal close()
property bool needCloseButton: true property bool needCloseButton: true
@ -27,7 +25,10 @@ Item {
property int collapsedHeight: 0 property int collapsedHeight: 0
property bool needCollapsed: false property bool needCollapsed: false
property double scaely
property int contentHeight: 0
property Item contentParent: contentArea
// property bool inContentArea: false
y: parent.height - root.height y: parent.height - root.height
@ -37,23 +38,49 @@ Item {
id: draw2Background id: draw2Background
anchors { left: root.left; right: root.right; top: root.top } anchors { left: root.left; right: root.right; top: root.top }
height: root.height height: root.parent.height
width: parent.width
radius: 16 radius: 16
color: root.defaultColor color: "transparent"
border.color: root.borderColor border.color: "transparent" //"green"
border.width: 1 border.width: 1
visible: true
Rectangle { Rectangle {
width: parent.radius id: semiArea
height: parent.radius anchors.top: parent.top
anchors.bottom: parent.bottom height: parent.height - contentHeight
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
color: parent.color visible: true
color: "transparent"
}
Rectangle {
id: contentArea
anchors.top: semiArea.bottom
height: contentHeight
radius: 16
color: root.defaultColor
border.width: 1
border.color: root.borderColor
width: parent.width
visible: true
Rectangle {
width: parent.radius
height: parent.radius
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
color: parent.color
}
} }
} }
MouseArea { MouseArea {
id: fullArea
anchors.fill: parent anchors.fill: parent
enabled: (root.state === "expanded" || root.state === "opened") enabled: (root.state === "expanded" || root.state === "opened")
onClicked: { onClicked: {
@ -75,6 +102,7 @@ Item {
id: dragArea id: dragArea
anchors.fill: parent anchors.fill: parent
cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true hoverEnabled: true
@ -108,12 +136,14 @@ Item {
} }
onClicked: { onClicked: {
if (root.state === "opened") { if (root.state === "expanded") {
root.state = "closed" root.state = "collapsed"
return
} }
if (root.state == "expanded") { if (root.state === "opened") {
root.state == "collapsed" root.state = "closed"
return
} }
} }
} }
@ -217,7 +247,7 @@ Item {
target: root target: root
property: "y" property: "y"
from: parent.height from: parent.height
to: parent.height - root.height to: 0
duration: 200 duration: 200
} }
@ -226,9 +256,11 @@ Item {
return return
} }
root.y = 0
root.state = "opened" root.state = "opened"
root.visible = true root.visible = true
root.y = parent.height - root.height root.height = parent.height
contentArea.height = contentHeight
dragArea.drag.maximumY = parent.height dragArea.drag.maximumY = parent.height
dragArea.drag.minimumY = parent.height - root.height dragArea.drag.minimumY = parent.height - root.height

View file

@ -40,6 +40,8 @@ Item {
property alias menuVisible: menu.visible property alias menuVisible: menu.visible
property Item drawerParent: root
implicitWidth: rootButtonContent.implicitWidth implicitWidth: rootButtonContent.implicitWidth
implicitHeight: rootButtonContent.implicitHeight implicitHeight: rootButtonContent.implicitHeight
@ -161,18 +163,21 @@ Item {
} }
} }
// Drawer2Type { //DrawerType {
DrawerType { Drawer2Type {
id: menu id: menu
width: parent.width parent: drawerParent
height: parent.height * drawerHeight
// parent: root.parent.parent width: parent.width
height: parent.height
contentHeight: parent.height * drawerHeight
ColumnLayout { ColumnLayout {
id: header id: header
parent: menu.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -187,6 +192,8 @@ Item {
} }
FlickableType { FlickableType {
parent: menu.contentParent
anchors.top: header.bottom anchors.top: header.bottom
anchors.topMargin: 16 anchors.topMargin: 16
contentHeight: col.implicitHeight contentHeight: col.implicitHeight

View file

@ -117,6 +117,8 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
drawerParent: root
descriptionText: qsTr("Cipher") descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher") headerText: qsTr("Cipher")

View file

@ -156,6 +156,8 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
drawerParent: root
enabled: !autoNegotiateEncryprionSwitcher.checked enabled: !autoNegotiateEncryprionSwitcher.checked
descriptionText: qsTr("Hash") descriptionText: qsTr("Hash")
@ -202,6 +204,8 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
drawerParent: root
enabled: !autoNegotiateEncryprionSwitcher.checked enabled: !autoNegotiateEncryprionSwitcher.checked
descriptionText: qsTr("Cipher") descriptionText: qsTr("Cipher")

View file

@ -95,11 +95,14 @@ PageType {
parent: root parent: root
width: parent.width width: parent.width
height: parent.height * 0.9 height: parent.height
contentHeight: parent.height * 0.9
BackButtonType { BackButtonType {
id: backButton id: backButton
parent: configContentDrawer.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -95,6 +95,8 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
drawerParent: root
descriptionText: qsTr("Cipher") descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher") headerText: qsTr("Cipher")

View file

@ -141,7 +141,7 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false questionDrawer.close()
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
ConnectionController.closeConnection() ConnectionController.closeConnection()
@ -150,9 +150,9 @@ PageType {
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
} }
questionDrawer.noButtonFunction = function() { questionDrawer.noButtonFunction = function() {
questionDrawer.visible = false questionDrawer.close()
} }
questionDrawer.visible = true questionDrawer.open()
} }
} }
@ -192,6 +192,8 @@ PageType {
QuestionDrawer { QuestionDrawer {
id: questionDrawer id: questionDrawer
parent: root
} }
} }
} }

View file

@ -80,7 +80,8 @@ PageType {
parent: root parent: root
width: root.width width: root.width
height: root.height * 0.35 height: root.height // * 0.35
contentHeight: root.height * 0.35
onVisibleChanged: { onVisibleChanged: {
if (serverNameEditDrawer.visible) { if (serverNameEditDrawer.visible) {
@ -89,6 +90,8 @@ PageType {
} }
ColumnLayout { ColumnLayout {
parent: serverNameEditDrawer.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -108,6 +108,8 @@ PageType {
DropDownType { DropDownType {
id: selector id: selector
drawerParent: root
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
Layout.leftMargin: 16 Layout.leftMargin: 16
@ -264,11 +266,14 @@ PageType {
id: moreActionsDrawer id: moreActionsDrawer
width: parent.width width: parent.width
height: parent.height * 0.4375 height: parent.height
contentHeight: parent.height * 0.4375
parent: root parent: root
FlickableType { FlickableType {
parent: moreActionsDrawer.contentParent
anchors.fill: parent anchors.fill: parent
contentHeight: moreActionsDrawerContent.height contentHeight: moreActionsDrawerContent.height
ColumnLayout { ColumnLayout {
@ -331,13 +336,16 @@ PageType {
id: importSitesDrawer id: importSitesDrawer
width: parent.width width: parent.width
height: parent.height * 0.4375 height: parent.height
contentHeight: parent.height * 0.4375
parent: root parent: root
BackButtonType { BackButtonType {
id: importSitesDrawerBackButton id: importSitesDrawerBackButton
parent: importSitesDrawer.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -349,6 +357,8 @@ PageType {
} }
FlickableType { FlickableType {
parent: importSitesDrawer.contentParent
anchors.top: importSitesDrawerBackButton.bottom anchors.top: importSitesDrawerBackButton.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -101,13 +101,16 @@ PageType {
id: showDetailsDrawer id: showDetailsDrawer
width: parent.width width: parent.width
height: parent.height * 0.9 height: parent.height
contentHeight: parent.height * 0.9
parent: root parent: root
BackButtonType { BackButtonType {
id: showDetailsBackButton id: showDetailsBackButton
parent: showDetailsDrawer.contentParent
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -119,6 +122,8 @@ PageType {
} }
FlickableType { FlickableType {
parent: showDetailsDrawer.contentParent
anchors.top: showDetailsBackButton.bottom anchors.top: showDetailsBackButton.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -179,6 +179,8 @@ PageType {
DropDownType { DropDownType {
id: serverSelector id: serverSelector
drawerParent: root
signal severSelectorIndexChanged signal severSelectorIndexChanged
property int currentIndex: 0 property int currentIndex: 0
@ -241,6 +243,8 @@ PageType {
DropDownType { DropDownType {
id: protocolSelector id: protocolSelector
drawerParent: root
visible: accessTypeSelector.currentIndex === 0 visible: accessTypeSelector.currentIndex === 0
Layout.fillWidth: true Layout.fillWidth: true
@ -330,6 +334,8 @@ PageType {
DropDownType { DropDownType {
id: exportTypeSelector id: exportTypeSelector
drawerParent: root
property int currentIndex: 0 property int currentIndex: 0
Layout.fillWidth: true Layout.fillWidth: true