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

113 lines
3.3 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ContainerProps 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
2023-06-05 15:49:10 +08:00
ColumnLayout {
id: header
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + PageController.safeAreaTopMargin
2023-06-05 15:49:10 +08:00
BackButtonType {
2024-04-18 17:54:55 +04:00
id: backButton
2023-06-05 15:49:10 +08:00
}
2025-05-02 23:54:36 -07:00
BaseHeaderType {
2023-06-05 15:49:10 +08:00
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
2023-06-05 15:49:10 +08:00
2023-07-24 16:33:58 +09:00
headerText: qsTr("Servers")
}
}
ListViewType {
2024-12-31 04:16:52 +01:00
id: servers
objectName: "servers"
width: parent.width
anchors.top: header.bottom
anchors.topMargin: 16
anchors.bottom: parent.bottom
2024-12-31 04:16:52 +01:00
anchors.left: parent.left
anchors.right: parent.right
2024-04-18 17:54:55 +04:00
2024-12-31 04:16:52 +01:00
model: ServersModel
2024-12-31 04:16:52 +01:00
delegate: Item {
implicitWidth: servers.width
implicitHeight: delegateContent.implicitHeight
ColumnLayout {
id: delegateContent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
LabelWithButtonType {
id: server
Layout.fillWidth: true
text: name
descriptionText: {
var servicesNameString = ""
var servicesName = ServersUiController.getAllInstalledServicesName(index)
2024-12-31 04:16:52 +01:00
for (var i = 0; i < servicesName.length; i++) {
servicesNameString += servicesName[i] + " · "
2024-04-18 17:54:55 +04:00
}
2026-05-28 10:57:08 +08:00
if (ServersUiController.isServerFromApi(serverId)) {
2024-12-31 04:16:52 +01:00
return servicesNameString + serverDescription
} else {
return servicesNameString + hostName
}
2024-12-31 04:16:52 +01:00
}
rightImageSource: "qrc:/images/controls/chevron-right.svg"
2024-12-31 04:16:52 +01:00
clickedFunction: function() {
2026-05-28 10:57:08 +08:00
ServersUiController.setProcessedServerId(serverId)
2026-05-28 10:57:08 +08:00
if (ServersUiController.isServerFromApi(ServersUiController.processedServerId)) {
PageController.showBusyIndicator(true)
2026-05-28 10:57:08 +08:00
let result = SubscriptionUiController.getAccountInfo(ServersUiController.processedServerId, false)
PageController.showBusyIndicator(false)
if (!result) {
return
}
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
2026-05-15 16:32:47 +08:00
} else if (ServersModel.getProcessedServerData("isXRayConfigSelectionAvailable")) {
PageController.goToPage(PageEnum.PageSettingsXRayServerInfo)
} else {
PageController.goToPage(PageEnum.PageSettingsServerInfo)
}
}
}
2024-12-31 04:16:52 +01:00
DividerType {}
}
}
}
}