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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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