add focusController class

This commit is contained in:
Cyril Anisimov 2024-09-14 19:42:55 +02:00
parent 8547de82ea
commit 02bbcd3a31
76 changed files with 1906 additions and 1576 deletions

View file

@ -15,12 +15,12 @@ import "../Components"
PageType {
id: root
defaultActiveFocusItem: homeTabButton
property bool isControlsDisabled: false
property bool isTabBarDisabled: false
Connections {
objectName: "pageControllerConnection"
target: PageController
function onGoToPageHome() {
@ -91,18 +91,20 @@ PageType {
}
}
function onForceTabBarActiveFocus() {
homeTabButton.focus = true
tabBar.forceActiveFocus()
}
// function onForceTabBarActiveFocus() {
// homeTabButton.focus = true
// tabBar.forceActiveFocus()
// }
function onForceStackActiveFocus() {
homeTabButton.focus = true
tabBarStackView.forceActiveFocus()
}
// function onForceStackActiveFocus() {
// homeTabButton.focus = true
// tabBarStackView.forceActiveFocus()
// }
}
Connections {
objectName: "installControllerConnections"
target: InstallController
function onInstallationErrorOccurred(error) {
@ -165,6 +167,8 @@ PageType {
}
Connections {
objectName: "connectionControllerConnections"
target: ConnectionController
function onReconnectWithUpdatedContainer(message) {
@ -182,6 +186,8 @@ PageType {
}
Connections {
objectName: "importControllerConnections"
target: ImportController
function onImportErrorOccurred(error, goToPageHome) {
@ -196,6 +202,8 @@ PageType {
}
Connections {
objectName: "settingsControllerConnections"
target: SettingsController
function onLoggingDisableByWatcher() {
@ -218,6 +226,7 @@ PageType {
StackViewType {
id: tabBarStackView
objectName: "tabBarStackView"
anchors.top: parent.top
anchors.right: parent.right
@ -254,6 +263,7 @@ PageType {
TabBar {
id: tabBar
objectName: "tabBar"
anchors.right: parent.right
anchors.left: parent.left
@ -269,6 +279,8 @@ PageType {
enabled: !root.isControlsDisabled && !root.isTabBarDisabled
background: Shape {
objectName: "backgroundShape"
width: parent.width
height: parent.height
@ -289,21 +301,25 @@ PageType {
TabImageButtonType {
id: homeTabButton
objectName: "homeTabButton"
isSelected: tabBar.currentIndex === 0
image: "qrc:/images/controls/home.svg"
clickedFunc: function () {
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
ServersModel.processedIndex = ServersModel.defaultIndex
tabBar.currentIndex = 0
FocusController.setRootItem(null) // TODO: move to do it automaticaly
}
KeyNavigation.tab: shareTabButton
Keys.onEnterPressed: this.clicked()
Keys.onReturnPressed: this.clicked()
// KeyNavigation.tab: shareTabButton
// Keys.onEnterPressed: this.clicked()
// Keys.onReturnPressed: this.clicked()
}
TabImageButtonType {
id: shareTabButton
objectName: "shareTabButton"
Connections {
target: ServersModel
@ -325,11 +341,13 @@ PageType {
tabBar.currentIndex = 1
}
KeyNavigation.tab: settingsTabButton
// KeyNavigation.tab: settingsTabButton
}
TabImageButtonType {
id: settingsTabButton
objectName: "settingsTabButton"
isSelected: tabBar.currentIndex === 2
image: "qrc:/images/controls/settings-2.svg"
clickedFunc: function () {
@ -337,11 +355,13 @@ PageType {
tabBar.currentIndex = 2
}
KeyNavigation.tab: plusTabButton
// KeyNavigation.tab: plusTabButton
}
TabImageButtonType {
id: plusTabButton
objectName: "plusTabButton"
isSelected: tabBar.currentIndex === 3
image: "qrc:/images/controls/plus.svg"
clickedFunc: function () {
@ -349,7 +369,7 @@ PageType {
tabBar.currentIndex = 3
}
Keys.onTabPressed: PageController.forceStackActiveFocus()
// Keys.onTabPressed: PageController.forceStackActiveFocus()
}
}
}