remove som unnecessary stuff

This commit is contained in:
Dorian Zedler 2020-10-31 15:16:53 +01:00
parent 77070aa98b
commit 0c7f5a42e4
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37

View file

@ -82,149 +82,6 @@ Page {
}
function updateData(params, openLoadingDl) {
if(openLoadingDl)
loadingDl.open()
// update all the given values
Object.assign(root.params, params)
loadData(root.params)
console.log("ready: " + root.ready + ": " + root.status)
if(openLoadingDl)
loadingDl.close()
}
function checkWidgetType(params, widgetData){
var widgetType
function hasParam(object, key, value){
if(object[key] !== undefined){
if(value !== undefined){
return object[key] === value
}
return true
}
return false
}
// check the type of the requested widget
if(hasParam(params, 'person')){
// person profile
widgetType = WidgetPage.WidgetType.Profile
}
else if(hasParam(params, 'nation')){
// competition calendar
widgetType = WidgetPage.WidgetType.Competitions
}
else if(hasParam(params, 'comp') && hasParam(params, 'type', 'starters')){
// registration
widgetType = WidgetPage.WidgetType.Registration
}
else if(hasParam(params, 'type', 'startlist') || (widgetData.participants !== undefined && widgetData.participants[0] && !widgetData.participants[0].result_rank && widgetData.discipline !== 'ranking')){
// startlist
widgetType = WidgetPage.WidgetType.Startlist
}
else if(hasParam(params, 'comp') && hasParam(params, 'cat')){
// results
widgetType = WidgetPage.WidgetType.Result
}
else if( hasParam(params, 'cat') && hasParam(params, 'cup') && !hasParam(params, 'comp')){
// ranking data
widgetType = WidgetPage.WidgetType.Ranking
}
else if(hasParam(params, 'type', 'nat_team_ranking') || hasParam(params, 'type', 'sektionenwertung') || hasParam(params, 'type', 'regionalzentren')){
// aggregated
widgetType = WidgetPage.WidgetType.Aggregated
}
return widgetType
}
Loader {
id: widgetLd
property alias selector: selectorPu
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
anchors.fill: parent
source: ""
function load() {
if(root.widgetType !== oldWidgetType){
oldWidgetType = root.widgetType
var calComp = Qt.createComponent(getFile(root.widgetType))//.createObject(null, {widgetData: root.widgetData, parent: widgetLd})
widgetLd.sourceComponent = calComp
//widgetLd.item.widgetData = root.widgetData
}
root.status = widgetLd.item.status
if(widgetLd.item.ready){
return true
}
else {
root.status = widgetLd.item.status === undefined ? 900:widgetLd.item.status
delete(widgetLd.sourceComponent)
return false
}
//
}
function getFile(widgetType) {
var path = "qrc:/Widgets/"
switch(widgetType){
case WidgetPage.WidgetType.Competitions:
path += "CalendarWidget"
break
case WidgetPage.WidgetType.Profile:
path += "ProfileWidget"
break
case WidgetPage.WidgetType.Registration:
path += "RegistrationWidget"
break
case WidgetPage.WidgetType.Startlist:
path += "StartlistWidget"
break
case WidgetPage.WidgetType.Result:
path += "ResultWidget"
break
case WidgetPage.WidgetType.Ranking:
path += "RankingWidget"
break
}
path += ".qml"
return path
}
function getItemProperty(key, defaultValue) {
if(widgetLd.item !== null && widgetLd.item.hasOwnProperty(key)) {
return key
}
else {
return defaultValue
}
}
}
Dialog {
id: selectorPu