added swipe up for menu on PageHome

This commit is contained in:
vladimir.kuznetsov 2023-09-06 13:37:37 +05:00
parent 7fc4ea0c68
commit 4ab006f065
28 changed files with 90 additions and 85 deletions

View file

@ -79,6 +79,8 @@ public slots:
void showOnStartup();
signals:
void goToPage(PageLoader::PageEnum page, bool slide = true);
void goToStartPage();
void goToPageHome();
void goToPageSettings();
void goToPageViewConfig();

View file

@ -41,7 +41,7 @@ DrawerType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSetupWizardCredentials)
PageController.goToPage(PageEnum.PageSetupWizardCredentials)
root.visible = false
}
}
@ -55,7 +55,7 @@ DrawerType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSetupWizardConfigSource)
PageController.goToPage(PageEnum.PageSetupWizardConfigSource)
root.visible = false
}
}

View file

@ -67,7 +67,7 @@ ListView {
} else {
ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(index))
InstallController.setShouldCreateServer(false)
goToPage(PageEnum.PageSetupWizardProtocolSettings)
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
containersDropDown.menuVisible = false
menu.visible = false
}

View file

@ -45,44 +45,44 @@ ListView {
if (config[ContainerProps.containerTypeToString(containerIndex)]["isThirdPartyConfig"]) {
ProtocolsModel.updateModel(config)
goToPage(PageEnum.PageProtocolRaw)
PageController.goToPage(PageEnum.PageProtocolRaw)
return
}
switch (containerIndex) {
case ContainerEnum.OpenVpn: {
OpenVpnConfigModel.updateModel(config)
goToPage(PageEnum.PageProtocolOpenVpnSettings)
PageController.goToPage(PageEnum.PageProtocolOpenVpnSettings)
break
}
case ContainerEnum.WireGuard: {
ProtocolsModel.updateModel(config)
goToPage(PageEnum.PageProtocolRaw)
PageController.goToPage(PageEnum.PageProtocolRaw)
// WireGuardConfigModel.updateModel(config)
// goToPage(PageEnum.PageProtocolWireGuardSettings)
break
}
case ContainerEnum.Ipsec: {
ProtocolsModel.updateModel(config)
goToPage(PageEnum.PageProtocolRaw)
PageController.goToPage(PageEnum.PageProtocolRaw)
// Ikev2ConfigModel.updateModel(config)
// goToPage(PageEnum.PageProtocolIKev2Settings)
break
}
case ContainerEnum.Sftp: {
SftpConfigModel.updateModel(config)
goToPage(PageEnum.PageServiceSftpSettings)
PageController.goToPage(PageEnum.PageServiceSftpSettings)
break
}
case ContainerEnum.TorWebSite: {
goToPage(PageEnum.PageServiceTorWebsiteSettings)
PageController.goToPage(PageEnum.PageServiceTorWebsiteSettings)
break
}
default: {
if (serviceType !== ProtocolEnum.Other) { //todo disable settings for dns container
ProtocolsModel.updateModel(config)
goToPage(PageEnum.PageSettingsServerProtocol)
PageController.goToPage(PageEnum.PageSettingsServerProtocol)
}
}
}
@ -90,7 +90,7 @@ ListView {
} else {
ContainersModel.setCurrentlyProcessedContainerIndex(root.model.mapToSource(index))
InstallController.setShouldCreateServer(false)
goToPage(PageEnum.PageSetupWizardProtocolSettings)
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
}
}

View file

@ -27,7 +27,7 @@ Item {
if (backButtonFunction && typeof backButtonFunction === "function") {
backButtonFunction()
} else {
closePage()
PageController.closePage()
}
}
}

View file

@ -6,6 +6,7 @@ Drawer {
clip: true
modal: true
dragMargin: -10
enter: Transition {
SmoothedAnimation {

View file

@ -7,35 +7,15 @@ Item {
property StackView stackView: StackView.view
function goToPage(page, slide = true) {
var pagePath = PageController.getPagePath(page)
if (slide) {
root.stackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition)
} else {
root.stackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate)
}
}
function closePage() {
if (root.stackView.depth <= 1) {
return
}
root.stackView.pop()
}
function goToStartPage() {
while (root.stackView.depth > 1) {
root.stackView.pop()
}
}
MouseArea {
z: -1
z: 99
anchors.fill: parent
onClicked: {
console.log("base mouse area pressed")
focus = true
enabled: true
onPressed: function(mouse) {
forceActiveFocus()
mouse.accepted = false
}
}
}

View file

@ -26,11 +26,15 @@ PageType {
property string defaultServerHostName: ServersModel.defaultServerHostName
property string defaultContainerName: ContainersModel.defaultContainerName
ConnectButton {
Item {
anchors.top: parent.top
anchors.bottom: buttonBackground.top
anchors.right: parent.right
anchors.left: parent.left
ConnectButton {
anchors.centerIn: parent
}
}
Connections {
@ -125,6 +129,9 @@ PageType {
DrawerType {
id: menu
interactive: true
dragMargin: buttonBackground.height + 56 // page start tabBar height
width: parent.width
height: parent.height * 0.9
@ -320,7 +327,7 @@ PageType {
onClicked: function() {
ServersModel.currentlyProcessedIndex = index
goToPage(PageEnum.PageSettingsServerInfo)
PageController.goToPage(PageEnum.PageSettingsServerInfo)
menu.visible = false
}
}

View file

@ -368,7 +368,7 @@ PageType {
questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false
goToPage(PageEnum.PageDeinstalling)
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {

View file

@ -180,7 +180,7 @@ PageType {
questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false
goToPage(PageEnum.PageDeinstalling)
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {

View file

@ -259,7 +259,7 @@ PageType {
questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false
goToPage(PageEnum.PageDeinstalling)
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {

View file

@ -144,7 +144,7 @@ PageType {
questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false
goToPage(PageEnum.PageDeinstalling)
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {

View file

@ -46,7 +46,7 @@ PageType {
leftImageSource: "qrc:/images/controls/server.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSettingsServersList)
PageController.goToPage(PageEnum.PageSettingsServersList)
}
}
@ -60,7 +60,7 @@ PageType {
leftImageSource: "qrc:/images/controls/radio.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSettingsConnection)
PageController.goToPage(PageEnum.PageSettingsConnection)
}
}
@ -74,7 +74,7 @@ PageType {
leftImageSource: "qrc:/images/controls/app.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSettingsApplication)
PageController.goToPage(PageEnum.PageSettingsApplication)
}
}
@ -88,7 +88,7 @@ PageType {
leftImageSource: "qrc:/images/controls/save.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSettingsBackup)
PageController.goToPage(PageEnum.PageSettingsBackup)
}
}
@ -102,7 +102,7 @@ PageType {
leftImageSource: "qrc:/images/controls/amnezia.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSettingsAbout)
PageController.goToPage(PageEnum.PageSettingsAbout)
}
}

View file

@ -112,7 +112,7 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSettingsLogging)
PageController.goToPage(PageEnum.PageSettingsLogging)
}
}

View file

@ -86,7 +86,7 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSettingsDns)
PageController.goToPage(PageEnum.PageSettingsDns)
}
}
@ -100,7 +100,7 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSettingsSplitTunneling)
PageController.goToPage(PageEnum.PageSettingsSplitTunneling)
}
}

View file

@ -32,20 +32,20 @@ PageType {
if (!ServersModel.getServersCount()) {
PageController.replaceStartPage()
} else {
goToStartPage()
goToPage(PageEnum.PageSettingsServersList)
PageController.goToStartPage()
PageController.goToPage(PageEnum.PageSettingsServersList)
}
PageController.showNotificationMessage(finishedMessage)
}
function onRemoveAllContainersFinished(finishedMessage) {
closePage() // close deInstalling page
PageController.closePage() // close deInstalling page
PageController.showNotificationMessage(finishedMessage)
}
function onRemoveCurrentlyProcessedContainerFinished(finishedMessage) {
closePage() // close deInstalling page
closePage() // close page with remove button
PageController.closePage() // close deInstalling page
PageController.closePage() // close page with remove button
PageController.showNotificationMessage(finishedMessage)
}
}
@ -173,7 +173,7 @@ PageType {
questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false
goToPage(PageEnum.PageDeinstalling)
PageController.goToPage(PageEnum.PageDeinstalling)
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
ConnectionController.closeConnection()
}

View file

@ -87,7 +87,7 @@ PageType {
case ProtocolEnum.WireGuard: WireGuardConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.Ipsec: Ikev2ConfigModel.updateModel(ProtocolsModel.getConfig()); break;
}
goToPage(protocolPage);
PageController.goToPage(protocolPage);
}
MouseArea {
@ -120,7 +120,7 @@ PageType {
questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false
goToPage(PageEnum.PageDeinstalling)
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {

View file

@ -98,7 +98,7 @@ PageType {
clickedFunction: function() {
ServersModel.currentlyProcessedIndex = index
goToPage(PageEnum.PageSettingsServerInfo)
PageController.goToPage(PageEnum.PageSettingsServerInfo)
}
}

View file

@ -17,8 +17,8 @@ PageType {
target: ImportController
function onQrDecodingFinished() {
closePage()
goToPage(PageEnum.PageSetupWizardViewConfig)
PageController.closePage()
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
}
}
@ -84,7 +84,7 @@ It's okay as long as it's from someone you trust.")
PageController.showBusyIndicator(false)
} else {
ImportController.extractConfigFromFile(fileDialog.selectedFile.toString())
goToPage(PageEnum.PageSetupWizardViewConfig)
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
}
}
}
@ -103,7 +103,7 @@ It's okay as long as it's from someone you trust.")
clickedFunction: function() {
ImportController.startDecodingQr()
if (Qt.platform.os === "ios") {
goToPage(PageEnum.PageSetupWizardQrReader)
PageController.goToPage(PageEnum.PageSetupWizardQrReader)
}
}
}
@ -120,7 +120,7 @@ It's okay as long as it's from someone you trust.")
leftImageSource: "qrc:/images/controls/text-cursor.svg"
clickedFunction: function() {
goToPage(PageEnum.PageSetupWizardTextKey)
PageController.goToPage(PageEnum.PageSetupWizardTextKey)
}
}

View file

@ -104,7 +104,7 @@ PageType {
return
}
goToPage(PageEnum.PageSetupWizardEasy)
PageController.goToPage(PageEnum.PageSetupWizardEasy)
}
}
}

View file

@ -159,12 +159,12 @@ PageType {
onClicked: function() {
if (root.isEasySetup) {
ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer)
goToPage(PageEnum.PageSetupWizardInstalling)
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.install(containers.dockerContainer,
containers.containerDefaultPort,
containers.containerDefaultTransportProto)
} else {
goToPage(PageEnum.PageSetupWizardProtocols)
PageController.goToPage(PageEnum.PageSetupWizardProtocols)
}
}
}
@ -186,7 +186,7 @@ PageType {
text: qsTr("Set up later")
onClicked: function() {
goToPage(PageEnum.PageSetupWizardInstalling)
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.addEmptyServer()
}
}

View file

@ -24,28 +24,28 @@ PageType {
target: InstallController
function onInstallContainerFinished(finishedMessage, isServiceInstall) {
goToStartPage()
PageController.goToStartPage()
if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageHome)) {
PageController.restorePageHomeState(true)
} else if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageSettings)) {
goToPage(PageEnum.PageSettingsServersList, false)
goToPage(PageEnum.PageSettingsServerInfo, false)
PageController.goToPage(PageEnum.PageSettingsServersList, false)
PageController.goToPage(PageEnum.PageSettingsServerInfo, false)
if (isServiceInstall) {
PageController.goToPageSettingsServerServices()
}
} else {
goToPage(PageEnum.PageHome)
PageController.goToPage(PageEnum.PageHome)
}
PageController.showNotificationMessage(finishedMessage)
}
function onInstallServerFinished(finishedMessage) {
goToStartPage()
PageController.goToStartPage()
if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageHome)) {
PageController.restorePageHomeState()
} else if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageSettings)) {
goToPage(PageEnum.PageSettingsServersList, false)
PageController.goToPage(PageEnum.PageSettingsServersList, false)
} else {
PageController.replaceStartPage()
}
@ -54,9 +54,9 @@ PageType {
}
function onServerAlreadyExists(serverIndex) {
goToStartPage()
PageController.goToStartPage()
ServersModel.currentlyProcessedIndex = serverIndex
goToPage(PageEnum.PageSettingsServerInfo, false)
PageController.goToPage(PageEnum.PageSettingsServerInfo, false)
PageController.showErrorMessage(qsTr("The server has already been added to the application"))
}

View file

@ -229,7 +229,7 @@ PageType {
text: qsTr("Install")
onClicked: function() {
goToPage(PageEnum.PageSetupWizardInstalling);
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(dockerContainer, port.textFieldText, transportProtoSelector.currentIndex)
}
}

View file

@ -105,7 +105,7 @@ PageType {
clickedFunction: function() {
ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(index))
goToPage(PageEnum.PageSetupWizardProtocolSettings)
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
}
}

View file

@ -17,7 +17,7 @@ PageType {
target: PageController
function onGoToPageViewConfig() {
goToPage(PageEnum.PageSetupWizardViewConfig)
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
}
function onShowBusyIndicator(visible) {

View file

@ -72,7 +72,7 @@ PageType {
onClicked: function() {
ImportController.extractConfigFromCode(textKey.textFieldText)
goToPage(PageEnum.PageSetupWizardViewConfig)
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
}
}
}

View file

@ -19,16 +19,16 @@ PageType {
target: ImportController
function onImportErrorOccurred(errorMessage) {
closePage()
PageController.closePage()
PageController.showErrorMessage(errorMessage)
}
function onImportFinished() {
goToStartPage()
PageController.goToStartPage()
if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageHome)) {
PageController.restorePageHomeState()
} else if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageSettings)) {
goToPage(PageEnum.PageSettingsServersList, false)
PageController.goToPage(PageEnum.PageSettingsServersList, false)
} else {
PageController.replaceStartPage()
}

View file

@ -47,6 +47,21 @@ PageType {
}
tabBarStackView.pop()
}
function onGoToPage(page, slide) {
var pagePath = PageController.getPagePath(page)
if (slide) {
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition)
} else {
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate)
}
}
function onGoToStartPage() {
while (tabBarStackView.depth > 1) {
tabBarStackView.pop()
}
}
}
Connections {