added protocol settings pages and models for openvpn, cloak and shadowsocks

This commit is contained in:
vladimir.kuznetsov 2023-07-13 11:29:26 +09:00
parent a97417fd38
commit c13b9754eb
42 changed files with 2130 additions and 576 deletions

View file

@ -3,6 +3,8 @@ import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import "TextTypes"
CheckBox {
id: root
@ -26,6 +28,8 @@ CheckBox {
indicator: Rectangle {
id: checkBoxBackground
anchors.verticalCenter: parent.verticalCenter
implicitWidth: 56
implicitHeight: 56
radius: 16
@ -57,43 +61,41 @@ CheckBox {
anchors.centerIn: parent
source: root.pressed ? imageSource : root.checked ? imageSource : ""
ColorOverlay {
id: imageColor
anchors.fill: indicator
source: indicator
color: root.pressed ? pressedImageColor : root.checked ? checkedImageColor : defaultImageColor
layer {
enabled: true
effect: ColorOverlay {
color: root.pressed ? pressedImageColor : root.checked ? checkedImageColor : defaultImageColor
}
}
}
}
}
contentItem: ColumnLayout {
anchors.fill: parent
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 8 + checkBoxBackground.width
Text {
text: root.text
color: "#D7D8DB"
font.pixelSize: 18
font.weight: 400
font.family: "PT Root UI VF"
spacing: 4
height: 22
ListItemTitleType {
Layout.fillWidth: true
// Layout.topMargin: 16
// Layout.bottomMargin: description.visible ? 0 : 16
text: root.text
}
Text {
CaptionTextType {
id: description
Layout.fillWidth: true
Layout.bottomMargin: 16
text: root.descriptionText
color: "#878b91"
font.pixelSize: 13
font.weight: 400
font.family: "PT Root UI VF"
font.letterSpacing: 0.02
height: 16
Layout.fillWidth: true
visible: root.descriptionText !== ""
}
}

View file

@ -9,8 +9,11 @@ Item {
property string text
property string textColor: "#d7d8db"
property string textDisabledColor: "#878B91"
property string descriptionText
property string descriptionTextColor: "#878B91"
property string descriptionTextDisabledColor: "#494B50"
property string headerText
property string headerBackButtonImage
@ -23,7 +26,6 @@ Item {
property string rootButtonHoveredBorderColor: "#494B50"
property string rootButtonDefaultBorderColor: "transparent"
property string rootButtonPressedBorderColor: "#D7D8DB"
property int rootButtonBorderWidth: 1
property real drawerHeight: 0.9
property Component listView
@ -36,10 +38,18 @@ Item {
onMenuVisibleChanged: {
if (menuVisible) {
rootButtonBackground.border.color = rootButtonPressedBorderColor
rootButtonBackground.border.width = rootButtonBorderWidth
} else {
rootButtonBackground.border.color = rootButtonDefaultBorderColor
rootButtonBackground.border.width = 0
}
}
onEnabledChanged: {
if (enabled) {
rootButtonBackground.color = rootButtonBackgroundColor
rootButtonBackground.border.color = rootButtonDefaultBorderColor
} else {
rootButtonBackground.color = "transparent"
rootButtonBackground.border.color = rootButtonHoveredBorderColor
}
}
@ -48,13 +58,10 @@ Item {
anchors.fill: rootButtonContent
radius: 16
color: rootButtonBackgroundColor
border.color: rootButtonDefaultBorderColor
border.width: 0
color: root.enabled ? rootButtonBackgroundColor : "transparent"
border.color: root.enabled ? rootButtonDefaultBorderColor : rootButtonHoveredBorderColor
border.width: 1
Behavior on border.width {
PropertyAnimation { duration: 200 }
}
Behavior on border.color {
PropertyAnimation { duration: 200 }
}
@ -77,7 +84,7 @@ Item {
visible: root.descriptionText !== ""
color: "#878B91"
color: root.enabled ? root.descriptionTextColor : root.descriptionTextDisabledColor
text: root.descriptionText
}
@ -87,7 +94,7 @@ Item {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
color: root.textColor
color: root.enabled ? root.textColor : root.textDisabledColor
text: root.text
wrapMode: Text.NoWrap
@ -108,18 +115,16 @@ Item {
MouseArea {
anchors.fill: rootButtonContent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
hoverEnabled: root.enabled ? true : false
onEntered: {
if (menu.visible === false) {
rootButtonBackground.border.width = rootButtonBorderWidth
rootButtonBackground.border.color = rootButtonHoveredBorderColor
}
}
onExited: {
if (menu.visible === false) {
rootButtonBackground.border.width = 0
rootButtonBackground.border.color = rootButtonDefaultBorderColor
}
}

View file

@ -22,45 +22,44 @@ RadioButton {
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight
hoverEnabled: true
indicator: Rectangle {
anchors.fill: parent
radius: 16
color: {
if (root.enabled) {
// if (root.enabled) {
if (root.hovered) {
return hoveredColor
} else if (root.checked) {
return selectedColor
}
return defaultColor
} else {
return disabledColor
}
// } else {
// return disabledColor
// }
}
border.color: {
if (root.enabled) {
// if (root.enabled) {
if (root.pressed) {
return pressedBorderColor
} else if (root.checked) {
return selectedBorderColor
}
}
return defaultBodredColor
return defaultBodredColor
// }
// return defaultBodredColor
}
border.width: {
if (root.enabled) {
// if (root.enabled) {
if(root.checked) {
return 1
}
return root.pressed ? 1 : 0
} else {
return 0
}
// } else {
// return 0
// }
}
Behavior on color {

View file

@ -8,6 +8,9 @@ Item {
id: root
property string headerText
property string headerTextDisabledColor: "#494B50"
property string headerTextColor: "#878b91"
property alias errorText: errorField.text
property string buttonText
@ -15,9 +18,18 @@ Item {
property alias textField: textField
property alias textFieldText: textField.text
property string textFieldTextColor: "#d7d8db"
property string textFieldTextDisabledColor: "#878B91"
property string textFieldPlaceholderText
property bool textFieldEditable: true
property string borderColor: "#2C2D30"
property string borderFocusedColor: "#d7d8db"
property string backgroundColor: "#1c1d21"
property string backgroundDisabledColor: "transparent"
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight
@ -29,9 +41,9 @@ Item {
id: backgroud
Layout.fillWidth: true
Layout.preferredHeight: 74
color: "#1c1d21"
color: root.enabled ? root.backgroundColor : root.backgroundDisabledColor
radius: 16
border.color: textField.focus ? "#d7d8db" : "#2C2D30"
border.color: textField.focus ? root.borderFocusedColor : root.borderColor
border.width: 1
Behavior on border.color {
@ -43,7 +55,7 @@ Item {
ColumnLayout {
LabelTextType {
text: root.headerText
color: "#878b91"
color: root.enabled ? root.headerTextColor : root.headerTextDisabledColor
Layout.fillWidth: true
Layout.rightMargin: 16
@ -55,9 +67,9 @@ Item {
id: textField
enabled: root.textFieldEditable
color: "#d7d8db"
color: root.enabled ? root.textFieldTextColor : root.textFieldTextDisabledColor
placeholderText: textFieldPlaceholderText
placeholderText: root.textFieldPlaceholderText
placeholderTextColor: "#494B50"
selectionColor: "#412102"
@ -79,7 +91,7 @@ Item {
background: Rectangle {
anchors.fill: parent
color: "#1c1d21"
color: root.enabled ? root.backgroundColor : root.backgroundDisabledColor
}
onTextChanged: {
@ -98,13 +110,13 @@ Item {
textColor: "#D7D8DB"
borderWidth: 0
text: buttonText
text: root.buttonText
Layout.rightMargin: 24
onClicked: {
if (clickedFunc && typeof clickedFunc === "function") {
clickedFunc()
if (root.clickedFunc && typeof root.clickedFunc === "function") {
root.clickedFunc()
}
}
}