replace FlickableType with ListViewType in PageSetupWizardApiServiceInfo

This commit is contained in:
Cyril Anisimov
2025-07-26 15:26:16 +02:00
parent 23700ed914
commit 3315675c11
@@ -15,25 +15,31 @@ import "../Components"
PageType { PageType {
id: root id: root
FlickableType { BackButtonType {
id: fl id: backButton
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.left: parent.left
contentHeight: content.height + continueButton.implicitHeight + continueButton.anchors.bottomMargin + continueButton.anchors.topMargin anchors.right: parent.right
anchors.topMargin: 20
ColumnLayout { onFocusChanged: {
id: content if (this.activeFocus) {
listView.positionViewAtBeginning()
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: 0
BackButtonType {
id: backButton
Layout.topMargin: 20
} }
}
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
header: ColumnLayout {
width: listView.width
BaseHeaderType { BaseHeaderType {
Layout.fillWidth: true Layout.fillWidth: true
@@ -45,53 +51,28 @@ PageType {
headerText: ApiServicesModel.getSelectedServiceData("name") headerText: ApiServicesModel.getSelectedServiceData("name")
descriptionText: ApiServicesModel.getSelectedServiceData("serviceDescription") descriptionText: ApiServicesModel.getSelectedServiceData("serviceDescription")
} }
}
model: inputFields
spacing: 0
delegate: ColumnLayout {
width: listView.width
LabelWithImageType { LabelWithImageType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: 16 Layout.margins: 16
imageSource: "qrc:/images/controls/map-pin.svg" imageSource: imagePath
leftText: qsTr("For the region") leftText: lText
rightText: ApiServicesModel.getSelectedServiceData("region") rightText: rText
} }
}
LabelWithImageType { footer: ColumnLayout {
Layout.fillWidth: true width: listView.width
Layout.margins: 16
imageSource: "qrc:/images/controls/tag.svg" spacing: 0
leftText: qsTr("Price")
rightText: ApiServicesModel.getSelectedServiceData("price")
}
LabelWithImageType {
Layout.fillWidth: true
Layout.margins: 16
imageSource: "qrc:/images/controls/history.svg"
leftText: qsTr("Work period")
rightText: ApiServicesModel.getSelectedServiceData("timeLimit")
visible: rightText !== ""
}
LabelWithImageType {
Layout.fillWidth: true
Layout.margins: 16
imageSource: "qrc:/images/controls/gauge.svg"
leftText: qsTr("Speed")
rightText: ApiServicesModel.getSelectedServiceData("speed")
}
LabelWithImageType {
Layout.fillWidth: true
Layout.margins: 16
imageSource: "qrc:/images/controls/info.svg"
leftText: qsTr("Features")
rightText: ""
}
ParagraphTextType { ParagraphTextType {
Layout.fillWidth: true Layout.fillWidth: true
@@ -113,34 +94,84 @@ PageType {
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
} }
} }
}
}
BasicButtonType { BasicButtonType {
id: continueButton id: continueButton
anchors.right: parent.right Layout.fillWidth: true
anchors.left: parent.left Layout.topMargin: 32
anchors.bottom: parent.bottom Layout.bottomMargin: 32
Layout.leftMargin: 16
Layout.rightMargin: 16
anchors.topMargin: 32 text: qsTr("Connect")
anchors.rightMargin: 16
anchors.leftMargin: 16
anchors.bottomMargin: 32
text: qsTr("Connect") clickedFunc: function() {
var endpoint = ApiServicesModel.getStoreEndpoint()
clickedFunc: function() { if (endpoint !== undefined && endpoint !== "") {
var endpoint = ApiServicesModel.getStoreEndpoint() Qt.openUrlExternally(endpoint)
if (endpoint !== undefined && endpoint !== "") { PageController.closePage()
Qt.openUrlExternally(endpoint) PageController.closePage()
PageController.closePage() } else {
PageController.closePage() PageController.showBusyIndicator(true)
} else { ApiConfigsController.importServiceFromGateway()
PageController.showBusyIndicator(true) PageController.showBusyIndicator(false)
ApiConfigsController.importServiceFromGateway() }
PageController.showBusyIndicator(false) }
} }
} }
} }
property list<QtObject> inputFields: [
region,
price,
timeLimit,
speed,
features
]
QtObject {
id: region
readonly property string imagePath: "qrc:/images/controls/map-pin.svg"
readonly property string lText: qsTr("For the region")
readonly property string rText: ApiServicesModel.getSelectedServiceData("region")
property bool isVisible: true
}
QtObject {
id: price
readonly property string imagePath: "qrc:/images/controls/tag.svg"
readonly property string lText: qsTr("Price")
readonly property string rText: ApiServicesModel.getSelectedServiceData("price")
property bool isVisible: true
}
QtObject {
id: timeLimit
readonly property string imagePath: "qrc:/images/controls/history.svg"
readonly property string lText: qsTr("Work period")
readonly property string rText: ApiServicesModel.getSelectedServiceData("timeLimit")
property bool isVisible: rText !== ""
}
QtObject {
id: speed
readonly property string imagePath: "qrc:/images/controls/gauge.svg"
readonly property string lText: qsTr("Speed")
readonly property string rText: ApiServicesModel.getSelectedServiceData("speed")
property bool isVisible: true
}
QtObject {
id: features
readonly property string imagePath: "qrc:/images/controls/info.svg"
readonly property string lText: qsTr("Features")
readonly property string rText: ""
property bool isVisible: true
}
} }