added PageLoader and pageController
This commit is contained in:
parent
116fa6777b
commit
03a0e2084a
27 changed files with 265 additions and 193 deletions
|
|
@ -22,83 +22,14 @@ Window {
|
|||
|
||||
title: "AmneziaVPN"
|
||||
|
||||
function gotoPage(page, reset, slide) {
|
||||
if (pageStackView.depth > 0) {
|
||||
pageStackView.currentItem.deactivated()
|
||||
}
|
||||
|
||||
if (slide) {
|
||||
pageStackView.push(UiLogic.pageEnumToString(page), {}, StackView.PushTransition)
|
||||
} else {
|
||||
pageStackView.push(UiLogic.pageEnumToString(page), {}, StackView.Immediate)
|
||||
}
|
||||
|
||||
pageStackView.currentItem.activated(reset)
|
||||
}
|
||||
|
||||
function closePage() {
|
||||
if (pageStackView.depth <= 1) {
|
||||
return
|
||||
}
|
||||
pageStackView.currentItem.deactivated()
|
||||
pageStackView.pop()
|
||||
}
|
||||
|
||||
function setStartPage(page, slide) {
|
||||
if (pageStackView.depth > 0) {
|
||||
pageStackView.currentItem.deactivated()
|
||||
}
|
||||
|
||||
pageStackView.clear()
|
||||
if (slide) {
|
||||
pageStackView.push(UiLogic.pageEnumToString(page), {}, StackView.PushTransition)
|
||||
} else {
|
||||
pageStackView.push(UiLogic.pageEnumToString(page), {}, StackView.Immediate)
|
||||
}
|
||||
if (page === PageEnum.Start) {
|
||||
UiLogic.pushButtonBackFromStartVisible = !pageStackView.empty
|
||||
UiLogic.onUpdatePage();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "#0E0E11"
|
||||
}
|
||||
|
||||
StackView {
|
||||
id: pageStackView
|
||||
PageLoader {
|
||||
id: pageLoader
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: UiLogic
|
||||
function onGoToPage(page, reset, slide) {
|
||||
root.gotoPage(page, reset, slide)
|
||||
}
|
||||
|
||||
function onClosePage() {
|
||||
root.closePage()
|
||||
}
|
||||
|
||||
function onSetStartPage(page, slide) {
|
||||
root.setStartPage(page, slide)
|
||||
}
|
||||
|
||||
function onShow() {
|
||||
root.show()
|
||||
UiLogic.initializeUiLogic()
|
||||
}
|
||||
|
||||
function onHide() {
|
||||
root.hide()
|
||||
}
|
||||
|
||||
function onRaise() {
|
||||
root.show()
|
||||
root.raise()
|
||||
root.requestActivate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue