Files
amnezia-client/client/ui/qml/Pages2/PageProtocolRaw.qml
T

205 lines
6.2 KiB
QML
Raw Normal View History

2023-07-14 13:14:50 +09:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ContainerProps 1.0
2024-07-07 13:42:38 +03:00
import Style 1.0
2023-07-14 13:14:50 +09:00
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
BackButtonType {
id: backButton
2023-07-14 13:14:50 +09:00
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + PageController.safeAreaTopMargin
2023-07-14 13:14:50 +09:00
onFocusChanged: {
if (this.activeFocus) {
listView.positionViewAtBeginning()
}
2023-07-14 13:14:50 +09:00
}
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
2023-07-14 13:14:50 +09:00
anchors.right: parent.right
anchors.left: parent.left
2023-07-14 13:14:50 +09:00
header: ColumnLayout {
width: listView.width
2023-07-14 13:14:50 +09:00
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.bottomMargin: 16
2023-07-14 13:14:50 +09:00
headerText: ContainersModel.getProcessedContainerName() + qsTr(" settings")
}
}
2024-04-18 17:54:55 +04:00
model: ProtocolsModel
2023-07-14 13:14:50 +09:00
delegate: ColumnLayout {
width: listView.width
2024-04-18 17:54:55 +04:00
LabelWithButtonType {
id: button
2023-07-14 13:14:50 +09:00
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
2023-07-14 13:14:50 +09:00
text: qsTr("Show connection options")
2023-07-14 13:14:50 +09:00
clickedFunction: function() {
configContentDrawer.openTriggered()
}
2023-07-14 13:14:50 +09:00
MouseArea {
anchors.fill: button
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
2023-07-14 13:14:50 +09:00
DividerType {}
2023-07-14 13:14:50 +09:00
DrawerType2 {
id: configContentDrawer
2023-07-14 13:14:50 +09:00
expandedHeight: root.height * 0.9
2023-07-14 13:14:50 +09:00
parent: root
anchors.fill: parent
2023-07-14 13:14:50 +09:00
expandedStateContent: Item {
implicitHeight: configContentDrawer.expandedHeight
2023-07-14 13:14:50 +09:00
BackButtonType {
id: drawerBackButton
2023-07-14 13:14:50 +09:00
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 16
2023-07-14 13:14:50 +09:00
backButtonFunction: function() {
configContentDrawer.closeTriggered()
}
}
2024-02-16 15:24:06 +05:00
ListViewType {
id: drawerListView
2024-02-16 15:24:06 +05:00
anchors.top: drawerBackButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
2023-07-14 13:14:50 +09:00
header: ColumnLayout {
width: drawerListView.width
2023-07-14 13:14:50 +09:00
Header2Type {
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
2023-07-14 13:14:50 +09:00
headerText: qsTr("Connection options %1").arg(protocolName)
}
}
2023-07-14 13:14:50 +09:00
model: 1 // fake model to force the ListView to be created without a model
2023-07-14 13:14:50 +09:00
delegate: ColumnLayout {
width: drawerListView.width
2023-07-14 13:14:50 +09:00
TextArea {
id: configText
2023-07-14 13:14:50 +09:00
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
2023-07-14 13:14:50 +09:00
padding: 0
height: 24
2023-07-14 13:14:50 +09:00
color: AmneziaStyle.color.paleGray
selectionColor: AmneziaStyle.color.richBrown
selectedTextColor: AmneziaStyle.color.paleGray
2023-07-14 13:14:50 +09:00
font.pixelSize: 16
font.weight: Font.Medium
font.family: "PT Root UI VF"
2023-07-14 13:14:50 +09:00
text: rawConfig
2023-07-14 13:14:50 +09:00
wrapMode: Text.Wrap
2023-07-14 13:14:50 +09:00
background: Rectangle {
color: AmneziaStyle.color.transparent
2023-07-14 13:14:50 +09:00
}
}
}
}
}
}
}
footer: ColumnLayout {
width: listView.width
2023-07-14 13:14:50 +09:00
LabelWithButtonType {
id: removeButton
width: parent.width
visible: ServersUiController.isProcessedServerHasWriteAccess()
text: qsTr("Remove ") + ContainersModel.getProcessedContainerName()
textColor: AmneziaStyle.color.vibrantRed
2023-07-14 13:14:50 +09:00
clickedFunction: function() {
var headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getProcessedContainerName())
2024-03-26 20:05:04 +02:00
var descriptionText = qsTr("All users with whom you shared a connection with will no longer be able to connect to it.")
2024-02-16 15:24:06 +05:00
var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel")
2024-02-16 15:24:06 +05:00
var yesButtonFunction = function() {
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageDeinstalling)
2026-05-28 10:57:08 +08:00
InstallController.removeContainer(ServersUiController.processedServerId, ServersUiController.processedContainerIndex)
}
var noButtonFunction = function() {}
2024-02-16 15:24:06 +05:00
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
2023-07-14 13:14:50 +09:00
}
MouseArea {
anchors.fill: removeButton
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
DividerType {}
}
}
}