diff --git a/client/ui/qml/Components/SettingsContainersListView.qml b/client/ui/qml/Components/SettingsContainersListView.qml index 9e672130b..4e298d2f8 100644 --- a/client/ui/qml/Components/SettingsContainersListView.qml +++ b/client/ui/qml/Components/SettingsContainersListView.qml @@ -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 diff --git a/client/ui/qml/Pages2/PageProtocolCloakSettings.qml b/client/ui/qml/Pages2/PageProtocolCloakSettings.qml index 686ccd7b6..fc6e50add 100644 --- a/client/ui/qml/Pages2/PageProtocolCloakSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolCloakSettings.qml @@ -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()) } } }