replace FlickableType with ListViewType in PageProtocolRaw

This commit is contained in:
Cyril Anisimov
2025-07-26 17:01:41 +02:00
parent b8890db314
commit a1c380127a
+108 -122
View File
@@ -19,164 +19,154 @@ import "../Components"
PageType { PageType {
id: root id: root
ColumnLayout { BackButtonType {
id: header id: backButton
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.topMargin: 20 anchors.topMargin: 20
BackButtonType { onFocusChanged: {
id: backButton if (this.activeFocus) {
} listView.positionViewAtBeginning()
}
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: ContainersModel.getProcessedContainerName() + qsTr(" settings")
} }
} }
FlickableType { ListViewType {
id: fl id: listView
anchors.top: header.bottom
anchors.left: parent.left anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
contentHeight: content.height anchors.left: parent.left
Column { header: ColumnLayout {
id: content width: listView.width
anchors.top: parent.top BaseHeaderType {
anchors.left: parent.left Layout.fillWidth: true
anchors.right: parent.right Layout.leftMargin: 16
anchors.topMargin: 32 Layout.rightMargin: 16
Layout.bottomMargin: 16
ListView { headerText: ContainersModel.getProcessedContainerName() + qsTr(" settings")
id: listView }
width: parent.width }
height: contentItem.height
clip: true
interactive: false
model: ProtocolsModel
activeFocusOnTab: true model: ProtocolsModel
focus: true
delegate: Item { delegate: ColumnLayout {
implicitWidth: parent.width width: listView.width
implicitHeight: delegateContent.implicitHeight
property alias focusItem: button LabelWithButtonType {
id: button
ColumnLayout { Layout.fillWidth: true
id: delegateContent Layout.leftMargin: 16
Layout.rightMargin: 16
anchors.fill: parent text: qsTr("Show connection options")
LabelWithButtonType { clickedFunction: function() {
id: button configContentDrawer.openTriggered()
}
Layout.fillWidth: true MouseArea {
anchors.fill: button
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
text: qsTr("Show connection options") DividerType {}
clickedFunction: function() { DrawerType2 {
configContentDrawer.openTriggered() id: configContentDrawer
}
MouseArea { expandedHeight: root.height * 0.9
anchors.fill: button
cursorShape: Qt.PointingHandCursor parent: root
enabled: false anchors.fill: parent
expandedStateContent: Item {
implicitHeight: configContentDrawer.expandedHeight
BackButtonType {
id: drawerBackButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 16
backButtonFunction: function() {
configContentDrawer.closeTriggered()
}
}
ListViewType {
id: drawerListView
anchors.top: drawerBackButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
header: ColumnLayout {
width: drawerListView.width
Header2Type {
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Connection options %1").arg(protocolName)
} }
} }
DividerType {} model: 1 // fake model to force the ListView to be created without a model
DrawerType2 { delegate: ColumnLayout {
id: configContentDrawer width: drawerListView.width
expandedHeight: root.height * 0.9 TextArea {
id: configText
parent: root Layout.fillWidth: true
anchors.fill: parent Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
expandedStateContent: Item { padding: 0
implicitHeight: configContentDrawer.expandedHeight height: 24
BackButtonType { color: AmneziaStyle.color.paleGray
id: backButton1 selectionColor: AmneziaStyle.color.richBrown
selectedTextColor: AmneziaStyle.color.paleGray
anchors.top: parent.top font.pixelSize: 16
anchors.left: parent.left font.weight: Font.Medium
anchors.right: parent.right font.family: "PT Root UI VF"
anchors.topMargin: 16
backButtonFunction: function() { text: rawConfig
configContentDrawer.closeTriggered()
}
}
FlickableType { wrapMode: Text.Wrap
anchors.top: backButton1.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: configContent.implicitHeight + configContent.anchors.topMargin + configContent.anchors.bottomMargin
ColumnLayout { background: Rectangle {
id: configContent color: AmneziaStyle.color.transparent
anchors.fill: parent
anchors.rightMargin: 16
anchors.leftMargin: 16
Header2Type {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: qsTr("Connection options %1").arg(protocolName)
}
TextArea {
id: configText
Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16
padding: 0
leftPadding: 0
height: 24
color: AmneziaStyle.color.paleGray
selectionColor: AmneziaStyle.color.richBrown
selectedTextColor: AmneziaStyle.color.paleGray
font.pixelSize: 16
font.weight: Font.Medium
font.family: "PT Root UI VF"
text: rawConfig
wrapMode: Text.Wrap
background: Rectangle {
color: AmneziaStyle.color.transparent
}
}
}
} }
} }
} }
} }
} }
} }
}
footer: ColumnLayout {
width: listView.width
LabelWithButtonType { LabelWithButtonType {
id: removeButton id: removeButton
@@ -198,11 +188,7 @@ PageType {
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeProcessedContainer() InstallController.removeProcessedContainer()
} }
var noButtonFunction = function() { var noButtonFunction = function() {}
if (!GC.isMobile()) {
focusItem.forceActiveFocus()
}
}
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction) showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }