Skip to content

Commit

Permalink
WIP 2
Browse files Browse the repository at this point in the history
  • Loading branch information
CyAn84 committed Mar 8, 2025
1 parent 2801458 commit 387372b
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 131 deletions.
7 changes: 1 addition & 6 deletions client/ui/qml/Components/SettingsContainersListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ import "../Controls2"
import "../Controls2/TextTypes"


ListView {
ListViewType {
id: root

width: parent.width
height: root.contentItem.height

clip: true
reuseItems: true

property bool isFocusable: false

delegate: Item {
implicitWidth: root.width
implicitHeight: delegateContent.implicitHeight
Expand Down
232 changes: 107 additions & 125 deletions client/ui/qml/Pages2/PageProtocolCloakSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,177 +16,159 @@ import "../Components"
PageType {
id: root

ColumnLayout {
id: backButtonLayout
BackButtonType {
id: backButton

anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right

anchors.topMargin: 20

BackButtonType {
id: backButton
}
}

FlickableType {
id: fl
anchors.top: backButtonLayout.bottom
ListViewType {
id: listView

anchors.top: backButton.bottom
anchors.bottom: parent.bottom
contentHeight: content.implicitHeight
anchors.left: parent.left
anchors.right: parent.right

Column {
id: content
property int selectedIndex: 0

anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
enabled: ServersModel.isProcessedServerHasWriteAccess()

enabled: ServersModel.isProcessedServerHasWriteAccess()
header: ColumnLayout {

ListView {
id: listview
width: listView.width

property int selectedIndex: 0
HeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16

width: parent.width
height: listview.contentItem.height
headerText: qsTr("Cloak settings")
}
}

clip: true
reuseItems: true
model: CloakConfigModel

model: CloakConfigModel
delegate: ColumnLayout {

delegate: Item {
implicitWidth: listview.width
implicitHeight: col.implicitHeight
width: listView.width

property alias trafficFromField: trafficFromField
property alias trafficFromField: trafficFromField

ColumnLayout {
id: col
spacing: 0

anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
TextFieldWithHeaderType {
id: trafficFromField

anchors.leftMargin: 16
anchors.rightMargin: 16
Layout.fillWidth: true
Layout.topMargin: 32
Layout.leftMargin: 16
Layout.rightMargin: 16

spacing: 0
headerText: qsTr("Disguised as traffic from")
textField.text: site

HeaderType {
Layout.fillWidth: true
textField.onEditingFinished: {
if (textField.text !== site) {
var tmpText = textField.text
tmpText = tmpText.toLocaleLowerCase()

headerText: qsTr("Cloak settings")
var indexHttps = tmpText.indexOf("https://")
if (indexHttps === 0) {
tmpText = textField.text.substring(8)
} else {
site = textField.text
}
}
}
}

TextFieldWithHeaderType {
id: trafficFromField

Layout.fillWidth: true
Layout.topMargin: 32

headerText: qsTr("Disguised as traffic from")
textField.text: site

textField.onEditingFinished: {
if (textField.text !== site) {
var tmpText = textField.text
tmpText = tmpText.toLocaleLowerCase()

var indexHttps = tmpText.indexOf("https://")
if (indexHttps === 0) {
tmpText = textField.text.substring(8)
} else {
site = textField.text
}
}
}
}
TextFieldWithHeaderType {
id: portTextField

TextFieldWithHeaderType {
id: portTextField
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16

Layout.fillWidth: true
Layout.topMargin: 16
headerText: qsTr("Port")
textField.text: port
textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 }

headerText: qsTr("Port")
textField.text: port
textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: {
if (textField.text !== port) {
port = textField.text
}
}
}

textField.onEditingFinished: {
if (textField.text !== port) {
port = textField.text
}
}
}
DropDownType {
id: cipherDropDown

DropDownType {
id: cipherDropDown
Layout.fillWidth: true
Layout.topMargin: 16
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16

descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher")
descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher")

drawerParent: root
drawerParent: root

listView: ListViewWithRadioButtonType {
id: cipherListView
listView: ListViewWithRadioButtonType {
id: cipherListView

rootWidth: root.width
rootWidth: root.width

model: ListModel {
ListElement { name : "chacha20-ietf-poly1305" }
ListElement { name : "xchacha20-ietf-poly1305" }
ListElement { name : "aes-256-gcm" }
ListElement { name : "aes-192-gcm" }
ListElement { name : "aes-128-gcm" }
}
model: ListModel {
ListElement { name : "chacha20-ietf-poly1305" }
ListElement { name : "xchacha20-ietf-poly1305" }
ListElement { name : "aes-256-gcm" }
ListElement { name : "aes-192-gcm" }
ListElement { name : "aes-128-gcm" }
}

clickedFunction: function() {
cipherDropDown.text = selectedText
cipher = cipherDropDown.text
cipherDropDown.closeTriggered()
}
clickedFunction: function() {
cipherDropDown.text = selectedText
cipher = cipherDropDown.text
cipherDropDown.closeTriggered()
}

Component.onCompleted: {
cipherDropDown.text = cipher
Component.onCompleted: {
cipherDropDown.text = cipher

for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipherDropDown.text) {
selectedIndex = i
}
}
}
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipherDropDown.text) {
selectedIndex = i
}
}
}
}
}

BasicButtonType {
id: saveRestartButton

Layout.fillWidth: true
Layout.topMargin: 24
Layout.bottomMargin: 24

text: qsTr("Save")
BasicButtonType {
id: saveRestartButton

clickedFunc: function() {
forceActiveFocus()
Layout.fillWidth: true
Layout.topMargin: 24
Layout.bottomMargin: 24
Layout.leftMargin: 16
Layout.rightMargin: 16

if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
text: qsTr("Save")

PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(CloakConfigModel.getConfig())
}
}
clickedFunc: function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}

PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(CloakConfigModel.getConfig())
}
}
}
Expand Down

0 comments on commit 387372b

Please sign in to comment.