From 121589bf29398a047222588b00f37ba28692302b Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 6 Jun 2021 00:15:54 +0200 Subject: [PATCH] Some more improvements and styling --- .../qml/Components/FancyBusyIndicator.qml | 44 +++--------- resources/qml/Components/PullRefresher.qml | 2 +- resources/qml/Pages/WidgetPage.qml | 6 +- resources/qml/Widgets/CalendarWidget.qml | 3 +- resources/qml/Widgets/ResultWidget.qml | 67 +++++++++++++++---- resources/qml/main.qml | 41 +++++++----- 6 files changed, 98 insertions(+), 65 deletions(-) diff --git a/resources/qml/Components/FancyBusyIndicator.qml b/resources/qml/Components/FancyBusyIndicator.qml index 569e0e1..4b7839d 100644 --- a/resources/qml/Components/FancyBusyIndicator.qml +++ b/resources/qml/Components/FancyBusyIndicator.qml @@ -37,47 +37,25 @@ BusyIndicator { anchors.fill: parent - property int currentHeight: 0 - - SequentialAnimation { + RotationAnimation { + target: blueRockHoldIcon running: control.running + duration: control.animationSpeed loops: Animation.Infinite - - NumberAnimation { - target: item - property: "currentHeight" - from: 0 - to: 800 - duration: control.animationSpeed - } + from: 0 + to: 360 + easing.type: Easing.InOutQuad } - Row { + Image { + id: blueRockHoldIcon anchors.fill: parent - spacing: item.width / 9 - - Repeater { - id: repeater - model: 5 - - Rectangle { - - property double heightMultiplier: Math.abs( Math.sin( ( ((item.currentHeight/100) + (index*(control.formFactor/repeater.model)))) * (Math.PI/8) ) ) - - anchors.verticalCenter: parent.verticalCenter - - width: item.width / 9 - height: ( heightMultiplier ) * ( item.height - 1 ) + 1 - - radius: width * 0.5 - - color: control.lineColor - - } - } + source: "qrc:/icons/blueRockHold.png" + mipmap: true } + } } } diff --git a/resources/qml/Components/PullRefresher.qml b/resources/qml/Components/PullRefresher.qml index be01b9c..1e72f89 100644 --- a/resources/qml/Components/PullRefresher.qml +++ b/resources/qml/Components/PullRefresher.qml @@ -162,7 +162,7 @@ Item { Connections { target: control.target - function onDragEnded(userPosition) { + function onDragEnded() { if(userPosition >= control.dragOutPosition * control.dragRefreshPositionMultiplier){ control.state = "refreshing" preRefreshTimer.start() diff --git a/resources/qml/Pages/WidgetPage.qml b/resources/qml/Pages/WidgetPage.qml index a9b8ab2..5e56bb9 100644 --- a/resources/qml/Pages/WidgetPage.qml +++ b/resources/qml/Pages/WidgetPage.qml @@ -46,6 +46,10 @@ Page { property bool titleIsPageTitle: widgetLd.item !== null && widgetLd.item.hasOwnProperty('titleIsPageTitle') ? widgetLd.item['titleIsPageTitle']:false property Component headerComponent: widgetLd.item !== null && widgetLd.item.hasOwnProperty('headerComponent') ? widgetLd.item['headerComponent']:null + function onBackRequested() { + return !widgetLd.item.hasOwnProperty('onBackRequested') || widgetLd.item.onBackRequested() + } + property var params property int status: -1 @@ -360,7 +364,7 @@ Page { delegate: Button { id: catBt - width: parent.width + width: selectorLv.width height: text !== "" ? selectorLv.delegateHeight:0 flat: true diff --git a/resources/qml/Widgets/CalendarWidget.qml b/resources/qml/Widgets/CalendarWidget.qml index 7f0c6a7..f569c88 100644 --- a/resources/qml/Widgets/CalendarWidget.qml +++ b/resources/qml/Widgets/CalendarWidget.qml @@ -28,6 +28,7 @@ DataListView { property bool ready property string title: (params.nation === "ICC" ? "IFSC":params.nation === "GER" ? "DAV":"SAC") + " " + qsTr("calendar") + " " + control.year + property Component headerComponent: RowLayout { height: parent.height @@ -538,7 +539,7 @@ DataListView { Connections { target: control - onDisplayedCompCatsChanged: { + function onDisplayedCompCatsChanged() { //console.log("filters changed") //competitionDel.visible = control.displayedCompCats.indexOf(parseInt(competitionDel.thisData['cat_id'])) >= 0 checked = getCheckedState() diff --git a/resources/qml/Widgets/ResultWidget.qml b/resources/qml/Widgets/ResultWidget.qml index d31b40b..01101b6 100644 --- a/resources/qml/Widgets/ResultWidget.qml +++ b/resources/qml/Widgets/ResultWidget.qml @@ -60,16 +60,7 @@ DataListView { enabled: control.widgetData['route_order'] === "-1" && Object.keys(control.widgetData['route_names']).length > 2 - onClicked: { - if(speedFlowChartBackgroundRect.state === "hidden"){ - speedFlowChartBackgroundRect.state = "visible" - control.positionViewAtBeginning() - } - else { - speedFlowChartBackgroundRect.state = "hidden" - } - } - + onClicked: speedFlowChartBackgroundRect.toggle() icon.name: "flowchart" } } @@ -113,6 +104,14 @@ DataListView { } } + function onBackRequested() { + if(!speedFlowChartBackgroundRect.isVisible()) + return true + + speedFlowChartBackgroundRect.toggle() + return false + } + function getSubtitle() { var titleString @@ -182,7 +181,7 @@ DataListView { enabled: speedFlowChartBackgroundRect.state === "hidden" - width: parent.width + width: control.width height: 70 text: "" @@ -296,11 +295,13 @@ DataListView { model: parseInt(widgetData[ "route_num_problems" ]) function getDataForIcon(index){ + // TODO: clean var resultString = widgetData[ "participants" ][partDel.ind]["boulder"+(index+1)] + var numTrys = widgetData[ "participants" ][partDel.ind]["try"+(index+1)] var resultList = [] - if( resultString !== undefined){ + if (resultString !== undefined) { resultString = resultString.replace("t", "") resultString = resultString.replace("z", "") resultString = resultString.replace("b", "") @@ -314,6 +315,13 @@ DataListView { resultList = [-1,-1] } + if (numTrys !== undefined) { + resultList.push(numTrys) + } + else { + resultList.push(-1) + } + return resultList } @@ -449,6 +457,27 @@ DataListView { } + Label { + id: boulderResTrysLa + + anchors.centerIn: parent + + height: parent.height / 2 + width: parent.width / 2 + + visible: !boulderResZoneLa.visible + + fontSizeMode: Text.Fit + font.pixelSize: height + minimumPixelSize: 1 + + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + text: boulderResCv.resultData[2] + + } + Label { id: boulderResZoneLa @@ -734,6 +763,20 @@ DataListView { color: Material.background + function toggle() { + if(speedFlowChartBackgroundRect.state === "hidden"){ + speedFlowChartBackgroundRect.state = "visible" + control.positionViewAtBeginning() + } + else { + speedFlowChartBackgroundRect.state = "hidden" + } + } + + function isVisible() { + return speedFlowChartBackgroundRect.state === "visible" + } + SpeedFlowChart { id: speedFlowChart diff --git a/resources/qml/main.qml b/resources/qml/main.qml index 82f29ca..488d0e2 100644 --- a/resources/qml/main.qml +++ b/resources/qml/main.qml @@ -121,6 +121,7 @@ Window { anchors.fill: parent Component.onCompleted: { + //loadingDl.open() //app.openAthlete(53139) // dorian: 53139 , rustam: 6933 , helen: 53300 //openWidget({nation:'GER'}) //mainStack.push("Pages/AthleteSearchPage.qml") @@ -130,11 +131,7 @@ Window { Shortcut { sequences: ["Esc", "Back"] enabled: mainStack.depth > 1 - onActivated: { - if(!mainStack.currentItem.locked){ - mainStack.pop() - } - } + onActivated: app.goBack() } ServerConn { @@ -224,12 +221,7 @@ Window { height: parent.height - onClicked: { - if(!mainStack.currentItem.locked){ - mainStack.pop() - } - } - + onClicked: app.goBack() icon.name: "back" } @@ -445,7 +437,7 @@ Window { ] } - Dialog { + Popup { id: loadingDl x: ( app.width - width ) / 2 @@ -455,6 +447,9 @@ Window { closePolicy: Dialog.NoAutoClose contentItem: Column { + + spacing: 50 + FancyBusyIndicator { running: true } @@ -464,10 +459,17 @@ Window { anchors.horizontalCenter: parent.horizontalCenter font.bold: true + color: "white" text: "loading..." } } + + background: Rectangle { + color: "transparent" + } + + } Store { @@ -490,17 +492,17 @@ Window { } } - function landscape(){ + function landscape() { return app.height < app.width } - function openWidget(params){ + function openWidget(params) { loadingDl.open() var calComp = Qt.createComponent("qrc:/Pages/WidgetPage.qml").createObject(null, {"params": params}) app.errorCode = calComp.status - if(calComp.ready){ + if(calComp.ready) { mainStack.push(calComp) } else { @@ -510,8 +512,8 @@ Window { loadingDl.close() } - function defaultString(string, defaultString){ - if(string === undefined || string === null){ + function defaultString(string, defaultString) { + if(string === undefined || string === null) { return defaultString } else { @@ -519,6 +521,11 @@ Window { } } + function goBack() { + if(!mainStack.currentItem.hasOwnProperty('onBackRequested') || mainStack.currentItem.onBackRequested()) + mainStack.pop() + } + function getErrorInfo(errorCode) { var infoLevel