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 var updateData: root.updateData
property alias params: root.params property alias params: root.params
property alias currentWidgetData: root.widgetData property alias currentWidgetData: root.widgetData
property bool isTopElement: mainStack.currentItem === root
property var oldWidgetType: NaN property var oldWidgetType: NaN
@ -330,10 +331,14 @@ Page {
function appear(dataObj, title, subTitle) { function appear(dataObj, title, subTitle) {
if(dataObj.length > 0){ if(dataObj.length > 0){
selectorPu.dataObj = dataObj selectorPu.dataObj = dataObj
}
else {
selectorPu.dataObj = undefined
}
selectorPu.title = title selectorPu.title = title
selectorPu.subTitle = subTitle === undefined ? "":subTitle selectorPu.subTitle = subTitle === undefined ? "":subTitle
selectorPu.open() selectorPu.open()
}
} }
ListView { 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"), "") filterSelectPu.appear(compCats, qsTr("Select Filters"), "")
} }
@ -120,7 +124,7 @@ DataListView {
// function to scroll to the next competition that is not already over // function to scroll to the next competition that is not already over
var compList = control.widgetData["competitions"] var compList = control.widgetData["competitions"]
console.log("scrolling") //console.log("scrolling")
if(parseInt(control.year) === new Date().getFullYear()){ if(parseInt(control.year) === new Date().getFullYear()){
for(var i = 0; i < compList.length; i ++){ 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(){ function changeYear(){
@ -189,7 +196,7 @@ DataListView {
} }
} }
selector.appear(selectOptions, qsTr("select Year")) selector.appear(selectOptions, qsTr("select year"))
} }
function openCup(state, data) { function openCup(state, data) {
@ -316,7 +323,7 @@ DataListView {
target: parent.selector target: parent.selector
onSelectionFinished: { onSelectionFinished: {
if(data.comp !== undefined){ 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':''}) app.openWidget({comp: data.comp, cat: data.cat, type:data.status === 4 ? 'starters':''})
} }
else if(data.year !== undefined){ else if(data.year !== undefined){
@ -355,11 +362,13 @@ DataListView {
property var cats: thisData["cats"] property var cats: thisData["cats"]
property int catId: thisData["cat_id"] === undefined ? 0:thisData["cat_id"] property int catId: thisData["cat_id"] === undefined ? 0:thisData["cat_id"]
width: parent.width property bool includedByFilter: control.displayedCompCats.indexOf(parseInt(thisData['cat_id'])) >= 0
height: visible ? compDelCol.height + 10 : 0
enabled: thisData["cats"] !== undefined && thisData["cats"].length > 0 width: parent.width
visible: control.displayedCompCats.indexOf(parseInt(thisData['cat_id'])) >= 0 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 opacity: 0
scale: 0.9 scale: 0.9
@ -367,14 +376,30 @@ DataListView {
Connections { Connections {
target: control target: control
onDisplayedCompCatsChanged: { onDisplayedCompCatsChanged: {
//console.log("filters changed") competitionDel.includedByFilter = control.displayedCompCats.indexOf(parseInt(competitionDel.thisData['cat_id'])) >= 0
competitionDel.visible = control.displayedCompCats.indexOf(parseInt(competitionDel.thisData['cat_id'])) >= 0
} }
} }
onThisDataChanged: { onThisDataChanged: {
if(includedByFilter){
fadeInPa.start() fadeInPa.start()
} }
}
onIncludedByFilterChanged: {
if(includedByFilter){
fadeInPa.start()
}
else {
fadeOutPa.start()
}
}
Behavior on height {
NumberAnimation {
duration: 400
}
}
onClicked: { onClicked: {
control.openComp(index) control.openComp(index)
@ -386,6 +411,12 @@ DataListView {
NumberAnimation { target: competitionDel; property: "scale"; from: 0.8; to: 1.0; duration: 400 } 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 { Rectangle {
id: delBackroundRect id: delBackroundRect
@ -580,7 +611,7 @@ DataListView {
function getCheckedState() { function getCheckedState() {
for(var i = 0; i < filterSelectPu.dataObj[index].data.cat_id.length; i ++){ 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){ if(control.displayedCompCats.indexOf(filterSelectPu.dataObj[index].data.cat_id[i] ) >= 0){
return true return true
} }

View file

@ -194,7 +194,7 @@ DataListView {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft 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 { Label {

View file

@ -171,7 +171,7 @@ DataListView {
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
minimumPixelSize: 1 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 { Label {

View file

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