Port the network proxy page to mobileform

This commit is contained in:
Gary Wang
2022-11-16 23:07:37 +08:00
committed by Carl Schwan
parent 73e7f3eaf1
commit ff98e378e6

View File

@@ -6,6 +6,7 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.neochat 1.0 import org.kde.neochat 1.0
@@ -15,11 +16,15 @@ Kirigami.ScrollablePage {
property bool proxyConfigChanged: false property bool proxyConfigChanged: false
ColumnLayout { ColumnLayout {
Kirigami.FormLayout { MobileForm.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout {
QQC2.RadioButton { spacing: 0
Kirigami.FormData.label: i18n("Network Proxy") MobileForm.FormCardHeader {
title: i18n("Network Proxy")
}
MobileForm.FormRadioDelegate {
text: i18n("System Default") text: i18n("System Default")
checked: currentType === 0 checked: currentType === 0
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
@@ -27,7 +32,7 @@ Kirigami.ScrollablePage {
currentType = 0 currentType = 0
} }
} }
QQC2.RadioButton { MobileForm.FormRadioDelegate {
text: i18n("HTTP") text: i18n("HTTP")
checked: currentType === 1 checked: currentType === 1
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
@@ -35,7 +40,7 @@ Kirigami.ScrollablePage {
currentType = 1 currentType = 1
} }
} }
QQC2.RadioButton { MobileForm.FormRadioDelegate {
text: i18n("Socks5") text: i18n("Socks5")
checked: currentType === 2 checked: currentType === 2
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
@@ -43,6 +48,25 @@ Kirigami.ScrollablePage {
currentType = 2 currentType = 2
} }
} }
}
}
MobileForm.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Proxy Settings")
}
// TODO: switch to FormTextFieldDelegate once kirigami-addons got a new release
MobileForm.AbstractFormDelegate {
Layout.fillWidth: true
contentItem: RowLayout {
QQC2.Label {
text: i18n("Host")
Layout.fillWidth: true
}
QQC2.TextField { QQC2.TextField {
id: hostField id: hostField
Kirigami.FormData.label: i18n("Proxy Host") Kirigami.FormData.label: i18n("Proxy Host")
@@ -52,6 +76,15 @@ Kirigami.ScrollablePage {
proxyConfigChanged = true proxyConfigChanged = true
} }
} }
}
}
MobileForm.AbstractFormDelegate {
Layout.fillWidth: true
contentItem: RowLayout {
QQC2.Label {
text: i18n("Peeker width")
Layout.fillWidth: true
}
QQC2.SpinBox { QQC2.SpinBox {
id: portField id: portField
Kirigami.FormData.label: i18n("Proxy Port") Kirigami.FormData.label: i18n("Proxy Port")
@@ -68,6 +101,9 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
}
}
footer: QQC2.ToolBar { footer: QQC2.ToolBar {
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0