2023-05-22 00:10:51 +08:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
|
|
import PageEnum 1.0
|
|
|
|
|
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Controls2/TextTypes"
|
|
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
ListViewType {
|
2023-05-22 00:10:51 +08:00
|
|
|
id: menuContent
|
|
|
|
|
|
|
|
|
|
property var rootWidth
|
2024-02-19 19:54:15 +05:00
|
|
|
property var selectedText
|
2023-05-22 00:10:51 +08:00
|
|
|
|
|
|
|
|
width: rootWidth
|
2025-05-03 10:56:50 +04:00
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.bottom: parent.bottom
|
2023-05-22 00:10:51 +08:00
|
|
|
|
|
|
|
|
ButtonGroup {
|
|
|
|
|
id: containersRadioButtonGroup
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delegate: Item {
|
|
|
|
|
implicitWidth: rootWidth
|
2023-06-05 15:49:10 +08:00
|
|
|
implicitHeight: content.implicitHeight
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: content
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
|
anchors.leftMargin: 16
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
VerticalRadioButton {
|
|
|
|
|
id: containerRadioButton
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
Layout.fillWidth: true
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
text: name
|
|
|
|
|
descriptionText: description
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
ButtonGroup.group: containersRadioButtonGroup
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
imageSource: "qrc:/images/controls/download.svg"
|
|
|
|
|
showImage: !isInstalled
|
|
|
|
|
|
2024-04-07 01:42:17 +07:00
|
|
|
checkable: isInstalled && !ConnectionController.isConnected
|
2024-02-19 19:54:15 +05:00
|
|
|
checked: proxyDefaultServerContainersModel.mapToSource(index) === ServersModel.getDefaultServerData("defaultContainer")
|
2023-06-05 15:49:10 +08:00
|
|
|
|
2023-10-16 22:57:12 +05:00
|
|
|
onClicked: {
|
|
|
|
|
if (ConnectionController.isConnected && isInstalled) {
|
|
|
|
|
PageController.showNotificationMessage(qsTr("Unable change protocol while there is an active connection"))
|
|
|
|
|
return
|
2023-09-01 00:48:58 +05:00
|
|
|
}
|
|
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
if (checked) {
|
2024-12-31 04:16:52 +01:00
|
|
|
containersDropDown.closeTriggered()
|
2026-05-15 12:33:36 +08:00
|
|
|
ServersUiController.setDefaultContainer(ServersUiController.getServerId(ServersUiController.defaultServerIndex), proxyDefaultServerContainersModel.mapToSource(index))
|
2023-06-05 15:49:10 +08:00
|
|
|
} else {
|
2026-04-30 14:53:03 +08:00
|
|
|
ServersUiController.processedContainerIndex = proxyDefaultServerContainersModel.mapToSource(index)
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
|
2024-12-31 04:16:52 +01:00
|
|
|
containersDropDown.closeTriggered()
|
2023-06-05 15:49:10 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: containerRadioButton
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
enabled: false
|
2023-05-22 00:10:51 +08:00
|
|
|
}
|
2024-04-18 17:54:55 +04:00
|
|
|
|
|
|
|
|
Keys.onEnterPressed: {
|
|
|
|
|
if (checkable) {
|
|
|
|
|
checked = true
|
|
|
|
|
}
|
|
|
|
|
containerRadioButton.clicked()
|
|
|
|
|
}
|
|
|
|
|
Keys.onReturnPressed: {
|
|
|
|
|
if (checkable) {
|
|
|
|
|
checked = true
|
|
|
|
|
}
|
|
|
|
|
containerRadioButton.clicked()
|
|
|
|
|
}
|
2023-05-22 00:10:51 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
DividerType {
|
|
|
|
|
Layout.fillWidth: true
|
2023-05-22 00:10:51 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|