Qml Containers Page refact
This commit is contained in:
parent
0faf6c8599
commit
a390f2e988
22 changed files with 191 additions and 197 deletions
|
@ -1,16 +1,16 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import PageEnum 1.0
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageBase {
|
||||
PageProtocolBase {
|
||||
id: root
|
||||
page: PageEnum.CloakSettings
|
||||
logic: CloakLogic
|
||||
protocol: ProtocolEnum.Cloak
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
enabled: CloakLogic.pageProtoCloakEnabled
|
||||
enabled: logic.pageProtoCloakEnabled
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ PageBase {
|
|||
y: 40
|
||||
width: 380
|
||||
height: 600
|
||||
enabled: CloakLogic.widgetProtoCloakEnabled
|
||||
enabled: logic.widgetProtoCloakEnabled
|
||||
ComboBoxType {
|
||||
x: 190
|
||||
y: 60
|
||||
|
@ -33,14 +33,14 @@ PageBase {
|
|||
]
|
||||
currentIndex: {
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
if (CloakLogic.comboBoxProtoCloakCipherText === model[i]) {
|
||||
if (logic.comboBoxProtoCloakCipherText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
CloakLogic.comboBoxProtoCloakCipherText = currentText
|
||||
logic.comboBoxProtoCloakCipherText = currentText
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
@ -84,8 +84,8 @@ PageBase {
|
|||
y: 550
|
||||
width: 321
|
||||
height: 41
|
||||
visible: CloakLogic.labelProtoCloakInfoVisible
|
||||
text: CloakLogic.labelProtoCloakInfoText
|
||||
visible: logic.labelProtoCloakInfoVisible
|
||||
text: logic.labelProtoCloakInfoText
|
||||
}
|
||||
TextFieldType {
|
||||
id: lineEdit_proto_cloak_port
|
||||
|
@ -93,11 +93,11 @@ PageBase {
|
|||
y: 160
|
||||
width: 151
|
||||
height: 31
|
||||
text: CloakLogic.lineEditProtoCloakPortText
|
||||
text: logic.lineEditProtoCloakPortText
|
||||
onEditingFinished: {
|
||||
CloakLogic.lineEditProtoCloakPortText = text
|
||||
logic.lineEditProtoCloakPortText = text
|
||||
}
|
||||
enabled: CloakLogic.lineEditProtoCloakPortEnabled
|
||||
enabled: logic.lineEditProtoCloakPortEnabled
|
||||
}
|
||||
TextFieldType {
|
||||
id: lineEdit_proto_cloak_site
|
||||
|
@ -105,9 +105,9 @@ PageBase {
|
|||
y: 110
|
||||
width: 151
|
||||
height: 31
|
||||
text: CloakLogic.lineEditProtoCloakSiteText
|
||||
text: logic.lineEditProtoCloakSiteText
|
||||
onEditingFinished: {
|
||||
CloakLogic.lineEditProtoCloakSiteText = text
|
||||
logic.lineEditProtoCloakSiteText = text
|
||||
}
|
||||
}
|
||||
ProgressBar {
|
||||
|
@ -117,8 +117,8 @@ PageBase {
|
|||
width: 321
|
||||
height: 40
|
||||
from: 0
|
||||
to: CloakLogic.progressBarProtoCloakResetMaximium
|
||||
value: CloakLogic.progressBarProtoCloakResetValue
|
||||
to: logic.progressBarProtoCloakResetMaximium
|
||||
value: logic.progressBarProtoCloakResetValue
|
||||
background: Rectangle {
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: parent.height
|
||||
|
@ -136,7 +136,7 @@ PageBase {
|
|||
color: Qt.rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
}
|
||||
visible: CloakLogic.progressBarProtoCloakResetVisible
|
||||
visible: logic.progressBarProtoCloakResetVisible
|
||||
}
|
||||
BlueButtonType {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
@ -144,9 +144,9 @@ PageBase {
|
|||
width: 321
|
||||
height: 40
|
||||
text: qsTr("Save and restart VPN")
|
||||
visible: CloakLogic.pushButtonCloakSaveVisible
|
||||
visible: logic.pushButtonCloakSaveVisible
|
||||
onClicked: {
|
||||
CloakLogic.onPushButtonProtoCloakSaveClicked()
|
||||
logic.onPushButtonProtoCloakSaveClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import PageEnum 1.0
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageBase {
|
||||
PageProtocolBase {
|
||||
id: root
|
||||
page: PageEnum.OpenVpnSettings
|
||||
logic: OpenVpnLogic
|
||||
protocol: ProtocolEnum.OpenVpn
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
enabled: OpenVpnLogic.pageProtoOpenVpnEnabled
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
|
@ -19,19 +18,19 @@ PageBase {
|
|||
y: 40
|
||||
width: 380
|
||||
height: 600
|
||||
enabled: OpenVpnLogic.widgetProtoOpenVpnEnabled
|
||||
enabled: logic.widgetProtoOpenVpnEnabled
|
||||
CheckBoxType {
|
||||
x: 30
|
||||
y: 280
|
||||
width: 321
|
||||
height: 21
|
||||
text: qsTr("Auto-negotiate encryption")
|
||||
checked: OpenVpnLogic.checkBoxProtoOpenVpnAutoEncryptionChecked
|
||||
checked: logic.checkBoxProtoOpenVpnAutoEncryptionChecked
|
||||
onCheckedChanged: {
|
||||
OpenVpnLogic.checkBoxProtoOpenVpnAutoEncryptionChecked = checked
|
||||
logic.checkBoxProtoOpenVpnAutoEncryptionChecked = checked
|
||||
}
|
||||
onClicked: {
|
||||
OpenVpnLogic.checkBoxProtoOpenVpnAutoEncryptionClicked()
|
||||
logic.checkBoxProtoOpenVpnAutoEncryptionClicked()
|
||||
}
|
||||
}
|
||||
CheckBoxType {
|
||||
|
@ -40,9 +39,9 @@ PageBase {
|
|||
width: 321
|
||||
height: 21
|
||||
text: qsTr("Block DNS requests outside of VPN")
|
||||
checked: OpenVpnLogic.checkBoxProtoOpenVpnBlockDnsChecked
|
||||
checked: logic.checkBoxProtoOpenVpnBlockDnsChecked
|
||||
onCheckedChanged: {
|
||||
OpenVpnLogic.checkBoxProtoOpenVpnBlockDnsChecked = checked
|
||||
logic.checkBoxProtoOpenVpnBlockDnsChecked = checked
|
||||
}
|
||||
}
|
||||
CheckBoxType {
|
||||
|
@ -51,9 +50,9 @@ PageBase {
|
|||
width: 321
|
||||
height: 21
|
||||
text: qsTr("Enable TLS auth")
|
||||
checked: OpenVpnLogic.checkBoxProtoOpenVpnTlsAuthChecked
|
||||
checked: logic.checkBoxProtoOpenVpnTlsAuthChecked
|
||||
onCheckedChanged: {
|
||||
OpenVpnLogic.checkBoxProtoOpenVpnTlsAuthChecked = checked
|
||||
logic.checkBoxProtoOpenVpnTlsAuthChecked = checked
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,16 +75,16 @@ PageBase {
|
|||
]
|
||||
currentIndex: {
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
if (OpenVpnLogic.comboBoxProtoOpenVpnCipherText === model[i]) {
|
||||
if (logic.comboBoxProtoOpenVpnCipherText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
OpenVpnLogic.comboBoxProtoOpenVpnCipherText = currentText
|
||||
logic.comboBoxProtoOpenVpnCipherText = currentText
|
||||
}
|
||||
enabled: OpenVpnLogic.comboBoxProtoOpenVpnCipherEnabled
|
||||
enabled: logic.comboBoxProtoOpenVpnCipherEnabled
|
||||
}
|
||||
ComboBoxType {
|
||||
x: 200
|
||||
|
@ -106,16 +105,16 @@ PageBase {
|
|||
]
|
||||
currentIndex: {
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
if (OpenVpnLogic.comboBoxProtoOpenVpnHashText === model[i]) {
|
||||
if (logic.comboBoxProtoOpenVpnHashText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
OpenVpnLogic.comboBoxProtoOpenVpnHashText = currentText
|
||||
logic.comboBoxProtoOpenVpnHashText = currentText
|
||||
}
|
||||
enabled: OpenVpnLogic.comboBoxProtoOpenVpnHashEnabled
|
||||
enabled: logic.comboBoxProtoOpenVpnHashEnabled
|
||||
}
|
||||
Rectangle {
|
||||
x: 30
|
||||
|
@ -131,8 +130,8 @@ PageBase {
|
|||
width: 171
|
||||
height: 19
|
||||
text: qsTr("TCP")
|
||||
enabled: OpenVpnLogic.radioButtonProtoOpenVpnTcpEnabled
|
||||
checked: OpenVpnLogic.radioButtonProtoOpenVpnTcpChecked
|
||||
enabled: logic.radioButtonProtoOpenVpnTcpEnabled
|
||||
checked: logic.radioButtonProtoOpenVpnTcpChecked
|
||||
onCheckedChanged: {
|
||||
UiLogic.radioButtonProtoOpenVpnTcpChecked = checked
|
||||
}
|
||||
|
@ -143,11 +142,11 @@ PageBase {
|
|||
width: 171
|
||||
height: 19
|
||||
text: qsTr("UDP")
|
||||
checked: OpenVpnLogic.radioButtonProtoOpenVpnUdpChecked
|
||||
checked: logic.radioButtonProtoOpenVpnUdpChecked
|
||||
onCheckedChanged: {
|
||||
OpenVpnLogic.radioButtonProtoOpenVpnUdpChecked = checked
|
||||
logic.radioButtonProtoOpenVpnUdpChecked = checked
|
||||
}
|
||||
enabled: OpenVpnLogic.radioButtonProtoOpenVpnUdpEnabled
|
||||
enabled: logic.radioButtonProtoOpenVpnUdpEnabled
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
@ -204,8 +203,8 @@ PageBase {
|
|||
y: 550
|
||||
width: 321
|
||||
height: 41
|
||||
visible: OpenVpnLogic.labelProtoOpenVpnInfoVisible
|
||||
text: OpenVpnLogic.labelProtoOpenVpnInfoText
|
||||
visible: logic.labelProtoOpenVpnInfoVisible
|
||||
text: logic.labelProtoOpenVpnInfoText
|
||||
}
|
||||
TextFieldType {
|
||||
id: lineEdit_proto_openvpn_port
|
||||
|
@ -213,11 +212,11 @@ PageBase {
|
|||
y: 230
|
||||
width: 151
|
||||
height: 31
|
||||
text: OpenVpnLogic.lineEditProtoOpenVpnPortText
|
||||
text: logic.lineEditProtoOpenVpnPortText
|
||||
onEditingFinished: {
|
||||
OpenVpnLogic.lineEditProtoOpenVpnPortText = text
|
||||
logic.lineEditProtoOpenVpnPortText = text
|
||||
}
|
||||
enabled: OpenVpnLogic.lineEditProtoOpenVpnPortEnabled
|
||||
enabled: logic.lineEditProtoOpenVpnPortEnabled
|
||||
}
|
||||
TextFieldType {
|
||||
id: lineEdit_proto_openvpn_subnet
|
||||
|
@ -225,9 +224,9 @@ PageBase {
|
|||
y: 65
|
||||
width: 321
|
||||
height: 31
|
||||
text: OpenVpnLogic.lineEditProtoOpenVpnSubnetText
|
||||
text: logic.lineEditProtoOpenVpnSubnetText
|
||||
onEditingFinished: {
|
||||
OpenVpnLogic.lineEditProtoOpenVpnSubnetText = text
|
||||
logic.lineEditProtoOpenVpnSubnetText = text
|
||||
}
|
||||
}
|
||||
ProgressBar {
|
||||
|
@ -237,9 +236,9 @@ PageBase {
|
|||
width: 321
|
||||
height: 40
|
||||
from: 0
|
||||
to: OpenVpnLogic.progressBarProtoOpenVpnResetMaximium
|
||||
value: OpenVpnLogic.progressBarProtoOpenVpnResetValue
|
||||
visible: OpenVpnLogic.progressBarProtoOpenVpnResetVisible
|
||||
to: logic.progressBarProtoOpenVpnResetMaximium
|
||||
value: logic.progressBarProtoOpenVpnResetValue
|
||||
visible: logic.progressBarProtoOpenVpnResetVisible
|
||||
background: Rectangle {
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: parent.height
|
||||
|
@ -264,9 +263,9 @@ PageBase {
|
|||
width: 321
|
||||
height: 40
|
||||
text: qsTr("Save and restart VPN")
|
||||
visible: OpenVpnLogic.pushButtonOpenvpnSaveVisible
|
||||
visible: logic.pushButtonOpenvpnSaveVisible
|
||||
onClicked: {
|
||||
OpenVpnLogic.onPushButtonProtoOpenVpnSaveClicked()
|
||||
logic.onPushButtonProtoOpenVpnSaveClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import PageEnum 1.0
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageBase {
|
||||
PageProtocolBase {
|
||||
id: root
|
||||
page: PageEnum.ShadowSocksSettings
|
||||
logic: ShadowSocksLogic
|
||||
protocol: ProtocolEnum.ShadowSocks
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
enabled: ShadowSocksLogic.pageProtoShadowSocksEnabled
|
||||
enabled: logic.pageProtoShadowSocksEnabled
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ PageBase {
|
|||
y: 40
|
||||
width: 380
|
||||
height: 600
|
||||
enabled: ShadowSocksLogic.widgetProtoShadowSocksEnabled
|
||||
enabled: logic.widgetProtoShadowSocksEnabled
|
||||
ComboBoxType {
|
||||
x: 190
|
||||
y: 60
|
||||
|
@ -32,14 +32,14 @@ PageBase {
|
|||
]
|
||||
currentIndex: {
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
if (ShadowSocksLogic.comboBoxProtoShadowSocksCipherText === model[i]) {
|
||||
if (logic.comboBoxProtoShadowSocksCipherText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
ShadowSocksLogic.comboBoxProtoShadowSocksCipherText = currentText
|
||||
logic.comboBoxProtoShadowSocksCipherText = currentText
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
@ -75,8 +75,8 @@ PageBase {
|
|||
y: 550
|
||||
width: 321
|
||||
height: 41
|
||||
visible: ShadowSocksLogic.labelProtoShadowSocksInfoVisible
|
||||
text: ShadowSocksLogic.labelProtoShadowSocksInfoText
|
||||
visible: logic.labelProtoShadowSocksInfoVisible
|
||||
text: logic.labelProtoShadowSocksInfoText
|
||||
}
|
||||
TextFieldType {
|
||||
id: lineEdit_proto_shadowsocks_port
|
||||
|
@ -84,11 +84,11 @@ PageBase {
|
|||
y: 110
|
||||
width: 151
|
||||
height: 31
|
||||
text: ShadowSocksLogic.lineEditProtoShadowSocksPortText
|
||||
text: logic.lineEditProtoShadowSocksPortText
|
||||
onEditingFinished: {
|
||||
ShadowSocksLogic.lineEditProtoShadowSocksPortText = text
|
||||
logic.lineEditProtoShadowSocksPortText = text
|
||||
}
|
||||
enabled: ShadowSocksLogic.lineEditProtoShadowSocksPortEnabled
|
||||
enabled: logic.lineEditProtoShadowSocksPortEnabled
|
||||
}
|
||||
ProgressBar {
|
||||
id: progressBar_proto_shadowsocks_reset
|
||||
|
@ -97,9 +97,9 @@ PageBase {
|
|||
width: 321
|
||||
height: 40
|
||||
from: 0
|
||||
to: ShadowSocksLogic.progressBarProtoShadowSocksResetMaximium
|
||||
value: ShadowSocksLogic.progressBarProtoShadowSocksResetValue
|
||||
visible: ShadowSocksLogic.progressBarProtoShadowSocksResetVisible
|
||||
to: logic.progressBarProtoShadowSocksResetMaximium
|
||||
value: logic.progressBarProtoShadowSocksResetValue
|
||||
visible: logic.progressBarProtoShadowSocksResetVisible
|
||||
background: Rectangle {
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: parent.height
|
||||
|
@ -124,9 +124,9 @@ PageBase {
|
|||
width: 321
|
||||
height: 40
|
||||
text: qsTr("Save and restart VPN")
|
||||
visible: ShadowSocksLogic.pushButtonShadowSocksSaveVisible
|
||||
visible: logic.pushButtonShadowSocksSaveVisible
|
||||
onClicked: {
|
||||
ShadowSocksLogic.onPushButtonProtoShadowSocksSaveClicked()
|
||||
logic.onPushButtonProtoShadowSocksSaveClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
13
client/ui/qml/Pages/Protocols/PageProtocolBase.qml
Normal file
13
client/ui/qml/Pages/Protocols/PageProtocolBase.qml
Normal file
|
@ -0,0 +1,13 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import PageEnum 1.0
|
||||
import ProtocolEnum 1.0
|
||||
import "./.."
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageBase {
|
||||
id: root
|
||||
property int protocol: ProtocolEnum.Any
|
||||
page: PageEnum.ProtocolSettings
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue