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

109 lines
2.8 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
2025-08-27 15:15:53 +08:00
import SortFilterProxyModel 0.2
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
PageType {
id: root
BackButtonType {
id: backButton
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
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
2024-12-31 04:16:52 +01:00
anchors.top: backButton.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.topMargin: 16
header: ColumnLayout {
width: listView.width
2024-12-31 04:16:52 +01:00
BaseHeaderType {
Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
Layout.bottomMargin: 24
headerText: qsTr("VPN by Amnezia")
descriptionText: qsTr("Choose a VPN service that suits your needs.")
}
}
spacing: 0
2025-08-27 15:15:53 +08:00
model: SortFilterProxyModel {
id: proxyApiServicesModel
sourceModel: ApiServicesModel
sorters: RoleSorter {
roleName: "order"
sortOrder: Qt.AscendingOrder
}
}
delegate: ColumnLayout {
2024-12-31 04:16:52 +01:00
width: listView.width
enabled: isServiceAvailable
CardWithIconsType {
id: card
Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
Layout.bottomMargin: 16
headerText: name
bodyText: cardDescription
footerText: price
2026-04-08 11:21:12 +07:00
showRecommendedBadge: showRecommended && isServiceAvailable
recommendedText: qsTr("Recommended")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
onClicked: {
if (isServiceAvailable) {
2025-08-27 15:15:53 +08:00
ApiServicesModel.setServiceIndex(proxyApiServicesModel.mapToSource(index))
2026-04-08 11:21:12 +07:00
if (ApiServicesModel.getSelectedServiceType() === "amnezia-premium") {
PageController.goToPage(PageEnum.PageSetupWizardApiPremiumInfo)
} else {
PageController.goToPage(PageEnum.PageSetupWizardApiFreeInfo)
}
}
}
Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked()
}
}
}
}