app/resources/qml/Pages/AthleteProfilePage.qml
Dorian Zedler efbae668ab - added nice animations for tool bar
- started to implement athlete view
- fixed minor bug in boulder result view that made symbol and text mismath
- fixed performance issues in ranking view
2019-05-12 21:33:22 +02:00

223 lines
6 KiB
QML

import QtQuick 2.9
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.3
import "../Components"
Page {
id: root
title: perData["firstname"] + " " + perData["lastname"]
property bool titleIsPageTitle: true
property bool ready
property int status: -1
property int perId: -1
property var perData: ({})
Component.onCompleted: {
if(root.loadData(root.perId)){
root.ready = true
}
}
function loadData(perId) {
console.log("loading athlete: ", perId)
root.status = 905
var ret = serverConn.getAthlete(perId)
root.status = ret["status"]
if(ret["status"] === 200){
root.perData = ret["data"]
return true
}
else {
return false
}
}
ScrollView {
id: mainSv
anchors.fill: parent
anchors.margins: 10
anchors.rightMargin: 14
contentWidth: parent.width - anchors.leftMargin - anchors.rightMargin
ScrollBar.vertical: ScrollBar {
anchors {
top: mainSv.top
left: mainSv.right
margins: 10
leftMargin: 3
bottom: mainSv.bottom
}
width: 8
active: true
}
Column {
id: mainCol
width: parent.width
Row {
height: root.height * 0.3
width: parent.width
Image {
id: photo
property bool ready: false
anchors.verticalCenter: parent.verticalCenter
height: parent.height * 0.9
width: status === Image.Null || status === Image.Error ? 0:parent.width * 0.5
fillMode: Image.PreserveAspectFit
source: perData["photo"] === undefined ? "":perData["photo"].replace("https", "http").replace("www.digitalrock.de", "egw.ifsc-climbing.org")
asynchronous: true
FancyBusyIndicator {
height: width
anchors.centerIn: parent
opacity: photo.status === Image.Loading
}
}
Column {
anchors.verticalCenter: parent.verticalCenter
height: parent.height * 0.9
width: parent.width - photo.width
Label {
height: parent.height * 0.2
width: parent.width
font.pixelSize: height * 0.6
font.bold: true
minimumPixelSize: 1
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: perData["firstname"] + " " + perData["lastname"]
}
Label {
height: parent.height * 0.2
width: parent.width
font.pixelSize: height * 0.6
font.bold: false
minimumPixelSize: 1
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: perData["nation"]
}
Label {
height: parent.height * 0.15
width: parent.width
font.pixelSize: height * 0.6
font.bold: false
minimumPixelSize: 1
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: "<html><a href='" + perData["fed_url"] + "'>" + perData["federation"] + "</a>"
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
Label {
height: parent.height * 0.15
width: parent.width
font.pixelSize: height * 0.6
font.bold: false
minimumPixelSize: 1
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr("age") + ": " + perData["age"]
}
Label {
height: parent.height * 0.15
width: parent.width
font.pixelSize: height * 0.6
font.bold: false
minimumPixelSize: 1
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr("year of birth") + ": " + perData["birthdate"]
}
Label {
height: parent.height * 0.15
width: parent.width
font.pixelSize: height * 0.6
font.bold: false
minimumPixelSize: 1
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr("city") + ": " + perData["city"]
}
}
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
wrapMode: Label.Wrap
text: perData["freetext"]
}
}
}
}