Added tab navigation functional. (#721)
- Added tab navigation functional. - In basic types added parentFlickable property, which will help to ensure, that the item is visible within flickable parent during tab navigation. - Added focus state for some basic types. - In PageType qml file added lastItemTabClicked function, which will help to focus tab bar buttons when the last tab on the current page clicked. - Added Focus for back button for all pages and drawers. - Added scroll on tab for Servers ListView on PageHome.
This commit is contained in:
parent
d50e7dd3f4
commit
0e4ae26bae
66 changed files with 2269 additions and 143 deletions
|
@ -18,8 +18,18 @@ PageType {
|
|||
|
||||
defaultActiveFocusItem: listview.currentItem.portTextField.textField
|
||||
|
||||
Item {
|
||||
id: focusItem
|
||||
onFocusChanged: {
|
||||
if (activeFocus) {
|
||||
fl.ensureVisible(focusItem)
|
||||
}
|
||||
}
|
||||
KeyNavigation.tab: backButton
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: backButton
|
||||
id: backButtonLayout
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
|
@ -28,12 +38,14 @@ PageType {
|
|||
anchors.topMargin: 20
|
||||
|
||||
BackButtonType {
|
||||
id: backButton
|
||||
KeyNavigation.tab: listview.currentItem.portTextField.textField
|
||||
}
|
||||
}
|
||||
|
||||
FlickableType {
|
||||
id: fl
|
||||
anchors.top: backButton.bottom
|
||||
anchors.top: backButtonLayout.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
contentHeight: content.implicitHeight
|
||||
|
||||
|
@ -47,8 +59,6 @@ PageType {
|
|||
enabled: ServersModel.isProcessedServerHasWriteAccess()
|
||||
|
||||
ListView {
|
||||
|
||||
|
||||
id: listview
|
||||
|
||||
width: parent.width
|
||||
|
@ -94,6 +104,7 @@ PageType {
|
|||
textFieldText: port
|
||||
textField.maximumLength: 5
|
||||
textField.validator: IntValidator { bottom: 1; top: 65535 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText !== port) {
|
||||
|
@ -103,7 +114,7 @@ PageType {
|
|||
|
||||
checkEmptyText: true
|
||||
|
||||
KeyNavigation.tab: junkPacketCountTextField.textField
|
||||
KeyNavigation.tab: mtuTextField.textField
|
||||
}
|
||||
|
||||
TextFieldWithHeaderType {
|
||||
|
@ -124,6 +135,7 @@ PageType {
|
|||
}
|
||||
}
|
||||
checkEmptyText: true
|
||||
KeyNavigation.tab: junkPacketCountTextField.textField
|
||||
}
|
||||
|
||||
TextFieldWithHeaderType {
|
||||
|
@ -134,6 +146,7 @@ PageType {
|
|||
headerText: "Jc - Junk packet count"
|
||||
textFieldText: junkPacketCount
|
||||
textField.validator: IntValidator { bottom: 0 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText === "") {
|
||||
|
@ -158,6 +171,7 @@ PageType {
|
|||
headerText: "Jmin - Junk packet minimum size"
|
||||
textFieldText: junkPacketMinSize
|
||||
textField.validator: IntValidator { bottom: 0 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText !== junkPacketMinSize) {
|
||||
|
@ -178,6 +192,7 @@ PageType {
|
|||
headerText: "Jmax - Junk packet maximum size"
|
||||
textFieldText: junkPacketMaxSize
|
||||
textField.validator: IntValidator { bottom: 0 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText !== junkPacketMaxSize) {
|
||||
|
@ -198,6 +213,7 @@ PageType {
|
|||
headerText: "S1 - Init packet junk size"
|
||||
textFieldText: initPacketJunkSize
|
||||
textField.validator: IntValidator { bottom: 0 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText !== initPacketJunkSize) {
|
||||
|
@ -218,6 +234,7 @@ PageType {
|
|||
headerText: "S2 - Response packet junk size"
|
||||
textFieldText: responsePacketJunkSize
|
||||
textField.validator: IntValidator { bottom: 0 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText !== responsePacketJunkSize) {
|
||||
|
@ -238,6 +255,7 @@ PageType {
|
|||
headerText: "H1 - Init packet magic header"
|
||||
textFieldText: initPacketMagicHeader
|
||||
textField.validator: IntValidator { bottom: 0 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText !== initPacketMagicHeader) {
|
||||
|
@ -258,6 +276,7 @@ PageType {
|
|||
headerText: "H2 - Response packet magic header"
|
||||
textFieldText: responsePacketMagicHeader
|
||||
textField.validator: IntValidator { bottom: 0 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText !== responsePacketMagicHeader) {
|
||||
|
@ -278,6 +297,7 @@ PageType {
|
|||
headerText: "H4 - Transport packet magic header"
|
||||
textFieldText: transportPacketMagicHeader
|
||||
textField.validator: IntValidator { bottom: 0 }
|
||||
parentFlickable: fl
|
||||
|
||||
textField.onEditingFinished: {
|
||||
if (textFieldText !== transportPacketMagicHeader) {
|
||||
|
@ -294,6 +314,7 @@ PageType {
|
|||
id: underloadPacketMagicHeaderTextField
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 16
|
||||
parentFlickable: fl
|
||||
|
||||
headerText: "H3 - Underload packet magic header"
|
||||
textFieldText: underloadPacketMagicHeader
|
||||
|
@ -312,6 +333,7 @@ PageType {
|
|||
|
||||
BasicButtonType {
|
||||
id: saveRestartButton
|
||||
parentFlickable: fl
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 24
|
||||
|
@ -330,7 +352,9 @@ PageType {
|
|||
|
||||
text: qsTr("Save")
|
||||
|
||||
onClicked: {
|
||||
Keys.onTabPressed: lastItemTabClicked(focusItem)
|
||||
|
||||
clickedFunc: function() {
|
||||
if (AwgConfigModel.isHeadersEqual(underloadPacketMagicHeaderTextField.textField.text,
|
||||
transportPacketMagicHeaderTextField.textField.text,
|
||||
responsePacketMagicHeaderTextField.textField.text,
|
||||
|
@ -362,6 +386,9 @@ PageType {
|
|||
InstallController.updateContainer(AwgConfigModel.getConfig())
|
||||
}
|
||||
var noButtonFunction = function() {
|
||||
if (!GC.isMobile()) {
|
||||
saveRestartButton.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue