QML refactoring
This commit is contained in:
parent
fd905ef308
commit
1d8f342417
33 changed files with 322 additions and 473 deletions
|
@ -1,5 +1,6 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import PageEnum 1.0
|
||||
import "./"
|
||||
import "../Controls"
|
||||
|
@ -18,108 +19,97 @@ PageBase {
|
|||
text: qsTr("DNS Servers")
|
||||
}
|
||||
|
||||
CheckBoxType {
|
||||
id: cb_amnezia_dns
|
||||
FlickableType {
|
||||
id: fl
|
||||
anchors.top: caption.bottom
|
||||
x: 30
|
||||
width: parent.width - 60
|
||||
text: qsTr("Use AmneziaDNS service (recommended)")
|
||||
checked: NetworkSettingsLogic.checkBoxUseAmneziaDnsChecked
|
||||
onCheckedChanged: {
|
||||
NetworkSettingsLogic.checkBoxUseAmneziaDnsChecked = checked
|
||||
NetworkSettingsLogic.onCheckBoxUseAmneziaDnsToggled(checked)
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
}
|
||||
contentHeight: content.height
|
||||
|
||||
LabelType {
|
||||
id: lb_amnezia_dns
|
||||
x: 30
|
||||
anchors.top: cb_amnezia_dns.bottom
|
||||
width: parent.width - 60
|
||||
text: qsTr("Use AmneziaDNS container on your server, when it installed.\n
|
||||
ColumnLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 15
|
||||
|
||||
CheckBoxType {
|
||||
Layout.preferredWidth: parent.width
|
||||
text: qsTr("Use AmneziaDNS service (recommended)")
|
||||
checked: NetworkSettingsLogic.checkBoxUseAmneziaDnsChecked
|
||||
onCheckedChanged: {
|
||||
NetworkSettingsLogic.checkBoxUseAmneziaDnsChecked = checked
|
||||
NetworkSettingsLogic.onCheckBoxUseAmneziaDnsToggled(checked)
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
}
|
||||
|
||||
LabelType {
|
||||
Layout.preferredWidth: parent.width
|
||||
text: qsTr("Use AmneziaDNS container on your server, when it installed.\n
|
||||
Your AmneziaDNS server available only when it installed and VPN connected, it has internal IP address 172.29.172.254\n
|
||||
If AmneziaDNS service is not installed on the same server, or this option is unchecked, the following DNS servers will be used:")
|
||||
}
|
||||
}
|
||||
|
||||
LabelType {
|
||||
id: l1
|
||||
x: 30
|
||||
anchors.top: lb_amnezia_dns.bottom
|
||||
width: parent.width - 30
|
||||
height: 21
|
||||
text: qsTr("Primary DNS server")
|
||||
}
|
||||
TextFieldType {
|
||||
id: dns1
|
||||
x: 30
|
||||
anchors.top: l1.bottom
|
||||
width: parent.width - 90
|
||||
height: 40
|
||||
text: NetworkSettingsLogic.lineEditDns1Text
|
||||
onEditingFinished: {
|
||||
NetworkSettingsLogic.lineEditDns1Text = text
|
||||
NetworkSettingsLogic.onLineEditDns1EditFinished(text)
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
validator: RegExpValidator {
|
||||
regExp: NetworkSettingsLogic.ipAddressRegex
|
||||
}
|
||||
}
|
||||
SvgButtonType {
|
||||
id: resetDNS1
|
||||
anchors. left: dns1.right
|
||||
anchors.leftMargin: 10
|
||||
anchors.verticalCenter: dns1.verticalCenter
|
||||
width: 24
|
||||
height: 24
|
||||
icon.source: "qrc:/images/svg/refresh_black_24dp.svg"
|
||||
onClicked: {
|
||||
NetworkSettingsLogic.onPushButtonResetDns1Clicked()
|
||||
UiLogic.onUpdateAllPages()
|
||||
LabelType {
|
||||
Layout.topMargin: 15
|
||||
text: qsTr("Primary DNS server")
|
||||
}
|
||||
TextFieldType {
|
||||
height: 40
|
||||
implicitWidth: parent.width
|
||||
text: NetworkSettingsLogic.lineEditDns1Text
|
||||
onEditingFinished: {
|
||||
NetworkSettingsLogic.lineEditDns1Text = text
|
||||
NetworkSettingsLogic.onLineEditDns1EditFinished(text)
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
validator: RegExpValidator {
|
||||
regExp: NetworkSettingsLogic.ipAddressRegex
|
||||
}
|
||||
}
|
||||
|
||||
UrlButtonType {
|
||||
text: qsTr("Reset to default")
|
||||
label.horizontalAlignment: Text.AlignLeft
|
||||
label.verticalAlignment: Text.AlignTop
|
||||
label.font.pixelSize: 14
|
||||
icon.source: "qrc:/images/svg/refresh_black_24dp.svg"
|
||||
onClicked: {
|
||||
NetworkSettingsLogic.onPushButtonResetDns1Clicked()
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
}
|
||||
|
||||
LabelType {
|
||||
text: qsTr("Secondary DNS server")
|
||||
}
|
||||
TextFieldType {
|
||||
height: 40
|
||||
implicitWidth: parent.width
|
||||
text: NetworkSettingsLogic.lineEditDns2Text
|
||||
onEditingFinished: {
|
||||
NetworkSettingsLogic.lineEditDns2Text = text
|
||||
NetworkSettingsLogic.onLineEditDns2EditFinished(text)
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
validator: RegExpValidator {
|
||||
regExp: NetworkSettingsLogic.ipAddressRegex
|
||||
}
|
||||
}
|
||||
|
||||
UrlButtonType {
|
||||
text: qsTr("Reset to default")
|
||||
label.horizontalAlignment: Text.AlignLeft
|
||||
label.verticalAlignment: Text.AlignTop
|
||||
label.font.pixelSize: 14
|
||||
icon.source: "qrc:/images/svg/refresh_black_24dp.svg"
|
||||
onClicked: {
|
||||
NetworkSettingsLogic.onPushButtonResetDns2Clicked()
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LabelType {
|
||||
id: l2
|
||||
x: 30
|
||||
anchors.top: dns1.bottom
|
||||
anchors.topMargin: 20
|
||||
width: parent.width - 60
|
||||
height: 21
|
||||
text: qsTr("Secondary DNS server")
|
||||
}
|
||||
TextFieldType {
|
||||
id: dns2
|
||||
x: 30
|
||||
anchors.top: l2.bottom
|
||||
width: parent.width - 90
|
||||
height: 40
|
||||
text: NetworkSettingsLogic.lineEditDns2Text
|
||||
onEditingFinished: {
|
||||
NetworkSettingsLogic.lineEditDns2Text = text
|
||||
NetworkSettingsLogic.onLineEditDns2EditFinished(text)
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
validator: RegExpValidator {
|
||||
regExp: NetworkSettingsLogic.ipAddressRegex
|
||||
}
|
||||
}
|
||||
SvgButtonType {
|
||||
id: resetDNS2
|
||||
anchors. left: dns2.right
|
||||
anchors.leftMargin: 10
|
||||
anchors.verticalCenter: dns2.verticalCenter
|
||||
width: 24
|
||||
height: 24
|
||||
icon.source: "qrc:/images/svg/refresh_black_24dp.svg"
|
||||
onClicked: {
|
||||
NetworkSettingsLogic.onPushButtonResetDns2Clicked()
|
||||
UiLogic.onUpdateAllPages()
|
||||
}
|
||||
}
|
||||
|
||||
Logo {
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue