Skip to content

Commit

Permalink
bugfix: fixed scrolling by keys on PageSettingsApiServerInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Nethius committed Jan 26, 2025
1 parent 52ecd68 commit 36045c6
Showing 1 changed file with 79 additions and 38 deletions.
117 changes: 79 additions & 38 deletions client/ui/qml/Pages2/PageSettingsApiServerInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,100 @@ import "../Components"
PageType {
id: root

FlickableType {
id: fl
anchors.top: parent.top
anchors.bottom: parent.bottom
contentHeight: content.height
property list<QtObject> labelsModel: [
regionObject,
priceObject,
endDateObject,
speedObject
]

QtObject {
id: regionObject

readonly property string title: qsTr("For the region")
readonly property string contentKey: "region"
readonly property string objectImageSource: "qrc:/images/controls/map-pin.svg"
}

ColumnLayout {
id: content
QtObject {
id: priceObject

anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
readonly property string title: qsTr("Price")
readonly property string contentKey: "price"
readonly property string objectImageSource: "qrc:/images/controls/tag.svg"
}

spacing: 0
QtObject {
id: endDateObject

LabelWithImageType {
Layout.fillWidth: true
Layout.margins: 16
readonly property string title: qsTr("Valid until")
readonly property string contentKey: "endDate"
readonly property string objectImageSource: "qrc:/images/controls/history.svg"
}

imageSource: "qrc:/images/controls/map-pin.svg"
leftText: qsTr("For the region")
rightText: ApiServicesModel.getSelectedServiceData("region")
}
QtObject {
id: speedObject

LabelWithImageType {
Layout.fillWidth: true
Layout.margins: 16
readonly property string title: qsTr("Speed")
readonly property string contentKey: "speed"
readonly property string objectImageSource: "qrc:/images/controls/gauge.svg"
}

imageSource: "qrc:/images/controls/tag.svg"
leftText: qsTr("Price")
rightText: ApiServicesModel.getSelectedServiceData("price")
}
ListView {
id: listView
anchors.fill: parent

LabelWithImageType {
property bool showSubscriptionEndDate: ServersModel.getProcessedServerData("isCountrySelectionAvailable")
property bool isFocusable: true

Layout.fillWidth: true
Layout.margins: 16
Keys.onTabPressed: {
FocusController.nextKeyTabItem()
}

imageSource: "qrc:/images/controls/history.svg"
leftText: showSubscriptionEndDate ? qsTr("Valid until") : qsTr("Work period")
rightText: showSubscriptionEndDate ? ApiServicesModel.getSelectedServiceData("endDate")
: ApiServicesModel.getSelectedServiceData("workPeriod")
Keys.onBacktabPressed: {
FocusController.previousKeyTabItem()
}

visible: rightText !== ""
}
Keys.onUpPressed: {
FocusController.nextKeyUpItem()
}

Keys.onDownPressed: {
FocusController.nextKeyDownItem()
}

Keys.onLeftPressed: {
FocusController.nextKeyLeftItem()
}

Keys.onRightPressed: {
FocusController.nextKeyRightItem()
}

ScrollBar.vertical: ScrollBarType {}

model: labelsModel
clip: true
reuseItems: true

delegate: ColumnLayout {
width: listView.width
spacing: 0

LabelWithImageType {
Layout.fillWidth: true
Layout.margins: 16

imageSource: "qrc:/images/controls/gauge.svg"
leftText: qsTr("Speed")
rightText: ApiServicesModel.getSelectedServiceData("speed")
imageSource: objectImageSource
leftText: title
rightText: ApiServicesModel.getSelectedServiceData(contentKey)

visible: rightText !== ""
}
}

footer: ColumnLayout {
width: listView.width
spacing: 0

ParagraphTextType {
Layout.fillWidth: true
Expand All @@ -88,6 +127,8 @@ PageType {
return text.replace("%1", LanguageModel.getCurrentSiteUrl())
}

visible: text !== ""

MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
Expand Down

0 comments on commit 36045c6

Please sign in to comment.