removed invalid code, and fixed top button hidden-shown

This commit is contained in:
ronoaer 2023-10-15 17:29:22 +08:00
parent a75bd07cd8
commit d0f8358431
14 changed files with 58 additions and 63 deletions

View file

@ -14,9 +14,9 @@ Item {
}
}
visible: false
signal closed
signal close()
visible: false
property bool needCloseButton: true
@ -28,7 +28,6 @@ Item {
property double scaely
property int contentHeight: 0
property Item contentParent: contentArea
// property bool inContentArea: false
y: parent.height - root.height
@ -44,7 +43,7 @@ Item {
width: parent.width
radius: 16
color: "transparent"
border.color: "transparent" //"green"
border.color: "transparent"
border.width: 1
visible: true
@ -52,6 +51,8 @@ Item {
id: fullArea
anchors.fill: parent
enabled: (root.state === "expanded" || root.state === "opened")
hoverEnabled: true
onClicked: {
if (root.state === "expanded") {
root.state = "collapsed"
@ -65,7 +66,7 @@ Item {
}
Rectangle {
id: semiArea
id: placeAreaHolder
anchors.top: parent.top
height: parent.height - contentHeight
anchors.right: parent.right
@ -77,7 +78,7 @@ Item {
Rectangle {
id: contentArea
anchors.top: semiArea.bottom
anchors.top: placeAreaHolder.bottom
height: contentHeight
radius: 16
color: root.defaultColor
@ -112,13 +113,13 @@ Item {
onReleased: {
if (root.state === "closed" && root.y < dragArea.drag.maximumY) {
root.state = "opened"
PageController.drawerOpen()
// PageController.drawerOpen()
return
}
if (root.state === "opened" && root.y > dragArea.drag.minimumY) {
root.state = "closed"
PageController.drawerClose()
// PageController.drawerClose()
return
}
@ -134,23 +135,17 @@ Item {
onClicked: {
if (root.state === "expanded") {
// PageController.drawerOpen()
root.state = "collapsed"
return
}
if (root.state === "opened") {
// PageController.drawerClose()
root.state = "closed"
return
}
}
// onEntered: {
// fullArea.enabled = false
// }
// onExited: {
// fullArea.enabled = true
// }
}
}
}
@ -163,14 +158,23 @@ Item {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
}
PageController.drawerClose()
if (needCloseButton) {
PageController.drawerClose()
}
closed()
return
}
if (root.state === "expanded" || root.state === "opened") {
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(0xFF1C1D21)
}
PageController.drawerOpen()
if (needCloseButton) {
PageController.drawerOpen()
}
return
}
}
@ -275,31 +279,22 @@ Item {
animationVisible.running = true
if (needCloseButton) {
PageController.drawerOpen()
}
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(0xFF1C1D21)
}
}
function onClose() {
if (needCloseButton) {
PageController.drawerClose()
}
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
}
function close() {
root.visible = false
root.state = "closed"
}
onVisibleChanged: {
// e.g cancel, ......
if (!visible) {
if (root.state === "opened") {
if (needCloseButton) {
PageController.drawerClose()
}
}
close()
}
}

View file

@ -369,12 +369,12 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -183,12 +183,12 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -68,12 +68,12 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -265,12 +265,12 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -143,12 +143,12 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -152,12 +152,12 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
SettingsController.clearSettings()
PageController.replaceStartPage()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -138,13 +138,13 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.showBusyIndicator(true)
SettingsController.restoreAppConfig(filePath)
PageController.showBusyIndicator(false)
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -91,7 +91,7 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
SettingsController.primaryDns = "1.1.1.1"
primaryDns.textFieldText = SettingsController.primaryDns
SettingsController.secondaryDns = "1.0.0.1"
@ -99,7 +99,7 @@ PageType {
PageController.showNotificationMessage(qsTr("Settings have been reset"))
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -146,14 +146,14 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.showBusyIndicator(true)
SettingsController.clearLogs()
PageController.showBusyIndicator(false)
PageController.showNotificationMessage(qsTr("Logs have been cleaned up"))
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -94,13 +94,13 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.showBusyIndicator(true)
SettingsController.clearCachedProfiles()
PageController.showBusyIndicator(false)
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}
@ -172,7 +172,7 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.goToPage(PageEnum.PageDeinstalling)
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
ConnectionController.closeConnection()
@ -180,7 +180,7 @@ PageType {
InstallController.removeAllContainers()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -119,12 +119,12 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -202,11 +202,11 @@ PageType {
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
SitesController.removeSite(index)
}
questionDrawer.noButtonFunction = function() {
questionDrawer.onClose()
questionDrawer.close()
}
questionDrawer.open()
}

View file

@ -245,7 +245,7 @@ PageType {
ConnectionTypeSelectionDrawer {
id: connectionTypeSelection
onClose: function() {
onClosed: {
tabBar.setCurrentIndex(tabBar.previousIndex)
}
}