dorian
efbae668ab
- started to implement athlete view - fixed minor bug in boulder result view that made symbol and text mismath - fixed performance issues in ranking view
99 lines
2.9 KiB
QML
99 lines
2.9 KiB
QML
/*
|
|
blueROCK - for digital rock
|
|
Copyright (C) 2019 Dorian Zedler
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import QtQuick 2.9
|
|
import QtQuick.Controls 2.4
|
|
|
|
DataListView {
|
|
id: control
|
|
|
|
property var listData: ({})
|
|
|
|
model: listData[ root.listKey ] === undefined ? 0:listData[ root.listKey ].length
|
|
|
|
|
|
|
|
delegate: ItemDelegate {
|
|
id: partDel
|
|
|
|
property var thisData: listData[ "athletes" ][index]
|
|
|
|
width: parent.width
|
|
|
|
opacity: 0
|
|
scale: 0.9
|
|
|
|
onThisDataChanged: {
|
|
fadeInPa.start()
|
|
}
|
|
|
|
onClicked: {
|
|
app.openAthlete(thisData["PerId"])
|
|
}
|
|
|
|
ParallelAnimation {
|
|
id: fadeInPa
|
|
NumberAnimation { target: partDel; property: "opacity"; from: 0; to: 1.0; duration: 400 }
|
|
NumberAnimation { target: partDel; property: "scale"; from: 0.8; to: 1.0; duration: 400 }
|
|
}
|
|
|
|
text: ""
|
|
|
|
Label {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: parent.width * 0.05
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
fontSizeMode: Text.Fit
|
|
font.bold: true
|
|
font.pixelSize: Math.abs( height * 0.4 )
|
|
minimumPixelSize: height * 0.3
|
|
|
|
elide: "ElideRight"
|
|
|
|
text: control.getText(index)
|
|
}
|
|
}
|
|
|
|
function getText(index){
|
|
|
|
// ----------------------------
|
|
// if we have registration data
|
|
|
|
var fedName // federation name
|
|
|
|
if(listData["federations"] !== undefined){
|
|
// not an international competition -> get name of federation
|
|
|
|
for(var i = 0; i < listData["federations"].length; i ++ ){
|
|
//console.log("checking " + i + ": cat: " + parseInt(listData["categorys"][i]["GrpId"]) + " searched cat: " + root.catId)
|
|
if(listData["federations"][i]["fed_id"] === listData[ root.listKey ][index]["reg_fed_id"]){
|
|
fedName = listData["federations"][i]["shortcut"]
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
// an international competition -> get nation
|
|
|
|
fedName = listData[ root.listKey ][index]["nation"]
|
|
}
|
|
|
|
return listData[ "athletes" ][index]["firstname"] + " " + listData[ "athletes" ][index]["lastname"] + " (" + fedName + ")"
|
|
}
|
|
}
|