2019-04-27 22:48:06 +02:00
|
|
|
import QtQuick 2.9
|
2019-04-20 22:57:40 +02:00
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtQuick.Controls.Material 2.3
|
|
|
|
|
|
|
|
import "../Components"
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: root
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
title: (nation === "" ? "IFSC":nation === "GER" ? "DAV":"SAC") + " " + qsTr("competition calendar")
|
|
|
|
|
|
|
|
property bool ready
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
property Component headerComponent: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Row {
|
|
|
|
anchors.fill: parent
|
2019-04-27 22:48:06 +02:00
|
|
|
anchors.rightMargin: 5
|
2019-04-21 18:35:28 +02:00
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
spacing: width * 0.05
|
2019-04-21 18:35:28 +02:00
|
|
|
|
|
|
|
Label {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
width: parent.width * 0.4
|
2019-04-21 18:35:28 +02:00
|
|
|
height: parent.height * 0.6
|
|
|
|
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
font.pixelSize: height
|
2019-04-22 12:38:23 +02:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2019-04-27 22:48:06 +02:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
minimumPixelSize: 1
|
2019-04-21 18:35:28 +02:00
|
|
|
|
|
|
|
text: root.year
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2019-04-27 22:48:06 +02:00
|
|
|
id:yearToolBt
|
2019-04-21 18:35:28 +02:00
|
|
|
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
height: parent.height * 0.5
|
2019-04-27 22:48:06 +02:00
|
|
|
width: parent.width * 0.25
|
2019-04-21 18:35:28 +02:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
yearSelectPu.open()
|
|
|
|
}
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
onPressed: yearToolBt.scale = 0.9
|
|
|
|
onReleased: yearToolBt.scale = 1.0
|
2019-04-21 18:35:28 +02:00
|
|
|
|
|
|
|
background: Image {
|
2019-04-27 22:48:06 +02:00
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
source: "qrc:/icons/calendar.png"
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
height: parent.height > parent.width ? parent.width : parent.height
|
|
|
|
width: height
|
|
|
|
|
|
|
|
mipmap: true
|
|
|
|
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
Behavior on scale {
|
|
|
|
PropertyAnimation {
|
|
|
|
duration: 100
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: cupToolBt
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
height: parent.height * 0.5
|
|
|
|
width: parent.width * 0.25
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
cupSelectPu.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
onPressed: cupToolBt.scale = 0.9
|
|
|
|
onReleased: cupToolBt.scale = 1.0
|
|
|
|
|
|
|
|
background: Image {
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
|
|
source: "qrc:/icons/cup.png"
|
|
|
|
|
|
|
|
height: parent.height > parent.width ? parent.width : parent.height
|
2019-04-21 18:35:28 +02:00
|
|
|
width: height
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
mipmap: true
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
Behavior on scale {
|
|
|
|
PropertyAnimation {
|
|
|
|
duration: 100
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
property string nation: ""
|
2019-04-21 18:35:28 +02:00
|
|
|
property int year: new Date().getFullYear()
|
2019-04-20 22:57:40 +02:00
|
|
|
property int status: -1
|
2019-04-21 18:35:28 +02:00
|
|
|
property var calendarData
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
Component.onCompleted: {
|
2019-04-22 12:38:23 +02:00
|
|
|
root.ready = loadData(root.nation, root.year)
|
2019-04-21 12:35:11 +02:00
|
|
|
}
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
function loadData(nation, year) {
|
2019-04-21 12:35:11 +02:00
|
|
|
loadingDl.open()
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
//console.log("loading calendar data and old data is: " + (root.calendarData !== undefined) + " because of: " + root.calendarData + " and: ")
|
|
|
|
|
|
|
|
root.status = 905
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
var ret = serverConn.getCalendar(nation, year)
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
if(ret["status"] === 200){
|
|
|
|
root.status = 200
|
2019-04-21 18:35:28 +02:00
|
|
|
root.calendarData = ret["data"]
|
2019-04-20 22:57:40 +02:00
|
|
|
calendarList.listData = ret["data"]["competitions"]
|
2019-04-27 22:48:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
2019-04-22 12:38:23 +02:00
|
|
|
else if (root.calendarData !== undefined ){
|
|
|
|
// there is still old data available
|
|
|
|
root.status = 902
|
|
|
|
//console.log("old data")
|
|
|
|
}
|
2019-04-20 22:57:40 +02:00
|
|
|
else {
|
2019-04-21 18:35:28 +02:00
|
|
|
root.status = parseInt(ret["status"])
|
2019-04-22 12:38:23 +02:00
|
|
|
app.errorCode = parseInt(ret["status"])
|
|
|
|
root.calendarData = ({})
|
|
|
|
calendarList.listData = ({})
|
|
|
|
//console.log("error: " + root.status)
|
|
|
|
loadingDl.close()
|
|
|
|
app.errorCode = root.status
|
|
|
|
return false
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
2019-04-22 12:38:23 +02:00
|
|
|
|
2019-04-21 12:35:11 +02:00
|
|
|
loadingDl.close()
|
2019-04-22 12:38:23 +02:00
|
|
|
app.errorCode = root.status
|
2019-04-27 22:48:06 +02:00
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
return true
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-04-21 12:35:11 +02:00
|
|
|
DataListView {
|
2019-04-20 22:57:40 +02:00
|
|
|
id: calendarList
|
|
|
|
|
|
|
|
property var listData
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2019-04-21 12:35:11 +02:00
|
|
|
//boundsBehavior: Flickable.StopAtBounds
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
model: listData.length
|
|
|
|
|
2019-04-21 12:35:11 +02:00
|
|
|
status: root.status
|
|
|
|
|
|
|
|
onRefresh: {
|
2019-04-21 18:35:28 +02:00
|
|
|
root.loadData(root.nation, root.year)
|
2019-04-21 12:35:11 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
onModelChanged: {
|
|
|
|
autoScroll()
|
|
|
|
}
|
|
|
|
|
|
|
|
function autoScroll() {
|
|
|
|
if(parseInt(root.year) === new Date().getFullYear()){
|
|
|
|
for(var i = 0; i < listData.length; i ++){
|
|
|
|
// get the start date pf the competition
|
|
|
|
var startDate = Date.fromLocaleString(Qt.locale(), calendarList.listData[i]["date"], "yyyy-MM-dd")
|
|
|
|
|
|
|
|
// get the duration of the competition
|
|
|
|
var durationString = calendarList.listData[i]["duration"] === undefined ? "1":calendarList.listData[i]["duration"]
|
|
|
|
var days = parseInt(durationString.replace(/\D/g,''))
|
|
|
|
// calculate the end date of the competition
|
|
|
|
var endDate = new Date(startDate.valueOf())
|
|
|
|
endDate.setDate(endDate.getDate() + days);
|
|
|
|
|
|
|
|
//console.log(calendarList.listData[i]["date"] + ": " + startDate + " to " + endDate)
|
|
|
|
|
|
|
|
if(endDate.getTime() < new Date().getTime()){
|
|
|
|
// end date is already over -> move the list view up!
|
|
|
|
calendarList.positionViewAtIndex(i, ListView.Top)
|
|
|
|
//console.log("moving down!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
delegate: ItemDelegate {
|
|
|
|
id: competitionDel
|
|
|
|
|
|
|
|
property string name: calendarList.listData[index]["name"]
|
|
|
|
property string date: calendarList.listData[index]["date_span"]
|
|
|
|
property var cats: calendarList.listData[index]["cats"]
|
|
|
|
property int catId: calendarList.listData[index]["cat_id"]
|
2019-04-27 22:48:06 +02:00
|
|
|
property bool over
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: compDelCol.height + 10
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
enabled: calendarList.listData[index]["cats"] !== undefined && calendarList.listData[index]["cats"].length > 0
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
onClicked: {
|
2019-04-27 22:48:06 +02:00
|
|
|
catSelectPu.appear(index, false)
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: delBackroundRect
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
opacity: 0.5
|
|
|
|
|
|
|
|
color: app.competitionCategoryColors[catId]
|
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: compDelCol
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
|
|
width: parent.width * 0.97
|
|
|
|
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: nameLa
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
font.bold: true
|
|
|
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
|
|
|
text: name
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: dateLa
|
|
|
|
|
|
|
|
color: "grey"
|
|
|
|
|
|
|
|
text: date
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: catIdLa
|
|
|
|
|
|
|
|
color: "grey"
|
|
|
|
|
|
|
|
text: catId
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: bottomLineRa
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
height: 1
|
|
|
|
|
|
|
|
color: "lightgrey"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Dialog {
|
|
|
|
id: catSelectPu
|
|
|
|
|
|
|
|
property int index: -1
|
2019-04-27 22:48:06 +02:00
|
|
|
property bool cupCat: false
|
|
|
|
property var catObj: undefined
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
x: 0 //root.width / 2 - width / 2
|
|
|
|
y: root.height - height //root.height / 2 - height / 2
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
width: root.width
|
|
|
|
height: catsLv.height //root.height * 0.6
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
modal: true
|
|
|
|
focus: true
|
|
|
|
|
|
|
|
title: qsTr("select category")
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
function appear(index, cupCat) {
|
|
|
|
catSelectPu.cupCat = cupCat
|
2019-04-20 22:57:40 +02:00
|
|
|
catSelectPu.index = index
|
2019-04-27 22:48:06 +02:00
|
|
|
|
|
|
|
if(cupCat){
|
|
|
|
catSelectPu.catObj = root.calendarData["cups"][index]["cats"]
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
catSelectPu.catObj = calendarList.listData[index]["cats"]
|
|
|
|
}
|
|
|
|
|
|
|
|
catSelectPu.open()
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
function getText(index){
|
|
|
|
// ----------------------------
|
|
|
|
// get the text
|
|
|
|
// returns list with [catId, catName]
|
|
|
|
|
|
|
|
if(catSelectPu.cupCat){
|
|
|
|
var catName // category name
|
|
|
|
var catId // category id
|
|
|
|
|
|
|
|
for(var i = 0; i < root.calendarData["cats"].length; i ++ ){
|
|
|
|
//console.log("checking " + i + ": cat: " + parseInt(listData["categorys"][i]["GrpId"]) + " searched cat: " + root.catId)
|
|
|
|
if(root.calendarData["cats"][i]["rkey"] === root.calendarData["cups"][catSelectPu.index]["cats"][index] && root.calendarData["cats"][i]["sex"] !== undefined){
|
|
|
|
catName = root.calendarData["cats"][i]["name"]
|
|
|
|
catId = root.calendarData["cats"][i]["GrpId"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [catId, catName]
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return [catSelectPu.catObj[index]["GrpId"], catSelectPu.catObj[index]["name"]]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
2019-04-20 22:57:40 +02:00
|
|
|
id: catsLv
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
property int delegateHeight: 50
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
width: parent.width
|
2019-04-27 22:48:06 +02:00
|
|
|
height: root.height * 0.6 < ( (delegateHeight + spacing) * model ) ? root.height * 0.6 : (delegateHeight + spacing) * model + 75
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
model: catSelectPu.catObj !== undefined ? catSelectPu.catObj.length:0
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
ScrollIndicator.vertical: ScrollIndicator {
|
|
|
|
parent: catsLv.parent
|
|
|
|
anchors {
|
|
|
|
top: catsLv.top
|
|
|
|
left: catsLv.right
|
|
|
|
margins: 10
|
|
|
|
leftMargin: 3
|
|
|
|
bottom: catsLv.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
delegate: Button {
|
|
|
|
id: catBt
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
property var catData: catSelectPu.getText(index)
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
width: parent.width
|
2019-04-27 22:48:06 +02:00
|
|
|
height: text !== "" ? catsLv.delegateHeight:0
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
flat: true
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
text: catData[1]
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
catSelectPu.close()
|
2019-04-27 22:48:06 +02:00
|
|
|
app.openResults( catSelectPu.cupCat ? root.calendarData["cups"][catSelectPu.index]["SerId"]:calendarList.listData[catSelectPu.index]["WetId"], catData[0], catSelectPu.cupCat ? -1:catSelectPu.catObj[index]["status"] )
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
enter: Transition {
|
|
|
|
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
|
|
|
|
NumberAnimation {
|
|
|
|
property: "y"
|
|
|
|
from: root.height - catSelectPu.height * 0.7
|
|
|
|
to: root.height - catSelectPu.height
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit: Transition {
|
|
|
|
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
|
|
|
|
NumberAnimation {
|
|
|
|
property: "y"
|
|
|
|
from: root.height - catSelectPu.height
|
|
|
|
to: root.height - catSelectPu.height * 0.7
|
|
|
|
}
|
|
|
|
}
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
Dialog {
|
|
|
|
id: yearSelectPu
|
|
|
|
|
|
|
|
property var yearList: root.calendarData["years"]
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
x: 0 //root.width / 2 - width / 2
|
|
|
|
y: root.height - height //root.height / 2 - height / 2
|
2019-04-21 18:35:28 +02:00
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
width: root.width
|
2019-04-21 18:35:28 +02:00
|
|
|
height: root.height * 0.6
|
|
|
|
|
|
|
|
modal: true
|
|
|
|
focus: true
|
|
|
|
|
|
|
|
title: qsTr("select year")
|
|
|
|
|
|
|
|
contentItem: ListView {
|
|
|
|
id: yearsLv
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: root.height * 0.6
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
model: yearSelectPu.yearList !== undefined ? yearSelectPu.yearList.length:0
|
2019-04-21 18:35:28 +02:00
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
clip: true
|
|
|
|
|
|
|
|
ScrollIndicator.vertical: ScrollIndicator {
|
|
|
|
parent: yearsLv.parent
|
|
|
|
anchors {
|
|
|
|
top: yearsLv.top
|
|
|
|
left: yearsLv.right
|
|
|
|
margins: 10
|
|
|
|
leftMargin: 3
|
|
|
|
bottom: yearsLv.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
delegate: Button {
|
|
|
|
id: yearBt
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
flat: true
|
|
|
|
|
|
|
|
text: yearSelectPu.yearList[index]
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
yearSelectPu.close()
|
|
|
|
root.year = yearSelectPu.yearList[index]
|
|
|
|
root.loadData(root.nation, root.year)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 22:48:06 +02:00
|
|
|
enter: Transition {
|
|
|
|
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
|
|
|
|
NumberAnimation {
|
|
|
|
property: "y"
|
|
|
|
from: root.height - yearSelectPu.height * 0.7
|
|
|
|
to: root.height - yearSelectPu.height
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit: Transition {
|
|
|
|
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
|
|
|
|
NumberAnimation {
|
|
|
|
property: "y"
|
|
|
|
from: root.height - yearSelectPu.height
|
|
|
|
to: root.height - yearSelectPu.height * 0.7
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Dialog {
|
|
|
|
id: cupSelectPu
|
|
|
|
|
|
|
|
property var cupList: getCupList()
|
|
|
|
|
|
|
|
function getCupList() {
|
|
|
|
if(root.nation === "") {
|
|
|
|
root.calendarData["cups"].unshift({"SerId":"","rkey":"","name":"Worldranking","modified":"2018-10-24 16:11:12","modifier":"","year":"","num_comps":"","cats":["ICC-COA","ICC-HD","ICC-MED","ICC_F","ICC_FB","ICC_FS","ICC_M","ICC_MB","ICC_MS"]})
|
|
|
|
}
|
|
|
|
return root.calendarData["cups"]
|
|
|
|
}
|
|
|
|
|
|
|
|
x: 0 //root.width / 2 - width / 2
|
|
|
|
y: root.height - height //root.height / 2 - height / 2
|
|
|
|
|
|
|
|
width: root.width
|
|
|
|
height: cupsLv.height //root.height * 0.6
|
|
|
|
|
|
|
|
modal: true
|
|
|
|
focus: true
|
|
|
|
|
|
|
|
title: qsTr("select cup")
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: cupsLv
|
|
|
|
|
|
|
|
property int delegateHeight: 50
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: root.height * 0.6 < ( (delegateHeight + spacing) * model ) ? root.height * 0.6 : (delegateHeight + spacing) * model + 75
|
|
|
|
|
|
|
|
model: cupSelectPu.cupList !== undefined ? cupSelectPu.cupList.length:0
|
|
|
|
|
|
|
|
ScrollIndicator.vertical: ScrollIndicator {
|
|
|
|
parent: cupsLv.parent
|
|
|
|
anchors {
|
|
|
|
top: cupsLv.top
|
|
|
|
left: cupsLv.right
|
|
|
|
margins: 10
|
|
|
|
leftMargin: 3
|
|
|
|
bottom: cupsLv.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: Button {
|
|
|
|
id: cupBt
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: cupsLv.delegateHeight
|
|
|
|
|
|
|
|
flat: true
|
|
|
|
|
|
|
|
text: cupSelectPu.cupList[index]["name"]
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
cupSelectPu.close()
|
|
|
|
catSelectPu.appear(index, true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enter: Transition {
|
|
|
|
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
|
|
|
|
NumberAnimation {
|
|
|
|
property: "y"
|
|
|
|
from: root.height - cupSelectPu.height * 0.7
|
|
|
|
to: root.height - cupSelectPu.height
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit: Transition {
|
|
|
|
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
|
|
|
|
NumberAnimation {
|
|
|
|
property: "y"
|
|
|
|
from: root.height - cupSelectPu.height
|
|
|
|
to: root.height - cupSelectPu.height * 0.7
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|