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

221 lines
7.4 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 ProtocolEnum 1.0
import ContainerEnum 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
ColumnLayout {
id: header
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20
BackButtonType {
2024-04-18 17:54:55 +04:00
id: backButton
2023-07-14 13:14:50 +09:00
}
2025-05-02 23:54:36 -07:00
BaseHeaderType {
2023-07-14 13:14:50 +09:00
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: ContainersModel.getProcessedContainerName() + qsTr(" settings")
2023-07-14 13:14:50 +09:00
}
}
FlickableType {
id: fl
anchors.top: header.bottom
anchors.left: parent.left
anchors.right: parent.right
contentHeight: content.height
Column {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 32
ListView {
2024-04-18 17:54:55 +04:00
id: listView
2023-07-14 13:14:50 +09:00
width: parent.width
height: contentItem.height
clip: true
interactive: false
model: ProtocolsModel
2024-04-18 17:54:55 +04:00
activeFocusOnTab: true
focus: true
2023-07-14 13:14:50 +09:00
delegate: Item {
implicitWidth: parent.width
implicitHeight: delegateContent.implicitHeight
2024-04-18 17:54:55 +04:00
property alias focusItem: button
2023-07-14 13:14:50 +09:00
ColumnLayout {
id: delegateContent
anchors.fill: parent
LabelWithButtonType {
id: button
Layout.fillWidth: true
text: qsTr("Show connection options")
clickedFunction: function() {
2024-12-31 04:16:52 +01:00
configContentDrawer.openTriggered()
2023-07-14 13:14:50 +09:00
}
MouseArea {
anchors.fill: button
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
DividerType {}
2024-02-16 15:24:06 +05:00
DrawerType2 {
2023-07-14 13:14:50 +09:00
id: configContentDrawer
2024-02-16 15:24:06 +05:00
expandedHeight: root.height * 0.9
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
parent: root
anchors.fill: parent
2023-07-14 13:14:50 +09:00
2024-12-31 04:16:52 +01:00
expandedStateContent: Item {
2024-02-16 15:24:06 +05:00
implicitHeight: configContentDrawer.expandedHeight
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
BackButtonType {
2024-04-18 17:54:55 +04:00
id: backButton1
2024-02-16 15:24:06 +05:00
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 16
backButtonFunction: function() {
2024-12-31 04:16:52 +01:00
configContentDrawer.closeTriggered()
2024-02-16 15:24:06 +05:00
}
2023-07-14 13:14:50 +09:00
}
2024-02-16 15:24:06 +05:00
FlickableType {
2024-04-18 17:54:55 +04:00
anchors.top: backButton1.bottom
2024-02-16 15:24:06 +05:00
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: configContent.implicitHeight + configContent.anchors.topMargin + configContent.anchors.bottomMargin
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
ColumnLayout {
id: configContent
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
anchors.fill: parent
anchors.rightMargin: 16
anchors.leftMargin: 16
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
Header2Type {
Layout.fillWidth: true
Layout.topMargin: 16
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
headerText: qsTr("Connection options %1").arg(protocolName)
}
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
TextArea {
id: configText
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
padding: 0
leftPadding: 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
2024-02-16 15:24:06 +05:00
font.pixelSize: 16
font.weight: Font.Medium
font.family: "PT Root UI VF"
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
text: rawConfig
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
wrapMode: Text.Wrap
2023-07-14 13:14:50 +09:00
2024-02-16 15:24:06 +05:00
background: Rectangle {
2024-07-07 13:42:38 +03:00
color: AmneziaStyle.color.transparent
2024-02-16 15:24:06 +05:00
}
2023-07-14 13:14:50 +09:00
}
}
}
}
}
}
}
}
LabelWithButtonType {
id: removeButton
width: parent.width
2024-02-19 19:54:15 +05:00
visible: ServersModel.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)
InstallController.removeProcessedContainer()
}
2024-02-16 15:24:06 +05:00
var noButtonFunction = function() {
2024-04-18 17:54:55 +04:00
if (!GC.isMobile()) {
focusItem.forceActiveFocus()
}
}
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 {}
}
}
}