- Fixed registration widget issues

- Added share button to registration, startlist and profile widget
This commit is contained in:
Dorian Zedler 2021-06-29 17:44:35 +02:00
parent cc855bd329
commit 20ffca4670
Signed by: dorian
GPG key ID: 989DE36109AFA354
8 changed files with 91 additions and 23 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -34,6 +34,15 @@ DataListView {
property var widgetData: currentWidgetData
signal closeAll()
property Component headerComponent: ToolButton {
id: shareToolBt
onClicked: shareWidget(control.title)
text: "\uf1e0"
font.family: fa5solid.name
}
Connections {
target: selector
function onSelectionFinished(index, data) {
@ -81,7 +90,7 @@ DataListView {
}
onPressAndHold: {
app.openWidget({person:thisData["PerId"]})
app.openWidget({person:thisData["PerId"]})
}
ParallelAnimation {

View file

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

View file

@ -19,6 +19,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.12
import "../Components"
@ -31,7 +32,21 @@ DataListView {
property string subTitle: getSubtitle()
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
onClicked: {
@ -40,6 +55,7 @@ DataListView {
text: "\uf142"
font.family: fa5solid.name
}
}
function getSubtitle() {
@ -52,7 +68,7 @@ DataListView {
}
}
//% "(Startlist)"
//% "(Startlist)"https://l.bluerock.dev/?comp=11601&type=starters
var addition = qsTrId("#startlistHeadline")
return addition + " " + titleString

View file

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