New start page and AmneziaFree support (#865)
New start page and AmneziaFree support
This commit is contained in:
parent
01413e5a4c
commit
843156cf1b
443 changed files with 11759 additions and 2758 deletions
|
|
@ -24,8 +24,14 @@ PageType {
|
|||
target: PageController
|
||||
|
||||
function onGoToPageHome() {
|
||||
tabBar.setCurrentIndex(0)
|
||||
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
||||
if (PageController.isStartPageVisible()) {
|
||||
tabBar.visible = false
|
||||
tabBarStackView.goToTabBarPage(PageEnum.PageSetupWizardStart)
|
||||
} else {
|
||||
tabBar.visible = true
|
||||
tabBar.setCurrentIndex(0)
|
||||
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
||||
}
|
||||
}
|
||||
|
||||
function onGoToPageSettings() {
|
||||
|
|
@ -65,7 +71,6 @@ PageType {
|
|||
}
|
||||
|
||||
function onGoToStartPage() {
|
||||
connectionTypeSelection.close()
|
||||
while (tabBarStackView.depth > 1) {
|
||||
tabBarStackView.pop()
|
||||
}
|
||||
|
|
@ -78,9 +83,9 @@ PageType {
|
|||
|
||||
var pageName = tabBarStackView.currentItem.objectName
|
||||
if ((pageName === PageController.getPagePath(PageEnum.PageShare)) ||
|
||||
(pageName === PageController.getPagePath(PageEnum.PageSettings))) {
|
||||
(pageName === PageController.getPagePath(PageEnum.PageSettings)) ||
|
||||
(pageName === PageController.getPagePath(PageEnum.PageSetupWizardConfigSource))) {
|
||||
PageController.goToPageHome()
|
||||
tabBar.previousIndex = 0
|
||||
} else {
|
||||
PageController.closePage()
|
||||
}
|
||||
|
|
@ -126,6 +131,33 @@ PageType {
|
|||
function onCachedProfileCleared(message) {
|
||||
PageController.showNotificationMessage(message)
|
||||
}
|
||||
|
||||
function onApiConfigRemoved(message) {
|
||||
PageController.showNotificationMessage(message)
|
||||
}
|
||||
|
||||
function onInstallServerFromApiFinished(message) {
|
||||
PageController.showBusyIndicator(false)
|
||||
if (!ConnectionController.isConnected) {
|
||||
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
|
||||
ServersModel.processedIndex = ServersModel.defaultIndex
|
||||
}
|
||||
|
||||
PageController.goToPageHome()
|
||||
PageController.showNotificationMessage(message)
|
||||
}
|
||||
|
||||
function onChangeApiCountryFinished(message) {
|
||||
PageController.showBusyIndicator(false)
|
||||
|
||||
PageController.goToPageHome()
|
||||
PageController.showNotificationMessage(message)
|
||||
}
|
||||
|
||||
function onReloadServerFromApiFinished(message) {
|
||||
PageController.goToPageHome()
|
||||
PageController.showNotificationMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
@ -151,6 +183,12 @@ PageType {
|
|||
function onImportErrorOccurred(error, goToPageHome) {
|
||||
PageController.showErrorMessage(error)
|
||||
}
|
||||
|
||||
function onRestoreAppConfig(data) {
|
||||
PageController.showBusyIndicator(true)
|
||||
SettingsController.restoreAppConfigFromData(data)
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
@ -159,6 +197,11 @@ PageType {
|
|||
function onLoggingDisableByWatcher() {
|
||||
PageController.showNotificationMessage(qsTr("Logging was disabled after 14 days, log files were deleted"))
|
||||
}
|
||||
|
||||
function onRestoreBackupFinished() {
|
||||
PageController.showNotificationMessage(qsTr("Settings restored from backup file"))
|
||||
PageController.goToPageHome()
|
||||
}
|
||||
}
|
||||
|
||||
StackViewType {
|
||||
|
|
@ -169,31 +212,37 @@ PageType {
|
|||
anchors.left: parent.left
|
||||
anchors.bottom: tabBar.top
|
||||
|
||||
width: parent.width
|
||||
height: root.height - tabBar.implicitHeight
|
||||
|
||||
enabled: !root.isControlsDisabled
|
||||
|
||||
function goToTabBarPage(page) {
|
||||
connectionTypeSelection.close()
|
||||
|
||||
var pagePath = PageController.getPagePath(page)
|
||||
tabBarStackView.clear(StackView.Immediate)
|
||||
tabBarStackView.replace(pagePath, { "objectName" : pagePath }, StackView.Immediate)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
var pagePath = PageController.getPagePath(PageEnum.PageHome)
|
||||
ServersModel.processedIndex = ServersModel.defaultIndex
|
||||
var pagePath
|
||||
if (PageController.isStartPageVisible()) {
|
||||
tabBar.visible = false
|
||||
pagePath = PageController.getPagePath(PageEnum.PageSetupWizardStart)
|
||||
} else {
|
||||
tabBar.visible = true
|
||||
pagePath = PageController.getPagePath(PageEnum.PageHome)
|
||||
ServersModel.processedIndex = ServersModel.defaultIndex
|
||||
}
|
||||
|
||||
tabBarStackView.push(pagePath, { "objectName" : pagePath })
|
||||
}
|
||||
|
||||
Keys.onPressed: function(event) {
|
||||
PageController.keyPressEvent(event.key)
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
TabBar {
|
||||
id: tabBar
|
||||
|
||||
property int previousIndex: 0
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
|
|
@ -203,6 +252,8 @@ PageType {
|
|||
leftPadding: 96
|
||||
rightPadding: 96
|
||||
|
||||
height: visible ? homeTabButton.implicitHeight + tabBar.topPadding + tabBar.bottomPadding : 0
|
||||
|
||||
enabled: !root.isControlsDisabled && !root.isTabBarDisabled
|
||||
|
||||
background: Shape {
|
||||
|
|
@ -219,8 +270,8 @@ PageType {
|
|||
PathLine { x: 0; y: 0 }
|
||||
|
||||
strokeWidth: 1
|
||||
strokeColor: AmneziaStyle.color.greyDark
|
||||
fillColor: AmneziaStyle.color.blackLight
|
||||
strokeColor: AmneziaStyle.color.slateGray
|
||||
fillColor: AmneziaStyle.color.onyxBlack
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +283,6 @@ PageType {
|
|||
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
||||
ServersModel.processedIndex = ServersModel.defaultIndex
|
||||
tabBar.currentIndex = 0
|
||||
tabBar.previousIndex = 0
|
||||
}
|
||||
|
||||
KeyNavigation.tab: shareTabButton
|
||||
|
|
@ -261,7 +311,6 @@ PageType {
|
|||
clickedFunc: function () {
|
||||
tabBarStackView.goToTabBarPage(PageEnum.PageShare)
|
||||
tabBar.currentIndex = 1
|
||||
tabBar.previousIndex = 1
|
||||
}
|
||||
|
||||
KeyNavigation.tab: settingsTabButton
|
||||
|
|
@ -274,7 +323,6 @@ PageType {
|
|||
clickedFunc: function () {
|
||||
tabBarStackView.goToTabBarPage(PageEnum.PageSettings)
|
||||
tabBar.currentIndex = 2
|
||||
tabBar.previousIndex = 2
|
||||
}
|
||||
|
||||
KeyNavigation.tab: plusTabButton
|
||||
|
|
@ -285,19 +333,11 @@ PageType {
|
|||
isSelected: tabBar.currentIndex === 3
|
||||
image: "qrc:/images/controls/plus.svg"
|
||||
clickedFunc: function () {
|
||||
connectionTypeSelection.open()
|
||||
tabBarStackView.goToTabBarPage(PageEnum.PageSetupWizardConfigSource)
|
||||
tabBar.currentIndex = 3
|
||||
}
|
||||
|
||||
Keys.onTabPressed: PageController.forceStackActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionTypeSelectionDrawer {
|
||||
id: connectionTypeSelection
|
||||
|
||||
onAboutToHide: {
|
||||
PageController.forceTabBarActiveFocus()
|
||||
tabBar.setCurrentIndex(tabBar.previousIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue