Merge v0.6.0 and v0.6.1 #29

Merged
dorian merged 30 commits from version/0.5.1 into master 2024-10-17 17:52:37 +02:00
8 changed files with 91 additions and 23 deletions
Showing only changes of commit 20ffca4670 - Show all commits

View file

@ -9,6 +9,7 @@ Dialog {
property string subTitle: "" property string subTitle: ""
signal selectionFinished(int index, var data) signal selectionFinished(int index, var data)
signal linkActivated(string link)
parent: Overlay.overlay parent: Overlay.overlay
@ -50,8 +51,7 @@ Dialog {
text: control.title text: control.title
onLinkActivated: { onLinkActivated: {
console.log("Opening " + link) control.linkActivated(link)
Qt.openUrlExternally(link)
} }
} }
@ -72,8 +72,7 @@ Dialog {
text: control.subTitle text: control.subTitle
onLinkActivated: { onLinkActivated: {
console.log("Opening " + link) control.linkActivated(link)
Qt.openUrlExternally(link)
} }
} }

View file

@ -296,7 +296,6 @@ Page {
leftMargin: 3 leftMargin: 3
bottom: selectorLv.bottom bottom: selectorLv.bottom
} }
} }
delegate: Button { delegate: Button {

View file

@ -404,6 +404,10 @@ DataListView {
app.openWidget({cup: data.cup, cat: data.cat}) app.openWidget({cup: data.cup, cat: data.cat})
} }
} }
function onLinkActivated(link) {
Qt.openUrlExternally(link)
}
} }
header: Item { header: Item {

View file

@ -35,6 +35,15 @@ Page {
property var widgetData: currentWidgetData property var widgetData: currentWidgetData
property Component headerComponent: ToolButton {
id: shareToolBt
onClicked: shareWidget(control.title)
text: "\uf1e0"
font.family: fa5solid.name
}
Component.onCompleted: { Component.onCompleted: {
control.ready = true control.ready = true
control.status = 200 control.status = 200

View file

@ -34,6 +34,15 @@ DataListView {
property var widgetData: currentWidgetData property var widgetData: currentWidgetData
signal closeAll() signal closeAll()
property Component headerComponent: ToolButton {
id: shareToolBt
onClicked: shareWidget(control.title)
text: "\uf1e0"
font.family: fa5solid.name
}
Connections { Connections {
target: selector target: selector
function onSelectionFinished(index, data) { function onSelectionFinished(index, data) {

View file

@ -18,6 +18,7 @@
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Layouts 1.12
import "../Components" import "../Components"
@ -30,7 +31,21 @@ DataListView {
property string subTitle: getSubtitle() property string subTitle: getSubtitle()
property bool titleIsPageTitle: true property bool titleIsPageTitle: true
property Component headerComponent: ToolButton { property Component headerComponent: RowLayout {
height: parent.height
spacing: 0
ToolButton {
id: shareToolBt
onClicked: shareWidget(control.title)
text: "\uf1e0"
font.family: fa5solid.name
}
ToolButton {
id: moreToolBt id: moreToolBt
onClicked: { onClicked: {
@ -40,6 +55,7 @@ DataListView {
text: "\uf142" text: "\uf142"
font.family: fa5solid.name font.family: fa5solid.name
} }
}
property var widgetData: currentWidgetData property var widgetData: currentWidgetData
property var athletes property var athletes
@ -69,7 +85,7 @@ DataListView {
} }
function getText(index){ function getText(athleteData){
var fedName // federation name var fedName // federation name
@ -78,7 +94,7 @@ DataListView {
for(var i = 0; i < widgetData["federations"].length; i ++ ){ for(var i = 0; i < widgetData["federations"].length; i ++ ){
//console.log("checking " + i + ": cat: " + parseInt(widgetData["categorys"][i]["GrpId"]) + " searched cat: " + root.catId) //console.log("checking " + i + ": cat: " + parseInt(widgetData["categorys"][i]["GrpId"]) + " searched cat: " + root.catId)
if(widgetData["federations"][i]["fed_id"] === widgetData[ 'athletes' ][index]["reg_fed_id"]){ if(widgetData["federations"][i]["fed_id"] === athleteData["reg_fed_id"]){
fedName = widgetData["federations"][i]["shortcut"] fedName = widgetData["federations"][i]["shortcut"]
} }
} }
@ -86,10 +102,10 @@ DataListView {
else { else {
// an international competition -> get nation // an international competition -> get nation
fedName = widgetData[ 'athletes' ][index]["nation"] fedName = athleteData["nation"]
} }
return widgetData[ "athletes" ][index]["firstname"] + " " + widgetData[ "athletes" ][index]["lastname"] + " (" + fedName + ")" return athleteData["firstname"] + " " + athleteData["lastname"] + " (" + fedName + ")"
} }
function changeCat() { function changeCat() {
@ -109,12 +125,17 @@ DataListView {
} }
} }
selector.appear(selectOptions, qsTrId("#selectCategory")) selector.appear(selectOptions, qsTrId("#selectCategory"), "<a href=\"blank\">Show results</a>")
} }
function filterAthletes(athletes) { function filterAthletes(athletes) {
if(!params.cat) {
params.cat = control.widgetData["categorys"][0]["GrpId"]
}
var filtered = athletes.filter(function(athlete){ var filtered = athletes.filter(function(athlete){
return parseInt(athlete.cat) === parseInt(params.cat) var res = String(athlete.cat).toLowerCase() === String(params.cat).toLowerCase()
return res
}) })
return filtered return filtered
@ -127,6 +148,13 @@ DataListView {
updateData({cat: data.cat}, true) updateData({cat: data.cat}, true)
} }
} }
function onLinkActivated(link) {
selector.close()
var tmpParams = params
tmpParams.type = ""
app.openWidget(tmpParams)
}
} }
Component.onCompleted: { Component.onCompleted: {
@ -143,6 +171,9 @@ DataListView {
onRefresh: { onRefresh: {
updateData({}, false) updateData({}, false)
}
onWidgetDataChanged: {
athletes = [] athletes = []
athletes = filterAthletes(widgetData["athletes"]) athletes = filterAthletes(widgetData["athletes"])
} }
@ -155,11 +186,11 @@ DataListView {
property int thisIndex: index property int thisIndex: index
property var thisData: modelData property var thisData: modelData
width: parseInt(thisData.cat) === parseInt(params.cat) ? control.width:control.width * 0.2
opacity: 0 opacity: 0
scale: 0.9 scale: 0.9
width: control.width
onThisDataChanged: { onThisDataChanged: {
fadeInPa.start() fadeInPa.start()
} }
@ -189,7 +220,7 @@ DataListView {
elide: "ElideRight" elide: "ElideRight"
text: control.getText(index) text: control.getText(partDel.thisData)
} }
} }

View file

@ -19,6 +19,7 @@
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.12
import "../Components" import "../Components"
@ -31,7 +32,21 @@ DataListView {
property string subTitle: getSubtitle() property string subTitle: getSubtitle()
property bool titleIsPageTitle: true property bool titleIsPageTitle: true
property Component headerComponent: ToolButton { property Component headerComponent: RowLayout {
height: parent.height
spacing: 0
ToolButton {
id: shareToolBt
onClicked: shareWidget(control.title)
text: "\uf1e0"
font.family: fa5solid.name
}
ToolButton {
id: moreToolBt id: moreToolBt
onClicked: { onClicked: {
@ -41,6 +56,7 @@ DataListView {
text: "\uf142" text: "\uf142"
font.family: fa5solid.name font.family: fa5solid.name
} }
}
function getSubtitle() { function getSubtitle() {
var titleString var titleString
@ -52,7 +68,7 @@ DataListView {
} }
} }
//% "(Startlist)" //% "(Startlist)"https://l.bluerock.dev/?comp=11601&type=starters
var addition = qsTrId("#startlistHeadline") var addition = qsTrId("#startlistHeadline")
return addition + " " + titleString return addition + " " + titleString

View file

@ -198,6 +198,7 @@ Window {
//openWidget({comp: 11651, cat: 26}) //openWidget({comp: 11651, cat: 26})
//openWidget({person: 6623}) //openWidget({person: 6623})
//console.log(JSON.stringify(serverConn.getParamsFromUrl(""))) //console.log(JSON.stringify(serverConn.getParamsFromUrl("")))
openWidgetFromUrl("https://l.bluerock.dev/?comp=11601&type=starters")
} }
FontLoader { FontLoader {