Refactor: Replace HeaderType with new Types for headers in QML pages

This commit is contained in:
aiamnezia 2025-02-24 19:45:50 +04:00
parent 13127cd64c
commit 1c2b1f1e0f
43 changed files with 68 additions and 86 deletions

View file

@ -56,7 +56,7 @@ PageType {
anchors.rightMargin: 16 anchors.rightMargin: 16
anchors.leftMargin: 16 anchors.leftMargin: 16
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20

View file

@ -39,7 +39,7 @@ PageType {
header: ColumnLayout { header: ColumnLayout {
width: listView.width width: listView.width
HeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -91,7 +91,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("AmneziaWG settings") headerText: qsTr("AmneziaWG settings")

View file

@ -91,7 +91,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("AmneziaWG settings") headerText: qsTr("AmneziaWG settings")

View file

@ -76,7 +76,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Cloak settings") headerText: qsTr("Cloak settings")

View file

@ -75,7 +75,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("OpenVPN settings") headerText: qsTr("OpenVPN settings")

View file

@ -32,7 +32,7 @@ PageType {
id: backButton id: backButton
} }
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -78,7 +78,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Shadowsocks settings") headerText: qsTr("Shadowsocks settings")

View file

@ -85,7 +85,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("WG settings") headerText: qsTr("WG settings")

View file

@ -77,7 +77,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("WG settings") headerText: qsTr("WG settings")
} }

View file

@ -75,7 +75,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("XRay settings") headerText: qsTr("XRay settings")
} }

View file

@ -43,7 +43,7 @@ PageType {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
HeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -85,7 +85,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -77,7 +77,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16
@ -217,7 +217,7 @@ PageType {
} }
} }
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("SOCKS5 settings") headerText: qsTr("SOCKS5 settings")

View file

@ -54,7 +54,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -29,7 +29,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24

View file

@ -69,7 +69,7 @@ PageType {
Layout.topMargin: 20 Layout.topMargin: 20
} }
HeaderType { HeaderTypeWithButton {
id: headerContent id: headerContent
objectName: "headerContent" objectName: "headerContent"

View file

@ -91,7 +91,7 @@ PageType {
id: backButton id: backButton
} }
HeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -38,7 +38,7 @@ PageType {
id: backButton id: backButton
} }
HeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -93,7 +93,7 @@ PageType {
Layout.topMargin: 20 Layout.topMargin: 20
} }
HeaderType { HeaderTypeWithButton {
id: headerContent id: headerContent
objectName: "headerContent" objectName: "headerContent"

View file

@ -30,7 +30,7 @@ PageType {
} }
HeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -79,29 +79,22 @@ PageType {
id: backButton id: backButton
} }
RowLayout { HeaderTypeWithSwitcher {
HeaderType { Layout.fillWidth: true
Layout.fillWidth: true Layout.leftMargin: 16
Layout.leftMargin: 16 Layout.rightMargin: 16
headerText: qsTr("App split tunneling") headerText: qsTr("App split tunneling")
enabled: root.pageEnabled
showSwitcher: true
switcher {
checked: AppSplitTunnelingModel.isTunnelingEnabled
enabled: root.pageEnabled enabled: root.pageEnabled
} }
switcherFunction: function(checked) {
SwitcherType { AppSplitTunnelingModel.toggleSplitTunneling(checked)
id: switcher selector.text = root.routeModesModel[getRouteModesModelIndex()].name
Layout.fillWidth: true
Layout.rightMargin: 16
enabled: root.pageEnabled
checked: AppSplitTunnelingModel.isTunnelingEnabled
onToggled: {
AppSplitTunnelingModel.toggleSplitTunneling(checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
}
} }
} }

View file

@ -38,7 +38,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -60,7 +60,7 @@ PageType {
spacing: 16 spacing: 16
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Back up your configuration") headerText: qsTr("Back up your configuration")

View file

@ -36,7 +36,7 @@ PageType {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -50,7 +50,7 @@ PageType {
spacing: 16 spacing: 16
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("DNS servers") headerText: qsTr("DNS servers")

View file

@ -40,7 +40,7 @@ PageType {
header: ColumnLayout { header: ColumnLayout {
width: listView.width width: listView.width
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -71,7 +71,7 @@ PageType {
objectName: "backButton" objectName: "backButton"
} }
HeaderType { HeaderTypeWithButton {
id: headerContent id: headerContent
objectName: "headerContent" objectName: "headerContent"

View file

@ -34,7 +34,7 @@ PageType {
id: backButton id: backButton
} }
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -31,7 +31,7 @@ PageType {
id: backButton id: backButton
} }
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -94,33 +94,22 @@ PageType {
id: backButton id: backButton
} }
RowLayout { HeaderTypeWithSwitcher {
HeaderType { Layout.fillWidth: true
enabled: root.pageEnabled Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.fillWidth: true headerText: qsTr("Split tunneling")
Layout.leftMargin: 16
headerText: qsTr("Split tunneling")
}
SwitcherType {
id: switcher
enabled: root.pageEnabled
Layout.fillWidth: true
Layout.rightMargin: 16
function onToggledFunc() {
SitesModel.toggleSplitTunneling(this.checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
}
enabled: root.pageEnabled
showSwitcher: true
switcher {
checked: SitesModel.isTunnelingEnabled checked: SitesModel.isTunnelingEnabled
onToggled: { onToggledFunc() } enabled: root.pageEnabled
Keys.onEnterPressed: { onToggledFunc() } }
Keys.onReturnPressed: { onToggledFunc() } switcherFunction: function(checked) {
SitesModel.toggleSplitTunneling(checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
} }
} }

View file

@ -35,7 +35,7 @@ PageType {
Layout.topMargin: 20 Layout.topMargin: 20
} }
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 8 Layout.topMargin: 8
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -28,7 +28,7 @@ PageType {
Layout.topMargin: 20 Layout.topMargin: 20
} }
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 8 Layout.topMargin: 8
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -43,7 +43,7 @@ PageType {
header: ColumnLayout { header: ColumnLayout {
width: listView.width width: listView.width
HeaderType { HeaderTypeWithButton {
id: moreButton id: moreButton
property bool isVisible: SettingsController.getInstallationUuid() !== "" || PageController.isStartPageVisible() property bool isVisible: SettingsController.getInstallationUuid() !== "" || PageController.isStartPageVisible()
@ -74,7 +74,7 @@ PageType {
anchors.right: parent.right anchors.right: parent.right
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
Layout.leftMargin: 16 Layout.leftMargin: 16

View file

@ -66,7 +66,7 @@ PageType {
header: ColumnLayout { header: ColumnLayout {
width: listView.width width: listView.width
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16

View file

@ -59,7 +59,7 @@ PageType {
spacing: 16 spacing: 16
HeaderType { BaseHeaderType {
id: header id: header
implicitWidth: parent.width implicitWidth: parent.width

View file

@ -118,7 +118,7 @@ PageType {
anchors.rightMargin: 16 anchors.rightMargin: 16
anchors.leftMargin: 16 anchors.leftMargin: 16
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20

View file

@ -96,7 +96,7 @@ PageType {
Layout.leftMargin: -16 Layout.leftMargin: -16
} }
HeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -58,7 +58,7 @@ PageType {
header: ColumnLayout { header: ColumnLayout {
width: listView.width width: listView.width
HeaderType { BaseHeaderType {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -33,7 +33,7 @@ PageType {
Layout.topMargin: 20 Layout.topMargin: 20
} }
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.rightMargin: 16 Layout.rightMargin: 16
Layout.leftMargin: 16 Layout.leftMargin: 16

View file

@ -61,7 +61,7 @@ PageType {
anchors.rightMargin: 16 anchors.rightMargin: 16
anchors.leftMargin: 16 anchors.leftMargin: 16
HeaderType { BaseHeaderType {
headerText: qsTr("New connection") headerText: qsTr("New connection")
} }

View file

@ -169,7 +169,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { HeaderTypeWithButton {
id: header id: header
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24

View file

@ -44,7 +44,7 @@ PageType {
spacing: 0 spacing: 0
HeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24