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

108 lines
2.6 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
PageType {
id: root
defaultActiveFocusItem: focusItem
2024-11-21 14:45:28 +07:00
ColumnLayout {
id: header
anchors.top: parent.top
2024-11-21 14:45:28 +07:00
anchors.left: parent.left
anchors.right: parent.right
2024-11-21 14:45:28 +07:00
spacing: 0
2024-11-21 14:45:28 +07:00
Item {
id: focusItem
KeyNavigation.tab: backButton
}
2024-11-21 14:45:28 +07:00
BackButtonType {
id: backButton
Layout.topMargin: 20
// KeyNavigation.tab: fileButton.rightButton
}
2024-11-21 14:45:28 +07:00
HeaderType {
Layout.fillWidth: true
Layout.topMargin: 8
Layout.rightMargin: 16
Layout.leftMargin: 16
Layout.bottomMargin: 16
2024-11-21 14:45:28 +07:00
headerText: qsTr("VPN by Amnezia")
descriptionText: qsTr("Choose a VPN service that suits your needs.")
}
}
2024-11-21 14:45:28 +07:00
ListView {
id: servicesListView
anchors.top: header.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.topMargin: 16
anchors.bottomMargin: 16
spacing: 16
2024-11-21 14:45:28 +07:00
currentIndex: 1
clip: true
model: ApiServicesModel
ScrollBar.vertical: ScrollBar {
id: scrollBar
policy: servicesListView.height >= servicesListView.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
}
2024-11-21 14:45:28 +07:00
Keys.onUpPressed: scrollBar.decrease()
Keys.onDownPressed: scrollBar.increase()
2024-11-21 14:45:28 +07:00
delegate: Item {
implicitWidth: servicesListView.width
implicitHeight: delegateContent.implicitHeight
2024-11-21 14:45:28 +07:00
ColumnLayout {
id: delegateContent
2024-11-21 14:45:28 +07:00
anchors.fill: parent
2024-11-21 14:45:28 +07:00
CardWithIconsType {
id: card
2024-11-21 14:45:28 +07:00
Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
2024-11-21 14:45:28 +07:00
headerText: name
bodyText: cardDescription
footerText: price
2024-11-21 14:45:28 +07:00
rightImageSource: "qrc:/images/controls/chevron-right.svg"
2024-11-21 14:45:28 +07:00
enabled: isServiceAvailable
2024-11-21 14:45:28 +07:00
onClicked: {
if (isServiceAvailable) {
ApiServicesModel.setServiceIndex(index)
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
}
}
}
}
}
}
}