itat_challenge/res/gui/EventsPage.qml

276 lines
6.8 KiB
QML

import QtQuick
import QtQuick.Controls
Page {
id: root
header: ToolBar {
Label {
text: qsTr("Olympia 2024 Events")
font.pixelSize: 20
anchors.centerIn: parent
}
}
Column {
anchors.fill: parent
anchors.topMargin: 24
anchors.leftMargin: 48
anchors.bottomMargin: 48
anchors.rightMargin: 48
spacing: 24
Row {
// width: parent.width
// height: 50
spacing: 20
ComboBox {
width: 300
height: 50
displayText: "Discipline: " + currentText
model: myListModel
textRole: "text"
ListModel {
id: myListModel
ListElement {
text: "AquaticsArtisticSwimming"
api: "SWA"
}
ListElement {
text: "AquaticsDiving"
api: "DIV"
}
ListElement {
text: "AquaticsMarathonSwimming"
api: "OWS"
}
ListElement {
text: "AquaticsSwimming"
api: "SWM"
}
ListElement {
text: "AquaticsWaterPolo"
api: "WPO"
}
ListElement {
text: "Archery"
api: "ARC"
}
ListElement {
text: "Athletics"
api: "ATH"
}
ListElement {
text: "Badminton"
api: "BDM"
}
ListElement {
text: "Basketball3v3"
api: "BK3"
}
ListElement {
text: "Basketball"
api: "BKB"
}
ListElement {
text: "Boxing"
api: "BOX"
}
ListElement {
text: "Breaking"
api: "BKG"
}
ListElement {
text: "CanoeingSprint"
api: "CSP"
}
ListElement {
text: "CanoeingSlalom"
api: "CSL"
}
ListElement {
text: "CyclingBMXFreestyle"
api: "BMF"
}
ListElement {
text: "CyclingBMXRacing"
api: "BMX"
}
ListElement {
text: "CyclingMaountainBike"
api: "MTB"
}
ListElement {
text: "CyclingRoad"
api: "CRD"
}
ListElement {
text: "CyclingTrack"
api: "CTR"
}
ListElement {
text: "EquestrianDressage"
api: "EDR"
}
ListElement {
text: "EquestrianEventing"
api: "EVE"
}
ListElement {
text: "EquestrianJumping"
api: "EJP"
}
ListElement {
text: "Fencing"
api: "FEN"
}
ListElement {
text: "FieldHockey"
api: "HOC"
}
ListElement {
text: "Football"
api: "FBL"
}
ListElement {
text: "Golf"
api: "GLF"
}
ListElement {
text: "GymnasticsArtistic"
api: "GAR"
}
ListElement {
text: "GymnasticsRhythmic"
api: "GRY"
}
ListElement {
text: "GymnasticsTrampoline"
api: "GTR"
}
ListElement {
text: "HandballIndoor"
api: "HBL"
}
ListElement {
text: "Judo"
api: "JUD"
}
ListElement {
text: "ModernPentathlon"
api: "MPN"
}
ListElement {
text: "Rowing"
api: "ROW"
}
ListElement {
text: "Rugby7"
api: "RU7"
}
ListElement {
text: "Sailing"
api: "SAL"
}
ListElement {
text: "Shooting"
api: "SHO"
}
ListElement {
text: "Skateboarding"
api: "SKB"
}
ListElement {
text: "SportClimbing"
api: "CLB"
}
ListElement {
text: "Surfing"
api: "SRF"
}
ListElement {
text: "TableTennis"
api: "TTE"
}
ListElement {
text: "Taekwondo"
api: "TKW"
}
ListElement {
text: "Tennis"
api: "TEN"
}
ListElement {
text: "Triathlon"
api: "TRI"
}
ListElement {
text: "VolleyballBeach"
api: "VBV"
}
ListElement {
text: "VolleyballIndoor"
api: "VVO"
}
ListElement {
text: "Weightlifting"
api: "WLF"
}
ListElement {
text: "WrestlingFreestyle"
api: "WRE"
}
ListElement {
text: "WrestlingGrecoRoman"
api: "WRG"
}
}
Component.onCompleted: currentIndex = 5;
onActivated: {
if (currentIndex >= 0) {
console.log(currentValue.api);
sports.request(currentValue.api)
}
}
}
TextField {
height: 50
width: 200
placeholderText: "Search"
onTextChanged: filter.setFilterFixedString(text)
}
}
ListView {
id: listView
// anchors.fill: parent
// topMargin: 48
height: parent.height
width: parent.width
spacing: 20
model: filter
delegate: ItemDelegate {
required property string eventName
required property list<QtObject> competitors
text: eventName
width: listView.width - listView.leftMargin - listView.rightMargin
height: avatar.height
leftPadding: avatar.width + 16
onClicked: root.StackView.view.push("EventInfoPage.qml", { eventName, competitors })
Image {
id: avatar
height: 32
width: 32
source: "qrc:/qt/qml/itat/res/pictograms/" + sports.discipline + "_small.svg"
}
}
}
}
}