some minor improvements and fixes when using filters

This commit is contained in:
Dorian Zedler 2019-06-23 13:45:29 +02:00
parent 8aa2d31c40
commit 9d30a2c8ec
5 changed files with 73 additions and 24 deletions

View file

@ -179,6 +179,7 @@ Page {
property var updateData: root.updateData
property alias params: root.params
property alias currentWidgetData: root.widgetData
property bool isTopElement: mainStack.currentItem === root
property var oldWidgetType: NaN
@ -330,10 +331,14 @@ Page {
function appear(dataObj, title, subTitle) {
if(dataObj.length > 0){
selectorPu.dataObj = dataObj
}
else {
selectorPu.dataObj = undefined
}
selectorPu.title = title
selectorPu.subTitle = subTitle === undefined ? "":subTitle
selectorPu.open()
}
}
ListView {

View file

@ -61,6 +61,10 @@ DataListView {
}
}
compCats.sort(function(a, b) {
return a['data']['sort_rank'] - b['data']['sort_rank'];
});
filterSelectPu.appear(compCats, qsTr("Select Filters"), "")
}
@ -120,7 +124,7 @@ DataListView {
// function to scroll to the next competition that is not already over
var compList = control.widgetData["competitions"]
console.log("scrolling")
//console.log("scrolling")
if(parseInt(control.year) === new Date().getFullYear()){
for(var i = 0; i < compList.length; i ++){
@ -175,7 +179,10 @@ DataListView {
}
}
selector.appear(selectOptions, control.widgetData["competitions"][compIndex]['name'], getCompInfoUrl(compIndex) !== undefined ? ("<a href='" + getCompInfoUrl(compIndex) + "'>infosheet</a>"): "")
var infosheet = getCompInfoUrl(compIndex) !== undefined ? ("<a href='" + getCompInfoUrl(compIndex) + "'>" + qsTr('infosheet') + "</a>"): ""
var eventWebsite = control.widgetData["competitions"][compIndex]["homepage"] !== undefined ? ("<a href='" + control.widgetData["competitions"][compIndex]["homepage"] + "'>" + qsTr('Event Website') + "</a>"):""
selector.appear(selectOptions, control.widgetData["competitions"][compIndex]['name'], eventWebsite + ((eventWebsite !== "" && infosheet !== "") ? ", ":"") + infosheet )
}
function changeYear(){
@ -189,7 +196,7 @@ DataListView {
}
}
selector.appear(selectOptions, qsTr("select Year"))
selector.appear(selectOptions, qsTr("select year"))
}
function openCup(state, data) {
@ -316,7 +323,7 @@ DataListView {
target: parent.selector
onSelectionFinished: {
if(data.comp !== undefined){
console.log(data.status)
//console.log(data.status)
app.openWidget({comp: data.comp, cat: data.cat, type:data.status === 4 ? 'starters':''})
}
else if(data.year !== undefined){
@ -355,11 +362,13 @@ DataListView {
property var cats: thisData["cats"]
property int catId: thisData["cat_id"] === undefined ? 0:thisData["cat_id"]
width: parent.width
height: visible ? compDelCol.height + 10 : 0
property bool includedByFilter: control.displayedCompCats.indexOf(parseInt(thisData['cat_id'])) >= 0
enabled: thisData["cats"] !== undefined && thisData["cats"].length > 0
visible: control.displayedCompCats.indexOf(parseInt(thisData['cat_id'])) >= 0
width: parent.width
height: includedByFilter ? compDelCol.height + 10 : 0
enabled: (thisData["cats"] !== undefined && thisData["cats"].length > 0) || control.widgetData["competitions"][index]["homepage"] !== undefined || getCompInfoUrl(index) !== undefined
//visible: includedByFilter
opacity: 0
scale: 0.9
@ -367,14 +376,30 @@ DataListView {
Connections {
target: control
onDisplayedCompCatsChanged: {
//console.log("filters changed")
competitionDel.visible = control.displayedCompCats.indexOf(parseInt(competitionDel.thisData['cat_id'])) >= 0
competitionDel.includedByFilter = control.displayedCompCats.indexOf(parseInt(competitionDel.thisData['cat_id'])) >= 0
}
}
onThisDataChanged: {
if(includedByFilter){
fadeInPa.start()
}
}
onIncludedByFilterChanged: {
if(includedByFilter){
fadeInPa.start()
}
else {
fadeOutPa.start()
}
}
Behavior on height {
NumberAnimation {
duration: 400
}
}
onClicked: {
control.openComp(index)
@ -386,6 +411,12 @@ DataListView {
NumberAnimation { target: competitionDel; property: "scale"; from: 0.8; to: 1.0; duration: 400 }
}
ParallelAnimation {
id: fadeOutPa
NumberAnimation { target: competitionDel; property: "opacity"; from: 1; to: 0; duration: 400 }
NumberAnimation { target: competitionDel; property: "scale"; from: 1; to: 0.8; duration: 400 }
}
Rectangle {
id: delBackroundRect
@ -580,7 +611,7 @@ DataListView {
function getCheckedState() {
for(var i = 0; i < filterSelectPu.dataObj[index].data.cat_id.length; i ++){
console.log("checking cat " + filterSelectPu.dataObj[index].data.label )
//console.log("checking cat " + filterSelectPu.dataObj[index].data.label )
if(control.displayedCompCats.indexOf(filterSelectPu.dataObj[index].data.cat_id[i] ) >= 0){
return true
}

View file

@ -194,7 +194,7 @@ DataListView {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
text: partDel.thisData["firstname"] + " " + partDel.thisData["lastname"] + " (" + partDel.thisData["start_number"] + ")"
text: partDel.thisData["firstname"] + " " + partDel.thisData["lastname"] + (partDel.thisData["start_number"] !== undefined ? (" (" + partDel.thisData["start_number"] + ")"):"")
}
Label {

View file

@ -171,7 +171,7 @@ DataListView {
horizontalAlignment: Text.AlignLeft
minimumPixelSize: 1
text: widgetData[ "participants" ][index]["firstname"] + " " + widgetData[ "participants" ][index]["lastname"] + " (" + partDel.thisData["start_number"] + ")"
text: widgetData[ "participants" ][index]["firstname"] + " " + widgetData[ "participants" ][index]["lastname"] + (partDel.thisData["start_number"] !== undefined ? (" (" + partDel.thisData["start_number"] + ")"):"")
}
Label {

View file

@ -60,6 +60,7 @@ Window {
'label' : 'World Cups',
'nation' : 'ICC',
'bgcolor' : '#B8C8FF',
'sort_rank': 0,
'cat_id' : [69]
},
'youth' : {
@ -69,15 +70,16 @@ Window {
'serie_reg' : '^[0-9]{2,2}_EYC',
'rang_title': '',
'bgcolor' : '#D8E8FF',
'sort_rank': 1,
'cat_id' : [71,258]
},
'champandgames': {
'label': 'Championships and Games',
'cont': {
'label' : 'Continental Events',
'nation' : 'ICC',
'bgcolor' : '#B8C8FF',
'cat_id': [68,86]
'sort_rank': 2,
'cat_id' : [262]
},
'masters' : {
'label' : 'Masters and Promo Events',
'nation' : 'ICC',
@ -85,6 +87,7 @@ Window {
// 'serie_reg' : '^[0-9]{2,2}_(WC|TR){1,1}.*',
// 'rang_title': 'CUWR continuously updated WORLDRANKING',
'bgcolor' : '#F0F0F0',
'sort_rank': 3,
'cat_id' : [70]
},
'para' : {
@ -92,13 +95,15 @@ Window {
'nation' : 'ICC',
'wettk_reg' : '^[0-9]{2,2}_PE.*',
'bgcolor' : '#F0F0F0',
'sort_rank': 4,
'cat_id' : [256,259]
},
'cont': {
'label' : 'Continental Events',
'games': {
'label': 'Games',
'nation': 'ICC',
'bgcolor' : '#B8C8FF',
'cat_id' : [262]
'sort_rank': 5,
'cat_id': [68,86]
},
// --- GER ---
@ -128,10 +133,12 @@ Window {
'bgcolor' : '#A8F0A8', //'#e72e5d'
'cat_id' : [60]
},*/
'ger_meisterschaft' : {
'label' : 'Deutsche Meisterschaft',
'nation' : 'GER',
'bgcolor' : '#A8F0A8',
'sort_rank': 0,
'cat_id' : [57, 59, 60]
},
@ -142,6 +149,7 @@ Window {
'serie_reg' : '^[0-9]{2,2}_JC',
// 'rang_title': 'Deutsche Jugend RANGLISTE',
'bgcolor' : '#D8FFD8',
'sort_rank': 1,
'cat_id' : [58]
},
'ger_state' : {
@ -151,6 +159,7 @@ Window {
'serie_reg' : '^[0-9]{2,2}[_J]{1,1}LM.*',
'rang_title': '',
'bgcolor' : '#F0F0F0',
'sort_rank': 2,
'cat_id' : [61,56]
},
@ -163,6 +172,7 @@ Window {
'serie_reg' : '.*',
'rang_title': 'SWISS RANKING',
'bgcolor' : '#A8F0A8',
'sort_rank': 0,
'cat_id' : [62,63]
},
'sui_jugend' : {
@ -172,6 +182,7 @@ Window {
'serie_reg' : '.*',
'rang_title': 'SWISS RANKING',
'bgcolor' : '#D8FFD8',
'sort_rank': 1,
'cat_id' : [65]
},
'sui_local' : {
@ -180,6 +191,7 @@ Window {
'wettk_reg' : '^[0-9]{2,2}_RG_.*',
'rang_title': '',
'bgcolor' : '#F0F0F0',
'sort_rank': 2,
'cat_id' : [64]
},
'sui_ice' : {
@ -188,6 +200,7 @@ Window {
'wettk_reg' : '^[0-9]{2,2}_RC_.*',
'rang_title': '',
'bgcolor' : '#F0F0F0',
'sort_rank': 3,
'cat_id' : [84]
}
}