added rectangles like on dr website for boulder ranking
This commit is contained in:
parent
ec4f8a1de5
commit
9dbad425df
7 changed files with 230 additions and 42 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.8.2, 2019-04-20T22:54:55. -->
|
||||
<!-- Written by QtCreator 4.8.2, 2019-04-21T12:34:34. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -8,7 +8,7 @@
|
|||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dorian/builds/build-DigitalRockRanking-Android_for_armeabi_v7a_Clang_Qt_5_11_3_for_Android_ARMv7-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dorian/Documents/git/builds/build-DigitalRockRanking-Android_for_armeabi_v7a_Clang_Qt_5_11_3_for_Android_ARMv7-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
@ -355,8 +355,8 @@
|
|||
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">DigitalRockRanking</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">DigitalRockRanking</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/DigitalRockRanking/DigitalRockRanking.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/Documents/git/digital-rock-ranking/DigitalRockRanking.pro</value>
|
||||
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
|
@ -378,7 +378,7 @@
|
|||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dorian/builds/build-DigitalRockRanking-Desktop_Qt_5_11_3_GCC_64bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dorian/Documents/git/builds/build-DigitalRockRanking-Desktop_Qt_5_11_3_GCC_64bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
@ -603,8 +603,8 @@
|
|||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">DigitalRockRanking</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/dorian/DigitalRockRanking/DigitalRockRanking.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">DigitalRockRanking2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/dorian/Documents/git/digital-rock-ranking/DigitalRockRanking.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">DigitalRockRanking.pro</value>
|
||||
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
|
@ -615,7 +615,7 @@
|
|||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/dorian/builds/build-DigitalRockRanking-Desktop_Qt_5_11_3_GCC_64bit-Debug</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/dorian/Documents/git/builds/build-DigitalRockRanking-Desktop_Qt_5_11_3_GCC_64bit-Debug</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
|
|
|
@ -11,6 +11,11 @@ ListView {
|
|||
anchors.margins: 10
|
||||
anchors.rightMargin: 14
|
||||
|
||||
|
||||
enabled: status === 200
|
||||
opacity: enabled ? 1:0
|
||||
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: control.parent
|
||||
|
||||
|
@ -24,15 +29,30 @@ ListView {
|
|||
|
||||
width: 8
|
||||
|
||||
visible: control.model > 0
|
||||
|
||||
active: true
|
||||
}
|
||||
|
||||
onContentYChanged: {
|
||||
if(contentY < -125){
|
||||
if(contentY < -control.height * 0.3 && control.status !== 905){
|
||||
contentY = 0
|
||||
control.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on contentY {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
InfoArea {
|
||||
id: infoArea
|
||||
|
||||
|
@ -44,7 +64,7 @@ ListView {
|
|||
topMargin: control.height*( status === 901 ? 0.6:0.5) - height * 0.8
|
||||
}
|
||||
|
||||
excludedCodes: [200, 902]
|
||||
excludedCodes: [200, 902, 905]
|
||||
errorCode: control.status
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,6 +108,25 @@ DataListView {
|
|||
|
||||
model: parseInt(listData[ "route_num_problems" ])
|
||||
|
||||
function getDataForIcon(index){
|
||||
var resultString = listData[ "participants" ][partDel.ind]["boulder"+(index+1)]
|
||||
|
||||
var resultList = []
|
||||
|
||||
if( resultString !== undefined){
|
||||
resultString = resultString.replace("t", "")
|
||||
resultString = resultString.replace("z", "")
|
||||
resultList = resultString.split(" ")
|
||||
}
|
||||
|
||||
|
||||
while (resultList.length < 2){
|
||||
resultList.unshift(0)
|
||||
}
|
||||
|
||||
return resultList
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
id: boulderResItm
|
||||
|
||||
|
@ -115,7 +134,7 @@ DataListView {
|
|||
|
||||
width: parent.width / ( boulderResRep.model )
|
||||
height: parent.height
|
||||
|
||||
/*
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
|
@ -139,20 +158,161 @@ DataListView {
|
|||
|
||||
color: "grey"
|
||||
}
|
||||
*/
|
||||
Canvas {
|
||||
id: boulderResCv
|
||||
|
||||
property var resultData: boulderResRep.getDataForIcon(index)
|
||||
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
|
||||
height: parent.height
|
||||
width: parent.width * 0.9
|
||||
height: parent.height * 1.1
|
||||
width: height
|
||||
|
||||
onPaint: {
|
||||
var width = boulderResCv.width * 0.9
|
||||
var height = boulderResCv.height * 0.9
|
||||
|
||||
var radius = width * 0.3
|
||||
|
||||
var offsetX = width * 0.05
|
||||
var offsetY = height * 0.05
|
||||
|
||||
var context = getContext("2d");
|
||||
|
||||
context.beginPath();
|
||||
|
||||
context.moveTo(0 + offsetX + radius, 0 + offsetY);
|
||||
|
||||
// top line
|
||||
context.lineTo(width - radius + offsetX, 0 + offsetY);
|
||||
// top right corner
|
||||
context.arc(width-radius + offsetX, radius + offsetY, radius, 1.5 * Math.PI, 0);
|
||||
// right line
|
||||
context.lineTo(width + offsetX, height - radius + offsetY);
|
||||
// bottom right corner
|
||||
context.arc(width-radius + offsetX, height - radius + offsetY, radius, 0, 0.5 * Math.PI);
|
||||
// bottom line
|
||||
context.lineTo(0 + radius + offsetX, height + offsetY);
|
||||
// bottom left corner
|
||||
context.arc(radius + offsetY, height - radius + offsetY, radius, 0.5 * Math.PI, Math.PI);
|
||||
// left line
|
||||
context.lineTo(0 + offsetX, radius + offsetY);
|
||||
// top left corner
|
||||
context.arc(radius + offsetX, radius + offsetY, radius, Math.PI, 1.5 * Math.PI);
|
||||
|
||||
// fill
|
||||
context.fillStyle = "#b7b7b7";
|
||||
context.fill();
|
||||
|
||||
// outline
|
||||
context.lineWidth = 1;
|
||||
context.strokeStyle = '#424242';
|
||||
context.stroke();
|
||||
|
||||
if(resultData[1] > 0){
|
||||
|
||||
// the first triangle
|
||||
context.beginPath();
|
||||
|
||||
// top right corner
|
||||
context.arc(width-radius + offsetX, radius + offsetY, radius, 1.75 * Math.PI, 0);
|
||||
|
||||
// right line
|
||||
context.lineTo(width + offsetX, height - radius + offsetY);
|
||||
|
||||
// bottom right corner
|
||||
context.arc(width-radius + offsetX, height - radius + offsetY, radius, 0, 0.5 * Math.PI);
|
||||
|
||||
// bottom line
|
||||
context.lineTo(0 + radius + offsetX, height + offsetY);
|
||||
// bottom left corner
|
||||
context.arc(radius + offsetX, height - radius + offsetY, radius, 0.5 * Math.PI, 0.75 * Math.PI);
|
||||
context.closePath();
|
||||
|
||||
context.fillStyle = "#44ed38";
|
||||
context.fill();
|
||||
|
||||
// outline
|
||||
context.lineWidth = 1;
|
||||
context.strokeStyle = '#424242';
|
||||
context.stroke();
|
||||
|
||||
|
||||
if(resultData[0] > 0){
|
||||
// the second triangle
|
||||
context.beginPath();
|
||||
// bottom left corner
|
||||
context.arc(radius + offsetX, height - radius + offsetY, radius, 0.75 * Math.PI, 1 * Math.PI);
|
||||
// left line
|
||||
context.lineTo(0 + offsetX, radius + offsetY);
|
||||
// top left corner
|
||||
context.arc(radius + offsetX, radius + offsetY, radius, Math.PI, 1.5 * Math.PI);
|
||||
// top line
|
||||
context.lineTo(width - radius + offsetX, 0 + offsetY);
|
||||
// top right corner
|
||||
context.arc(width-radius + offsetX, radius + offsetY, radius, 1.5 * Math.PI, 1.75 * Math.PI);
|
||||
|
||||
context.closePath();
|
||||
|
||||
context.fillStyle = "#44ed38";
|
||||
context.fill();
|
||||
|
||||
// outline
|
||||
context.lineWidth = 1;
|
||||
context.strokeStyle = '#424242';
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: boulderResZoneLa
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: boulderResCv.height * 0.05
|
||||
}
|
||||
|
||||
height: parent.height / 2
|
||||
width: parent.width / 2
|
||||
|
||||
visible: text !== "0"
|
||||
|
||||
fontSizeMode: Text.Fit
|
||||
font.pixelSize: Math.abs( height * 0.6 )
|
||||
font.pixelSize: height
|
||||
minimumPixelSize: 0
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
text: listData[ "participants" ][partDel.ind]["boulder"+(index+1)] === undefined ? "":listData[ "participants" ][partDel.ind]["boulder"+(index+1)]
|
||||
text: boulderResCv.resultData[1]
|
||||
}
|
||||
|
||||
Label {
|
||||
id: boulderResTopLa
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
margins: boulderResCv.height * 0.05
|
||||
}
|
||||
|
||||
height: parent.height / 2
|
||||
width: parent.width / 2
|
||||
|
||||
visible: text !== "0"
|
||||
|
||||
fontSizeMode: Text.Fit
|
||||
font.pixelSize: height
|
||||
minimumPixelSize: 0
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
text: boulderResCv.resultData[0]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,13 @@ Page {
|
|||
property int status: -1
|
||||
|
||||
Component.onCompleted: {
|
||||
loadData(root.nation)
|
||||
}
|
||||
|
||||
function loadData(nation) {
|
||||
root.status = 905
|
||||
loadingDl.open()
|
||||
|
||||
var ret = serverConn.getCalendar(nation)
|
||||
|
||||
if(ret["status"] === 200){
|
||||
|
@ -23,34 +30,26 @@ Page {
|
|||
root.status = ret["status"]
|
||||
calendarList.listData = {}
|
||||
}
|
||||
loadingDl.close()
|
||||
}
|
||||
|
||||
InfoArea {
|
||||
id: infoArea
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
margins: app.landscape() ? parent.width * 0.4:parent.width * 0.3
|
||||
topMargin: parent.height*( status === 901 ? 0.6:0.5) - height * 0.8
|
||||
}
|
||||
|
||||
excludedCodes: [200, 902]
|
||||
errorCode: root.status
|
||||
}
|
||||
|
||||
ListView {
|
||||
DataListView {
|
||||
id: calendarList
|
||||
|
||||
property var listData
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
//boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
model: listData.length
|
||||
|
||||
status: root.status
|
||||
|
||||
onRefresh: {
|
||||
root.loadData(root.nation)
|
||||
}
|
||||
|
||||
delegate: ItemDelegate {
|
||||
id: competitionDel
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ Page {
|
|||
}
|
||||
|
||||
function loadData(comp, cat, reg, route){
|
||||
root.status = 905
|
||||
loadingDl.open()
|
||||
console.log("[info][QML] getting ranking data of comp: " + comp + " and cat: " + cat + " reg: " + reg)
|
||||
var ret = serverConn.getRanking(comp, cat, reg, route)
|
||||
|
@ -63,7 +64,7 @@ Page {
|
|||
}
|
||||
|
||||
|
||||
if(ret["data"][ root.listKey ] === undefined || ret["data"][ root.listKey ].length < 1){
|
||||
if((ret["data"][ root.listKey ] === undefined || ret["data"][ root.listKey ].length < 1) && ( root.status === 200 || root.status === 404 ) ){
|
||||
root.status = 901
|
||||
}
|
||||
|
||||
|
@ -109,6 +110,9 @@ Page {
|
|||
|
||||
listData: root.reg ? root.rankingData:({})
|
||||
|
||||
onRefresh: {
|
||||
root.loadData(root.comId, root.catId, root.reg, root.routeNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,8 +140,8 @@ Page {
|
|||
|
||||
listData: root.reg ? ({}):root.rankingData
|
||||
|
||||
onListDataChanged: {
|
||||
console.log("list data changed")
|
||||
onRefresh: {
|
||||
root.loadData(root.comId, root.catId, root.reg, root.routeNumber)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -339,6 +339,11 @@ Window {
|
|||
errorString = "Incompatible API"
|
||||
errorDescription = "Please make shure that you are using the latest version of this app and try again."
|
||||
break
|
||||
case 905:
|
||||
infoLevel = 1
|
||||
errorString = "Loading..."
|
||||
errorDescription = "Please wait while we're loading some data"
|
||||
break
|
||||
default:
|
||||
infoLevel = 2
|
||||
errorString = "Unexpected error ("+errorCode+")"
|
||||
|
|
|
@ -24,7 +24,7 @@ void ServerConn::refreshFoodplan() {
|
|||
}
|
||||
|
||||
QVariant ServerConn::getCalendar(QString nation){
|
||||
QVariantMap ret = this->senddata(QUrl("http://egw.ifsc-climbing.org/egw/ranking/json.php?year=2018&nation=" + nation));
|
||||
QVariantMap ret = this->senddata(QUrl("http://egw.ifsc-climbing.org/egw/ranking/json.php?year=2019&nation=" + nation));
|
||||
|
||||
if(ret["status"] != 200){
|
||||
// request was a failure
|
||||
|
|
Loading…
Reference in a new issue