Skip to content

Commit

Permalink
Refactor: Replace HeaderType with new Types for headers in QML pages
Browse files Browse the repository at this point in the history
  • Loading branch information
aiamnezia committed Feb 24, 2025
1 parent 13127cd commit 1c2b1f1
Show file tree
Hide file tree
Showing 43 changed files with 68 additions and 86 deletions.
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageDeinstalling.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ PageType {
anchors.rightMargin: 16
anchors.leftMargin: 16

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.topMargin: 20

Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageDevMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PageType {
header: ColumnLayout {
width: listView.width

HeaderType {
BaseHeaderType {
id: header

Layout.fillWidth: true
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageProtocolAwgClientSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("AmneziaWG settings")
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageProtocolAwgSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("AmneziaWG settings")
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageProtocolCloakSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("Cloak settings")
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("OpenVPN settings")
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageProtocolRaw.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PageType {
id: backButton
}

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("Shadowsocks settings")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("WG settings")
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageProtocolWireGuardSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
headerText: qsTr("WG settings")
}
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageProtocolXraySettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
headerText: qsTr("XRay settings")
}
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageServiceDnsSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right

HeaderType {
BaseHeaderType {
id: header

Layout.fillWidth: true
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageServiceSftpSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down
4 changes: 2 additions & 2 deletions client/ui/qml/Pages2/PageServiceSocksProxySettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down Expand Up @@ -217,7 +217,7 @@ PageType {
}
}

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("SOCKS5 settings")
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
id: header
Layout.fillWidth: true
Layout.topMargin: 24
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsApiAvailableCountries.qml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ PageType {
Layout.topMargin: 20
}

HeaderType {
HeaderTypeWithButton {
id: headerContent
objectName: "headerContent"

Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsApiInstructions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PageType {
id: backButton
}

HeaderType {
BaseHeaderType {
id: header

Layout.fillWidth: true
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsApiNativeConfigs.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PageType {
id: backButton
}

HeaderType {
BaseHeaderType {
id: header

Layout.fillWidth: true
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsApiServerInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ PageType {
Layout.topMargin: 20
}

HeaderType {
HeaderTypeWithButton {
id: headerContent
objectName: "headerContent"

Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsApiSupport.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PageType {
}


HeaderType {
BaseHeaderType {
id: header

Layout.fillWidth: true
Expand Down
31 changes: 12 additions & 19 deletions client/ui/qml/Pages2/PageSettingsAppSplitTunneling.qml
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,22 @@ PageType {
id: backButton
}

RowLayout {
HeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
HeaderTypeWithSwitcher {
Layout.fillWidth: true
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
}

SwitcherType {
id: switcher

Layout.fillWidth: true
Layout.rightMargin: 16

enabled: root.pageEnabled

checked: AppSplitTunnelingModel.isTunnelingEnabled
onToggled: {
AppSplitTunnelingModel.toggleSplitTunneling(checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
}
switcherFunction: function(checked) {
AppSplitTunnelingModel.toggleSplitTunneling(checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsApplication.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PageType {

spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsBackup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PageType {

spacing: 16

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("Back up your configuration")
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsConnection.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsDns.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PageType {

spacing: 16

HeaderType {
BaseHeaderType {
Layout.fillWidth: true

headerText: qsTr("DNS servers")
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsLogging.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PageType {
header: ColumnLayout {
width: listView.width

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsServerInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ PageType {
objectName: "backButton"
}

HeaderType {
HeaderTypeWithButton {
id: headerContent
objectName: "headerContent"

Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsServerProtocol.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PageType {
id: backButton
}

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsServersList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PageType {
id: backButton
}

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Expand Down
37 changes: 13 additions & 24 deletions client/ui/qml/Pages2/PageSettingsSplitTunneling.qml
Original file line number Diff line number Diff line change
Expand Up @@ -94,33 +94,22 @@ PageType {
id: backButton
}

RowLayout {
HeaderType {
enabled: root.pageEnabled

Layout.fillWidth: true
Layout.leftMargin: 16

headerText: qsTr("Split tunneling")
}

SwitcherType {
id: switcher

enabled: root.pageEnabled

Layout.fillWidth: true
Layout.rightMargin: 16
HeaderTypeWithSwitcher {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16

function onToggledFunc() {
SitesModel.toggleSplitTunneling(this.checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
}
headerText: qsTr("Split tunneling")

enabled: root.pageEnabled
showSwitcher: true
switcher {
checked: SitesModel.isTunnelingEnabled
onToggled: { onToggledFunc() }
Keys.onEnterPressed: { onToggledFunc() }
Keys.onReturnPressed: { onToggledFunc() }
enabled: root.pageEnabled
}
switcherFunction: function(checked) {
SitesModel.toggleSplitTunneling(checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSetupWizardApiServiceInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PageType {
Layout.topMargin: 20
}

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.topMargin: 8
Layout.rightMargin: 16
Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSetupWizardApiServicesList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PageType {
Layout.topMargin: 20
}

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.topMargin: 8
Layout.rightMargin: 16
Expand Down
4 changes: 2 additions & 2 deletions client/ui/qml/Pages2/PageSetupWizardConfigSource.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ PageType {
header: ColumnLayout {
width: listView.width

HeaderType {
HeaderTypeWithButton {
id: moreButton

property bool isVisible: SettingsController.getInstallationUuid() !== "" || PageController.isStartPageVisible()
Expand Down Expand Up @@ -74,7 +74,7 @@ PageType {
anchors.right: parent.right
spacing: 0

HeaderType {
BaseHeaderType {
Layout.fillWidth: true
Layout.topMargin: 32
Layout.leftMargin: 16
Expand Down
Loading

0 comments on commit 1c2b1f1

Please sign in to comment.