moved add new server button to main tabbar

This commit is contained in:
vladimir.kuznetsov 2023-10-09 20:19:22 +05:00
parent e01dd2bf57
commit 042788bec3
4 changed files with 33 additions and 31 deletions

View file

@ -96,7 +96,7 @@ PageType {
id: dragArea
anchors.fill: buttonBackground
cursorShape: Qt.PointingHandCursor
cursorShape: buttonContent.state === "collapsed" ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true
drag.target: buttonContent
@ -385,18 +385,7 @@ PageType {
Layout.rightMargin: 16
visible: buttonContent.expandedVisibility
actionButtonImage: "qrc:/images/controls/plus.svg"
headerText: qsTr("Servers")
actionButtonFunction: function() {
buttonContent.state = "collapsed"
connectionTypeSelection.visible = true
}
}
ConnectionTypeSelectionDrawer {
id: connectionTypeSelection
}
}

View file

@ -34,20 +34,10 @@ PageType {
Layout.leftMargin: 16
Layout.rightMargin: 16
actionButtonImage: "qrc:/images/controls/plus.svg"
headerText: qsTr("Servers")
actionButtonFunction: function() {
connectionTypeSelection.visible = true
}
}
}
ConnectionTypeSelectionDrawer {
id: connectionTypeSelection
}
FlickableType {
anchors.top: header.bottom
anchors.topMargin: 16

View file

@ -42,11 +42,7 @@ PageType {
function onInstallServerFinished(finishedMessage) {
PageController.goToStartPage()
if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageHome)) {
PageController.restorePageHomeState()
} else if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageSettings)) {
PageController.goToPage(PageEnum.PageSettingsServersList, false)
} else {
if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageSetupWizardStart)) {
PageController.replaceStartPage()
}

View file

@ -9,6 +9,7 @@ import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
@ -17,14 +18,14 @@ PageType {
target: PageController
function onGoToPageHome() {
tabBar.currentIndex = 0
tabBar.setCurrentIndex(0)
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
PageController.updateDrawerRootPage(PageEnum.PageHome)
}
function onGoToPageSettings() {
tabBar.currentIndex = 2
tabBar.setCurrentIndex(2)
tabBarStackView.goToTabBarPage(PageEnum.PageSettings)
PageController.updateDrawerRootPage(PageEnum.PageSettings)
@ -70,6 +71,7 @@ PageType {
}
function onGoToStartPage() {
connectionTypeSelection.close()
while (tabBarStackView.depth > 1) {
tabBarStackView.pop()
}
@ -120,6 +122,8 @@ PageType {
height: root.height - tabBar.implicitHeight
function goToTabBarPage(page) {
connectionTypeSelection.close()
var pagePath = PageController.getPagePath(page)
tabBarStackView.clear(StackView.Immediate)
tabBarStackView.replace(pagePath, { "objectName" : pagePath }, StackView.Immediate)
@ -137,14 +141,16 @@ PageType {
TabBar {
id: tabBar
property int previousIndex: 0
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
topPadding: 8
bottomPadding: 8
leftPadding: shareTabButton.visible ? 96 : 128
rightPadding: shareTabButton.visible ? 96 : 128
leftPadding: 96
rightPadding: 96
background: Shape {
width: parent.width
@ -171,8 +177,10 @@ PageType {
onClicked: {
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
tabBar.previousIndex = 0
}
}
TabImageButtonType {
id: shareTabButton
@ -193,13 +201,24 @@ PageType {
image: "qrc:/images/controls/share-2.svg"
onClicked: {
tabBarStackView.goToTabBarPage(PageEnum.PageShare)
tabBar.previousIndex = 1
}
}
TabImageButtonType {
isSelected: tabBar.currentIndex === 2
image: "qrc:/images/controls/settings-2.svg"
onClicked: {
tabBarStackView.goToTabBarPage(PageEnum.PageSettings)
tabBar.previousIndex = 2
}
}
TabImageButtonType {
isSelected: tabBar.currentIndex === 3
image: "qrc:/images/controls/plus.svg"
onClicked: {
connectionTypeSelection.open()
}
}
}
@ -215,4 +234,12 @@ PageType {
x: tabBarStackView.width - topCloseButton.width
z: 1
}
ConnectionTypeSelectionDrawer {
id: connectionTypeSelection
onAboutToHide: {
tabBar.setCurrentIndex(tabBar.previousIndex)
}
}
}