bugfix: ui fixes after merge with android tab navigation branch (#1339)

* bugfix: ui fixes after merge with android tab navigation branch

* bugfix: fix crash on quit

* chore: fix typos

* chore: remove useless comment

* bugfix: fix trigger behavior for `ListViewWithRadioButtonType`

* bugfix: fixed dropdown listview scrolling

* bugfix: fixed amfree availability display

* chore: remove item existence check in triggerCurrentItem function

---------

Co-authored-by: Cyril Anisimov <CyAn84@gmail.com>
This commit is contained in:
Nethius 2025-01-08 09:12:55 +03:00 committed by GitHub
parent 767b14b37a
commit 62f3a339b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 63 additions and 112 deletions

View file

@ -266,11 +266,11 @@ PageType {
objectName: "rowLayoutLabel"
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.topMargin: 8
Layout.bottomMargin: drawer.isCollapsed ? 44 : ServersModel.isDefaultServerFromApi ? 61 : 16
Layout.bottomMargin: drawer.isCollapsedStateActive ? 44 : ServersModel.isDefaultServerFromApi ? 61 : 16
spacing: 0
BasicButtonType {
enabled: (ServersModel.defaultServerImagePathCollapsed !== "") && drawer.isCollapsed
enabled: (ServersModel.defaultServerImagePathCollapsed !== "") && drawer.isCollapsedStateActive
hoverEnabled: enabled
implicitHeight: 36
@ -288,8 +288,9 @@ PageType {
buttonTextLabel.font.pixelSize: 13
buttonTextLabel.font.weight: 400
text: drawer.isCollapsed ? ServersModel.defaultServerDescriptionCollapsed : ServersModel.defaultServerDescriptionExpanded
text: drawer.isCollapsedStateActive ? ServersModel.defaultServerDescriptionCollapsed : ServersModel.defaultServerDescriptionExpanded
leftImageSource: ServersModel.defaultServerImagePathCollapsed
leftImageColor: ""
changeLeftImageSize: false
rightImageSource: hoverEnabled ? "qrc:/images/controls/chevron-down.svg" : ""
@ -347,7 +348,6 @@ PageType {
objectName: "containersListView"
rootWidth: root.width
height: 500 // TODO: make calculated
Connections {
objectName: "rowLayoutConnections"

View file

@ -36,13 +36,13 @@ PageType {
ListView {
id: listview
property bool isFocusable: true
anchors.top: backButtonLayout.bottom
anchors.bottom: parent.bottom
width: parent.width
property bool isFocusable: true
Keys.onTabPressed: {
FocusController.nextKeyTabItem()
}
@ -138,26 +138,6 @@ PageType {
checkEmptyText: true
}
TextFieldWithHeaderType {
id: mtuTextField
Layout.fillWidth: true
Layout.topMargin: 16
headerText: qsTr("MTU")
textFieldText: mtu
textField.validator: IntValidator { bottom: 576; top: 65535 }
textField.onEditingFinished: {
if (textFieldText === "") {
textFieldText = "0"
}
if (textFieldText !== mtu) {
mtu = textFieldText
}
}
checkEmptyText: true
}
TextFieldWithHeaderType {
id: junkPacketCountTextField
Layout.fillWidth: true

View file

@ -176,7 +176,6 @@ PageType {
headerText: qsTr("Hash")
drawerParent: root
parentFlickable: fl
listView: ListViewWithRadioButtonType {
id: hashListView
@ -225,7 +224,6 @@ PageType {
headerText: qsTr("Cipher")
drawerParent: root
parentFlickable: fl
listView: ListViewWithRadioButtonType {
id: cipherListView

View file

@ -16,8 +16,6 @@ import "../Components"
PageType {
id: root
//defaultActiveFocusItem: listview.currentItem.mtuTextField.textField
Item {
id: focusItem
onFocusChanged: {

View file

@ -122,26 +122,6 @@ PageType {
checkEmptyText: true
}
TextFieldWithHeaderType {
id: mtuTextField
Layout.fillWidth: true
Layout.topMargin: 16
headerText: qsTr("MTU")
textFieldText: mtu
textField.validator: IntValidator { bottom: 576; top: 65535 }
textField.onEditingFinished: {
if (textFieldText === "") {
textFieldText = "0"
}
if (textFieldText !== mtu) {
mtu = textFieldText
}
}
checkEmptyText: true
}
BasicButtonType {
id: saveButton
Layout.fillWidth: true

View file

@ -18,13 +18,13 @@ PageType {
ListView {
id: menuContent
property var selectedText
property bool isFocusable: true
width: parent.width
height: menuContent.contentItem.height
height: parent.height
clip: true
interactive: false
interactive: true
model: ApiCountryModel
ButtonGroup {
@ -34,8 +34,8 @@ PageType {
delegate: ColumnLayout {
id: content
implicitWidth: parent.width
implicitHeight: content.implicitHeight
width: menuContent.width
height: content.implicitHeight
RowLayout {
VerticalRadioButton {

View file

@ -221,15 +221,8 @@ PageType {
SettingsController.clearSettings()
PageController.goToPageHome()
}
if (!GC.isMobile()) {
// root.defaultActiveFocusItem.forceActiveFocus()
}
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
// root.defaultActiveFocusItem.forceActiveFocus()
}
}
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)

View file

@ -109,15 +109,8 @@ PageType {
SettingsController.secondaryDns = "1.0.0.1"
secondaryDns.textFieldText = SettingsController.secondaryDns
PageController.showNotificationMessage(qsTr("Settings have been reset"))
if (!GC.isMobile()) {
// defaultActiveFocusItem.forceActiveFocus()
}
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
// defaultActiveFocusItem.forceActiveFocus()
}
}
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)

View file

@ -355,6 +355,7 @@ PageType {
serverSelectorListView.selectedIndex = 0
}
serverSelectorListView.positionViewAtIndex(selectedIndex, ListView.Beginning)
serverSelectorListView.triggerCurrentItem()
}
@ -410,6 +411,7 @@ PageType {
function onSeverSelectorIndexChanged() {
var defaultContainer = proxyContainersModel.mapFromSource(ServersModel.getProcessedServerData("defaultContainer"))
protocolSelectorListView.selectedIndex = defaultContainer
protocolSelectorListView.positionViewAtIndex(selectedIndex, ListView.Beginning)
protocolSelectorListView.triggerCurrentItem()
}
}
@ -603,6 +605,7 @@ PageType {
}
clip: true
interactive: false
reuseItems: true
delegate: Item {
@ -667,7 +670,11 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: creationDate
Layout.fillWidth: true
Layout.maximumWidth: parent.width
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Qt.ElideRight
text: qsTr("Creation date: %1").arg(creationDate)
}
@ -675,7 +682,11 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: latestHandshake
Layout.fillWidth: true
Layout.maximumWidth: parent.width
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Qt.ElideRight
text: qsTr("Latest handshake: %1").arg(latestHandshake)
}
@ -683,7 +694,11 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: dataReceived
Layout.fillWidth: true
Layout.maximumWidth: parent.width
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Qt.ElideRight
text: qsTr("Data received: %1").arg(dataReceived)
}
@ -691,7 +706,11 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: dataSent
Layout.fillWidth: true
Layout.maximumWidth: parent.width
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Qt.ElideRight
text: qsTr("Data sent: %1").arg(dataSent)
}
@ -699,7 +718,9 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: allowedIps
Layout.fillWidth: true
Layout.maximumWidth: parent.width
wrapMode: Text.Wrap
text: qsTr("Allowed IPs: %1").arg(allowedIps)
}