minor fixes

This commit is contained in:
Dorian Zedler 2019-05-29 20:59:01 +02:00
parent b3b6c4d159
commit 39cde07982
17 changed files with 407 additions and 187 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="com.itsblue.blueROCKtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.01.2b" android:versionCode="3" android:installLocation="auto">
<manifest package="com.itsblue.blueROCKtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.01.3b" android:versionCode="4" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="blueROCK" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="blueROCK (for digitalROCK)" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 138 KiB

View file

@ -67,15 +67,24 @@ Page {
var ret = serverConn.getWidgetData(params)
root.status = ret["status"]
if(ret["status"] === 200){
root.widgetData = ret["data"]
root.widgetType = checkWidgetType(params, root.widgetData)
console.log(widgetType)
widgetLd.load()
root.ready = true
if(widgetLd.load()){
root.ready = true
}
else {
root.status = 900
root.ready = false
}
}
else {
root.ready = false
}
root.status = ret["status"]
app.errorCode = root.status
}
@ -83,7 +92,7 @@ Page {
if(openLoadingDl)
loadingDl.open()
// update all the given values
for(var prop in params){
if(params.hasOwnProperty(prop)){
root.params[prop] = params[prop]
@ -98,7 +107,6 @@ Page {
}
function checkWidgetType(params, widgetData){
var widgetType
function hasParam(object, key, value){
@ -154,14 +162,34 @@ Page {
property alias selector: selectorPu
property var updateData: root.updateData
property alias params: root.params
property alias currentWidgetData: root.widgetData
property var oldWidgetType: NaN
anchors.fill: parent
source: ""
function load() {
widgetLd.source = getFile(root.widgetType)
widgetLd.item.widgetData = root.widgetData
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 {
delete(widgetLd.sourceComponent = null)
return false
}
//
}
function getFile(widgetType) {
@ -222,9 +250,11 @@ Page {
title: ""
function appear(dataObj, title) {
selectorPu.dataObj = dataObj
selectorPu.title = title
selectorPu.open()
if(dataObj.length > 0){
selectorPu.dataObj = dataObj
selectorPu.title = title
selectorPu.open()
}
}
ListView {

View file

@ -24,117 +24,105 @@ import "../Components"
DataListView {
id: control
property string title: (params.nation === "" ? "IFSC":params.nation === "GER" ? "DAV":"SAC") + " " + qsTr("competition calendar")
property Component headerComponent: Item {
anchors.fill: parent
property bool ready
Row {
anchors.fill: parent
anchors.rightMargin: 5
spacing: width * 0.05
Label {
id: yearLa
anchors.verticalCenter: parent.verticalCenter
width: parent.width * 0.4
height: parent.height * 0.6
fontSizeMode: Text.Fit
font.pixelSize: height
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
minimumPixelSize: 1
text: control.year
Behavior on text {
FadeAnimation {
target: yearLa
}
}
}
Button {
id:yearToolBt
anchors {
verticalCenter: parent.verticalCenter
}
height: parent.height * 0.5
width: parent.width * 0.25
onClicked: {
control.changeYear()
}
onPressed: yearToolBt.scale = 0.9
onReleased: yearToolBt.scale = 1.0
background: Image {
anchors.centerIn: parent
source: "qrc:/icons/calendar.png"
height: parent.height > parent.width ? parent.width : parent.height
width: height
mipmap: true
fillMode: Image.PreserveAspectFit
Behavior on scale {
PropertyAnimation {
duration: 100
}
}
}
}
Button {
id: cupToolBt
anchors {
verticalCenter: parent.verticalCenter
}
height: parent.height * 0.5
width: parent.width * 0.25
onClicked: {
control.openCup()
}
onPressed: cupToolBt.scale = 0.9
onReleased: cupToolBt.scale = 1.0
background: Image {
anchors.centerIn: parent
source: "qrc:/icons/cup.png"
height: parent.height > parent.width ? parent.width : parent.height
width: height
mipmap: true
fillMode: Image.PreserveAspectFit
Behavior on scale {
PropertyAnimation {
duration: 100
}
}
}
}
property string title: (params.nation === "" ? "IFSC":params.nation === "GER" ? "DAV":"SAC") + " " + qsTr("competition calendar") + " " + control.year
property Component headerComponent: Row {
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
rightMargin: 5
}
width: childrenRect.width
spacing: width * 0.1
Button {
id:yearToolBt
anchors {
verticalCenter: parent.verticalCenter
}
height: parent.height * 0.5
width: height
onClicked: {
control.changeYear()
}
onPressed: yearToolBt.scale = 0.9
onReleased: yearToolBt.scale = 1.0
background: Image {
anchors.centerIn: parent
source: "qrc:/icons/calendar.png"
height: parent.height > parent.width ? parent.width : parent.height
width: height
mipmap: true
fillMode: Image.PreserveAspectFit
Behavior on scale {
PropertyAnimation {
duration: 100
}
}
}
}
Button {
id: cupToolBt
anchors {
verticalCenter: parent.verticalCenter
}
height: parent.height * 0.5
width: height
onClicked: {
control.openCup()
}
onPressed: cupToolBt.scale = 0.9
onReleased: cupToolBt.scale = 1.0
background: Image {
anchors.centerIn: parent
source: "qrc:/icons/cup.png"
height: parent.height > parent.width ? parent.width : parent.height
width: height
mipmap: true
fillMode: Image.PreserveAspectFit
Behavior on scale {
PropertyAnimation {
duration: 100
}
}
}
}
Item {
id: spacer
height: parent.height
width: 1
}
}
property var widgetData
property var widgetData: currentWidgetData
property int year: new Date().getFullYear()
@ -144,17 +132,22 @@ DataListView {
model: widgetData["competitions"].length
status: root.status
onRefresh: {
updateData({}, false)
}
onModelChanged: {
autoScroll()
}
Component.onCompleted: {
if(model > 0){
control.ready = true
control.status = 200
}
else {
control.ready = false
control.status = 901
}
autoScroll()
onWidgetDataChanged: {
// if the IFSC Calendar is open -> add the worldranking
if(params.nation === ""){
control.widgetData['cups'].unshift({"SerId":"","rkey":"","name":"Worldranking","modified":"2018-10-24 16:11:12","modifier":"","year":"","num_comps":"","cats":["ICC-COA","ICC-HD","ICC-MED","ICC_F","ICC_FB","ICC_FS","ICC_M","ICC_MB","ICC_MS"]})
@ -162,9 +155,11 @@ DataListView {
}
function autoScroll() {
// function to scroll to the next competition that is not already over
var compList = control.widgetData["competitions"]
console.log("scrolling")
if(parseInt(control.year) === new Date().getFullYear()){
for(var i = 0; i < compList.length; i ++){
// get the start date pf the competition
@ -186,6 +181,9 @@ DataListView {
}
}
}
else {
//console.log("not current year")
}
}
function getCompCatData(compCatId) {
@ -293,7 +291,7 @@ DataListView {
}
Connections {
target: selector
target: parent.selector
onSelectionFinished: {
if(data.comp !== undefined){
console.log(data.status)
@ -375,14 +373,14 @@ DataListView {
text: name
}
/*
Label {
id: infola
width: parent.width
text: thisData.info
}*/
}
Label {
id: dateLa

View file

@ -14,7 +14,12 @@ Page {
property int perId: -1
property var widgetData: ({})
property var widgetData: currentWidgetData
Component.onCompleted: {
control.ready = true
control.status = 200
}
ScrollView {
id: mainSv
@ -334,7 +339,7 @@ Page {
text: "<html><a href='#'>" + bestResultsRep.bestResults[index]["name"] + "</a></html>"
onLinkActivated: {
app.openResults( bestResultsRep.bestResults[index]["WetId"], bestResultsRep.bestResults[index]["GrpId"], 1 )
app.openWidget( { comp: bestResultsRep.bestResults[index]["WetId"], cat: bestResultsRep.bestResults[index]["GrpId"] } )
}
}

View file

@ -24,11 +24,13 @@ import "../Components"
DataListView {
id: control
property bool ready
property string title: control.widgetData['comp_name']
property string subTitle: qsTr("(Ranking)") + " after " + control.widgetData['route_name']
property bool titleIsPageTitle: true
property var widgetData: ({})
property var widgetData: currentWidgetData
signal closeAll()
Connections {
@ -40,11 +42,23 @@ DataListView {
}
}
onWidgetDataChanged: {
model = widgetData[ "participants" ] === undefined ? 0:widgetData[ "participants" ].length
Component.onCompleted: {
if(model > 0){
control.ready = true
control.status = 200
}
else {
control.ready = false
control.status = 901
}
}
onRefresh: {
updateData({}, false)
}
status: model === 0 ? 901:200
model: widgetData[ "participants" ] === undefined ? 0:widgetData[ "participants" ].length
delegate: ItemDelegate {

View file

@ -24,21 +24,24 @@ import "../Components"
DataListView {
id: control
property string title: control.widgetData['name']
property bool ready
property string title: control.widgetData['name'] === undefined ? "":control.widgetData['name']
property string subTitle: getSubtitle()
property bool titleIsPageTitle: true
property Component headerComponent: Item {
anchors.fill: parent
height: parent.height
width: moreToolBt.width * 1.5
Button {
id: cupToolBt
id: moreToolBt
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: parent.width * 0.1
rightMargin: parent.width * 0.5
}
height: parent.height * 0.5
@ -48,8 +51,8 @@ DataListView {
control.changeCat()
}
onPressed: cupToolBt.scale = 0.9
onReleased: cupToolBt.scale = 1.0
onPressed: moreToolBt.scale = 0.9
onReleased: moreToolBt.scale = 1.0
background: Image {
@ -70,15 +73,16 @@ DataListView {
}
}
}
}
property var widgetData: ({})
property var widgetData: currentWidgetData
function getSubtitle() {
var titleString
if(control.widgetData["categorys"] === undefined)
return ""
for(var i = 0; i < control.widgetData["categorys"].length; i ++ ){
//console.log("checking " + i + ": cat: " + parseInt(control.widgetData["categorys"][i]["GrpId"]) + " searched cat: " + params.cat)
if(parseInt(control.widgetData["categorys"][i]["GrpId"]) === parseInt(params.cat)){
@ -86,9 +90,14 @@ DataListView {
}
}
var addition = "(Registration) "
return addition + titleString
if(titleString !== undefined){
return addition + titleString
}
else {
return ""
}
}
@ -143,8 +152,21 @@ DataListView {
}
}
status: model === 0 ? 901:200
model: widgetData[ 'athletes' ] === undefined ? 0:widgetData[ 'athletes' ].length
Component.onCompleted: {
if(model > 0){
control.ready = true
control.status = 200
}
else {
control.ready = false
control.status = 901
}
}
onRefresh: {
updateData({}, false)
}

View file

@ -25,21 +25,24 @@ import "../Components"
DataListView {
id: control
property bool ready
property string title: control.widgetData['comp_name']
property string subTitle: getSubtitle()
property bool titleIsPageTitle: true
property Component headerComponent: Item {
anchors.fill: parent
height: parent.height
width: moreToolBt.width * 1.5
Button {
id: cupToolBt
id: moreToolBt
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: parent.width * 0.1
rightMargin: parent.width * 0.5
}
height: parent.height * 0.5
@ -49,8 +52,8 @@ DataListView {
control.changeCat()
}
onPressed: cupToolBt.scale = 0.9
onReleased: cupToolBt.scale = 1.0
onPressed: moreToolBt.scale = 0.9
onReleased: moreToolBt.scale = 1.0
background: Image {
@ -71,14 +74,25 @@ DataListView {
}
}
}
}
property var widgetData: ({})
property var widgetData: currentWidgetData
onWidgetDataChanged: {
model = widgetData[ "participants" ] === undefined ? 0:widgetData[ "participants" ].length
Component.onCompleted: {
if(model > 0){
control.ready = true
control.status = 200
}
else {
control.ready = false
control.status = 901
}
if(!control.ready)
return
//model = widgetData[ "participants" ] === undefined ? 0:widgetData[ "participants" ].length
//routeSelectTb.setCurrentIndex(routeSelectTb.getIndex(parseInt(control.widgetData['route_order'])))
}
model: widgetData[ "participants" ] === undefined ? 0:widgetData[ "participants" ].length
@ -98,7 +112,14 @@ DataListView {
}
var addition = qsTr("(Results)")
return addition + " " + titleString
if(titleString !== undefined){
return addition + titleString
}
else {
return ""
}
}
@ -129,7 +150,7 @@ DataListView {
target: selector
onSelectionFinished: {
if(data.cat !== undefined){
updateData({cat: data.cat}, true)
updateData({cat: data.cat, route:""}, true)
}
}
}
@ -162,7 +183,6 @@ DataListView {
NumberAnimation { target: partDel; property: "scale"; from: 0.8; to: 1.0; duration: 400 }
}
Rectangle {
anchors.fill: parent
@ -195,7 +215,7 @@ DataListView {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: widgetData[ "participants" ][index]["result_rank"] === undefined ? "":widgetData[ "participants" ][index]["result_rank"]
text: partDel.thisData["result_rank"] === undefined ? "":partDel.thisData["result_rank"]
}
Label {
@ -208,7 +228,7 @@ DataListView {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
text: widgetData[ "participants" ][index]["firstname"] + " " + widgetData[ "participants" ][index]["lastname"]
text: partDel.thisData["firstname"] + " " + partDel.thisData["lastname"]
}
Label {
@ -225,7 +245,7 @@ DataListView {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: "<html>(<a href=\"" + (widgetData[ "participants" ][index]["fed_url"] === undefined ? "":widgetData[ "participants" ][index]["fed_url"]).toString() + "\">" + (widgetData[ "display_athlete" ] === "nation" ? widgetData[ "participants" ][index]["nation"] : widgetData[ "participants" ][index]["federation"]) + "</a>)</html>"
text: "<html>(<a href=\"" + (partDel.thisData["fed_url"] === undefined ? "":partDel.thisData["fed_url"]).toString() + "\">" + (widgetData[ "display_athlete" ] === "nation" ? partDel.thisData["nation"] : partDel.thisData["federation"]) + "</a>)</html>"
onLinkActivated: {
Qt.openUrlExternally(link)
@ -237,7 +257,7 @@ DataListView {
id: partDelSecondRow
width: parent.width
height: multiResRow.enabled || multiGenResRow.enabled || resultLa.enabled ? parent.height / 2:0
height: multiResRow.enabled || multiGenResRow.enabled || resultLa.enabled ? parent.height / 2 : 0
Row {
id: multiResRow
@ -491,7 +511,7 @@ DataListView {
width: parent.width / ( generalResRep.model )
height: parent.height
visible: boulderGenResLa.text != ""
visible: enabled
Rectangle {
@ -560,6 +580,10 @@ DataListView {
}
}
footer: ItemDelegate {
height: routeSelectTb.height
}
RectangularGlow {
id: toolBarEffect
glowRadius: 3
@ -581,13 +605,17 @@ DataListView {
bottom: parent.bottom
}
height: tabs.length > 0 ? 50:0
height: tabs.length > 1 ? 50:0
width: parent.width
position: TabBar.Footer
currentIndex: getIndex(parseInt(control.widgetData['route_order']))
Component.onCompleted: {
//currentIndex = getIndex(params.route)
setCurrentIndex(getIndex(props.route))
//setCurrentIndex(getIndex(params.route))
//routeSelectTb.setCurrentIndex(routeSelectTb.getIndex(parseInt(control.widgetData['route_order'])))
}
function getTabs() {
@ -599,7 +627,7 @@ DataListView {
// go through the whole array and search for data keys
if (obj.hasOwnProperty(prop)) {
buttonData.push([prop, obj[prop]])
console.log("found " + obj[prop] + " at index " + prop)
//console.log("found " + obj[prop] + " at index " + prop)
}
}
@ -611,12 +639,16 @@ DataListView {
}
function getIndex(routeNumber) {
console.log("getting index for route number: " + routeNumber)
//console.log("getting index for route number: " + routeNumber)
if(tabs === undefined){
//return
}
for(var i = 0; i < tabs.length; i++){
//console.log(tabs[i])
if(parseInt(tabs[i][0]) === routeNumber){
console.log("found index: " + i)
//console.log("found index: " + i)
return i
}
}
@ -641,12 +673,13 @@ DataListView {
onClicked: {
//console.log("changing to index: " + index + " (" + routeSelectTb.tabs[index][0] + ", " + routeSelectTb.tabs[index][1] + ")")
control.changeRoute(routeSelectTb.tabs[index][0])
if(routeSelectTb.getIndex(parseInt(control.widgetData['route_order'])) !== index){
control.changeRoute(routeSelectTb.tabs[index][0])
}
}
}
}
}
}

View file

@ -18,27 +18,31 @@
import QtQuick 2.9
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0
import "../Components"
DataListView {
id: control
property bool ready
property string title: control.widgetData['comp_name']
property string subTitle: getSubtitle()
property string subTitle: qsTr("(Startlist)") + " " + control.widgetData['route_name'] //getSubtitle()
property bool titleIsPageTitle: true
property Component headerComponent: Item {
anchors.fill: parent
height: parent.height
width: moreToolBt.width * 1.5
Button {
id: cupToolBt
id: moreToolBt
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: parent.width * 0.1
rightMargin: parent.width * 0.5
}
height: parent.height * 0.5
@ -48,8 +52,8 @@ DataListView {
control.changeCat()
}
onPressed: cupToolBt.scale = 0.9
onReleased: cupToolBt.scale = 1.0
onPressed: moreToolBt.scale = 0.9
onReleased: moreToolBt.scale = 1.0
background: Image {
@ -70,8 +74,6 @@ DataListView {
}
}
}
}
function getSubtitle() {
@ -89,6 +91,9 @@ DataListView {
}
function changeRoute(route) {
updateData({route:route}, true)
}
function changeCat(){
var cats = control.widgetData["categorys"]
@ -118,11 +123,23 @@ DataListView {
}
}
property var widgetData: ({})
property var widgetData: currentWidgetData
model: widgetData[ "participants" ] === undefined ? 0:widgetData[ "participants" ].length
Component.onCompleted: {
if(model > 0){
control.ready = true
control.status = 200
}
else {
control.ready = false
control.status = 901
}
routeSelectTb.setCurrentIndex(routeSelectTb.getIndex(parseInt(control.widgetData['route_order'])))
}
onRefresh: {
updateData({}, false)
}
@ -209,4 +226,94 @@ DataListView {
}
}
footer: ItemDelegate {
height: routeSelectTb.height
}
RectangularGlow {
id: toolBarEffect
glowRadius: 3
spread: 0.2
color: "black"
opacity: 0.3
anchors.fill: routeSelectTb
}
TabBar {
id: routeSelectTb
property var tabs: getTabs()
property var tabIndexes: []
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: tabs.length > 1 ? 50:0
position: TabBar.Footer
function getTabs() {
var obj = control.widgetData["route_names"]
var buttonData = []
for(var prop in obj) {
// go through the whole array and search for data keys
if (obj.hasOwnProperty(prop)) {
buttonData.push([prop, obj[prop]])
console.log("found " + obj[prop] + " at index " + prop)
}
}
buttonData.sort(function(a, b) {
return a[0] - b[0];
});
return buttonData
}
function getIndex(routeNumber) {
console.log("getting index for route number: " + routeNumber)
for(var i = 0; i < tabs.length; i++){
//console.log(tabs[i])
if(parseInt(tabs[i][0]) === routeNumber){
console.log("found index: " + i)
return i
}
}
return 0
}
Repeater {
id: routeSelectButtonRep
model: routeSelectTb.tabs.length
onModelChanged: {
routeSelectTb.setCurrentIndex(routeSelectTb.getIndex(parseInt(control.widgetData['route_order'])))
}
delegate: TabButton {
text: routeSelectTb.tabs[index][1]
width: Math.max(150, routeSelectTb.width / routeSelectButtonRep.model) //text.length * font.pixelSize
onClicked: {
//console.log("changing to index: " + index + " (" + routeSelectTb.tabs[index][0] + ", " + routeSelectTb.tabs[index][1] + ")")
control.changeRoute(routeSelectTb.tabs[index][0])
}
}
}
}
}

View file

@ -163,7 +163,6 @@ Window {
//openWidget({nation:'GER'})
}
Shortcut {
sequences: ["Esc", "Back"]
enabled: mainStack.depth > 1
@ -379,19 +378,31 @@ Window {
Loader {
id: extraComponentLoader
height: parent.height
width: status === Loader.Ready ? parent.width * 0.4 - toolButton.width - 3 * parent.spacing:0
property int maximumWidth: parent.width * 0.4 - toolButton.width - 3
height: parent.height
anchors {
top: parent.top
bottom: parent.bottom
}
onItemChanged: {
width = status === Loader.Ready ? item.width:0
}
//sourceComponent: mainStack.currentItem.headerComponent
Connections {
target: mainStack
onCurrentItemChanged: {
secondCon.target = mainStack.currentItem
disappearNa.start()
}
}
Connections {
id: secondCon
onHeaderComponentChanged: {
disappearNa.start()
}
}
@ -422,7 +433,6 @@ Window {
}
}
ParallelAnimation {
id: disappearNa
@ -522,6 +532,7 @@ Window {
var calComp = Qt.createComponent("qrc:/Pages/WidgetPage.qml").createObject(null, {"params": params})
app.errorCode = calComp.status
if(calComp.ready){
mainStack.push(calComp)
}
@ -565,8 +576,8 @@ Window {
break
case 900:
infoLevel = 2
errorString = "Internal processing error"
errorDescription = "The server has sent some data that could ot be processed. Please try again later"
errorString = "Internal error"
errorDescription = "Something went wron internally, this is probaply an inssue in the program code"
break
case 901:
infoLevel = 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB