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

117 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
anchors.topMargin: 20
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
}
HeaderType {
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")
}
}
2024-12-31 04:16:52 +01:00
ListView {
id: servers
objectName: "servers"
width: parent.width
anchors.top: header.bottom
anchors.topMargin: 16
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
height: 500
2024-04-18 17:54:55 +04:00
2024-12-31 04:16:52 +01:00
property bool isFocusable: true
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
clip: true
reuseItems: true
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)
let result = ApiSettingsController.getAccountInfo()
PageController.showBusyIndicator(false)
if (!result) {
return
}
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
} else {
PageController.goToPage(PageEnum.PageSettingsServerInfo)
}
}
}
2024-12-31 04:16:52 +01:00
DividerType {}
}
}
}
}