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

112 lines
3.1 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 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
2025-11-04 11:43:36 +08:00
anchors.topMargin: 20 + SettingsController.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 = ServersModel.getAllInstalledServicesName(index)
for (var i = 0; i < servicesName.length; i++) {
servicesNameString += servicesName[i] + " · "
2024-04-18 17:54:55 +04:00
}
2024-12-31 04:16:52 +01:00
if (ServersModel.isServerFromApi(index)) {
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() {
ServersModel.processedIndex = index
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
PageController.showBusyIndicator(true)
2025-02-22 14:42:09 +07:00
let result = ApiSettingsController.getAccountInfo(false)
PageController.showBusyIndicator(false)
if (!result) {
return
}
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
} else {
PageController.goToPage(PageEnum.PageSettingsServerInfo)
}
}
}
2024-12-31 04:16:52 +01:00
DividerType {}
}
}
}
}