- changed year select icon

- added the ability to filter competitions by type (eg. world cup, youth, etc.)
This commit is contained in:
Dorian Zedler 2019-06-23 10:55:08 +02:00
parent 106628b6d0
commit 8aa2d31c40
26 changed files with 686 additions and 142 deletions

View file

@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
# [0.01.6] - 2019-06-15
### Fixed
- label for IFSC calendar
# [0.01.5] - 2019-06-15
### Fixed
- layout fixes
- cat when changing from 'MEN' to 'WOMEN' 'MEN' is not missing anymore
### Added
- infosheet url is now present in the cat select dialog if available
# [0.01.4b] - 2019-05-31
### Fixed
- fixed some errors that occurred when changing categories

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<manifest package="com.itsblue.blueROCKtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.01.4b" android:versionCode="5" android:installLocation="auto">
<manifest package="com.itsblue.blueROCKtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.01.6" android:versionCode="7" 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">
<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" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

View file

@ -18,6 +18,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
sources/appsettings.cpp \
sources/main.cpp \
sources/serverconn.cpp
@ -39,6 +40,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
headers/appsettings.h \
headers/serverconn.h
DISTFILES += \

43
headers/appsettings.h Normal file
View file

@ -0,0 +1,43 @@
#ifndef APPSETTINGS_H
#define APPSETTINGS_H
#include <QObject>
#include <QtDebug>
#include <QSettings>
#include <QStandardPaths>
class AppSettings : public QObject
{
Q_OBJECT
Q_PROPERTY(NOTIFY themeChanged)
public:
explicit AppSettings(QObject *parent = nullptr);
// This is the Constructor of the AppSettings class
~AppSettings();
// This is the Destructor of the AppSettings class
private:
QSettings *settingsManager;
// QSettings object which cares about our settings.ini file
QSettings *themeSettingsManager;
// QSettings object which cares about the themes
signals:
void themeChanged();
public slots:
Q_INVOKABLE QString read(const QString &key);
// function to read values from the settings file
Q_INVOKABLE void write(const QString &key, const QVariant &value);
// function to write values to the settings file
Q_INVOKABLE void setDefault(const QString &key, const QVariant &defaultValue);
// function to create a key (/ setting) with a default value if it hasnt been ceated yet
};
#endif // APPSETTINGS_H

View file

@ -38,9 +38,6 @@ signals:
public slots:
QVariant getCalendar(QString nation, int year);
QVariant getRanking(int competitionId, int categoryId, bool registrationData = false, bool rankingData = false, const int routeNumber = -2);
QVariant getAthlete(int perId);
QVariant getWidgetData(QVariantMap params);
};

View file

@ -15,7 +15,9 @@ Item {
property int preRefreshDelay: 1000 // delay before reload funcion is called
property int refreshPosition: height * 1.2 // position of the item when refreshing
property int dragOutPosition: height * 1.8 // position of the item when starting to refresh
property int dragOutPosition: height * 1.8 // maximum drag out
property double dragRefreshPositionMultiplier: 0.5 // position of the item when starting to refresh
property color backgroundColor: "white" // color for the pre-defined background
property color pullIndicatorColor: "black" // color for the pre-defined pull indicator
@ -49,6 +51,8 @@ Item {
property double drawProgress: control.dragProgress
rotation: drawProgress > control.dragRefreshPositionMultiplier ? 180:0
onDrawProgressChanged: {
requestPaint()
}
@ -68,8 +72,7 @@ Item {
var lineWidth = 2
var progress = drawProgress
console.log(progress)
var progress = drawProgress * 1 / control.dragRefreshPositionMultiplier > 1 ? 1 : drawProgress * 1 / control.dragRefreshPositionMultiplier
// modify all values to math the progress
arrowHeight = arrowHeight * progress
@ -101,6 +104,13 @@ Item {
ctx.stroke();
}
Behavior on rotation {
NumberAnimation {
duration: 100
}
}
}
signal refreshRequested
@ -132,16 +142,15 @@ Item {
topMargin: control.position - height
}
onUserPositionChanged: {
console.log(userPosition)
if(control.state === "idle" && userPosition >= control.dragOutPosition * 0.9){
control.state = "ready"
}
else if(control.state === "ready" && userPosition < control.dragOutPosition * 0.9){
Connections {
target: control.target
onDragEnded: {
if(userPosition >= control.dragOutPosition * control.dragRefreshPositionMultiplier){
control.state = "refreshing"
preRefreshTimer.start()
}
}
}
Loader {
id: backgroundLd
@ -177,13 +186,6 @@ Item {
sourceComponent: control.busyIndicator
}
Behavior on minimumPosition {
enabled: control.state !== "hidden" && control.state !== "idle"
NumberAnimation {
duration: 100
}
}
Timer {
id: preRefreshTimer
interval: control.preRefreshDelay <= 0 ? 1:control.preRefreshDelay
@ -204,6 +206,13 @@ Item {
}
}
Behavior on minimumPosition {
enabled: !control.target.dragging && state !== "idle"
NumberAnimation {
duration: 100
}
}
states: [
State {
name: "idle"
@ -211,7 +220,7 @@ Item {
PropertyChanges {
target: control
minimumPosition: userPosition > maximumPosition ? maximumPosition:userPosition
userPosition: -1 / (Math.abs( target.verticalOvershoot * 0.001 ) + 1 / control.dragOutPosition * 0.001) + control.dragOutPosition // Math.abs( target.verticalOvershoot )
userPosition: -1 / (Math.abs( target.verticalOvershoot * 0.001 + 0.003 ) + 1 / control.dragOutPosition * 0.001) + control.dragOutPosition // Math.abs( target.verticalOvershoot )
maximumPosition: control.dragOutPosition
}
@ -220,20 +229,6 @@ Item {
rotation: 0
}
},
State {
name: "ready"
PropertyChanges {
target: control
maximumPosition: control.dragOutPosition
userPosition: -1 / (Math.abs( target.verticalOvershoot * 0.001 ) + 1 / control.dragOutPosition * 0.001) + control.dragOutPosition // Math.abs( target.verticalOvershoot )
minimumPosition: userPosition > maximumPosition - 1 ? maximumPosition - 1:userPosition
}
PropertyChanges {
target: pullIndicatorLd
rotation: 180
}
},
State {
name: "refreshing"
PropertyChanges {

View file

@ -18,13 +18,55 @@
import QtQuick 2.0
import QtQuick.Controls 2.4
import "../Components"
Page {
id: root
title: "start"
title: "search athlete"
property Component headerComponent: null
property var searchResults: ({})
function search(term){
loadingDl.open()
root.searchResults = serverConn.getWidgetData({term:term}).data
loadingDl.close()
}
ListView {
anchors.fill: parent
anchors.topMargin: searchTf.height
anchors.margins: 10
clip: true
model: root.searchResults.length
delegate: ItemDelegate {
width: parent.width
text: root.searchResults[index]['label']
onClicked: app.openWidget({person: root.searchResults[index]['value']})
}
}
TextField {
id: searchTf
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: 10
}
Keys.onReturnPressed: {
console.warn(searchTf.text)
root.search("*" + searchTf.text + "*")
}
}
}

View file

@ -61,7 +61,7 @@ Page {
image: "qrc:/icons/ifsc.png"
onClicked: {
app.openWidget({nation:""})
app.openWidget({nation:"ICC"})
}
}

View file

@ -18,7 +18,10 @@
import QtQuick 2.9
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0
//import QtGraphicalEffects 1.0
//import QtQuick.Templates 2.04 as T
//import QtQuick.Controls.impl 2.04
import QtQuick.Controls.Material 2.3
import "../Components"
@ -97,9 +100,14 @@ Page {
// update all the given values
for(var prop in params){
if(params.hasOwnProperty(prop)){
if(params[prop] === null){
delete root.params[prop]
}
else {
root.params[prop] = params[prop]
}
}
}
loadData(root.params)
@ -244,11 +252,14 @@ Page {
id: selectorPu
property var dataObj
property string subTitle: ""
signal selectionFinished(int index, var data)
x: 0 //root.width / 2 - width / 2
y: root.height - height //root.height / 2 - height / 2
y: root.height - selectorPu.height * 0.7//root.height - height //root.height / 2 - height / 2
opacity: 0
width: root.width
height: selectorLv.implicitHeight
@ -258,10 +269,69 @@ Page {
title: ""
function appear(dataObj, title) {
header: Column {
id: selectorPuHeaderCol
width: parent.width
Label {
id: headerLa
visible: selectorPu.title
width: parent.width
elide: "ElideRight"
padding: 24
bottomPadding: 0
font.bold: true
font.pixelSize: 16
background: Rectangle {
radius: 2
color: selectorPu.Material.dialogColor
clip: true
}
text: selectorPu.title
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
Label {
id: headerSubLa
visible: selectorPu.subTitle
width: parent.width
elide: "ElideRight"
padding: 24
topPadding: 5
bottomPadding: 0
font.bold: true
font.pixelSize: 16
background: Rectangle {
radius: 2
color: selectorPu.Material.dialogColor
clip: true
}
text: selectorPu.subTitle
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
}
function appear(dataObj, title, subTitle) {
if(dataObj.length > 0){
selectorPu.dataObj = dataObj
selectorPu.title = title
selectorPu.subTitle = subTitle === undefined ? "":subTitle
selectorPu.open()
}
}
@ -274,7 +344,7 @@ Page {
anchors.fill: parent
implicitWidth: parent.width
implicitHeight: root.height * 0.6 < ( (delegateHeight + spacing) * model ) ? root.height * 0.6 : (delegateHeight + spacing) * model + 75
implicitHeight: root.height * 0.7 < ( (delegateHeight + spacing) * model ) ? root.height * 0.7 : (delegateHeight + spacing) * model + 100
model: selectorPu.dataObj !== undefined ? selectorPu.dataObj.length:0
@ -308,21 +378,30 @@ Page {
}
enter: Transition {
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
NumberAnimation {
property: "opacity";
//from: 0.0;
to: 1.0
}
NumberAnimation {
property: "y"
from: root.height - selectorPu.height * 0.7
//from: root.height - selectorPu.height * 0.7
to: root.height - selectorPu.height
}
}
exit: Transition {
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
NumberAnimation {
property: "opacity";
//from: 1.0;
to: 0.0
}
NumberAnimation {
property: "y"
from: root.height - selectorPu.height
//from: root.height - selectorPu.height
to: root.height - selectorPu.height * 0.7
}
}
}
}

View file

@ -27,10 +27,11 @@ DataListView {
property bool ready
property string title: (params.nation === "" ? "IFSC":params.nation === "GER" ? "DAV":"SAC") + " " + qsTr("competition calendar") + " " + control.year
property string title: (params.nation === "ICC" ? "IFSC":params.nation === "GER" ? "DAV":"SAC") + " " + qsTr("calendar") + " " + control.year
property Component headerComponent: RowLayout {
height: parent.height
width: 100//childrenRect.width
spacing: 0
@ -41,7 +42,29 @@ DataListView {
control.changeYear()
}
icon.name: "calendar"
icon.name: "year"
}
ToolButton {
id: filterToolBt
onClicked: {
var obj = app.compCats
var compCats = new Array
for(var prop in obj) {
// go through the whole array and search for data keys
if (obj.hasOwnProperty(prop) && obj[prop]["nation"] === params.nation) {
//console.log("found cat: " + obj[prop]['label'])
compCats.push( {"text": obj[prop]['label'], "data": obj[prop]} )
}
}
filterSelectPu.appear(compCats, qsTr("Select Filters"), "")
}
icon.name: "filter"
}
ToolButton {
@ -59,6 +82,8 @@ DataListView {
property int year: new Date().getFullYear()
property var displayedCompCats: []
anchors.fill: parent
//boundsBehavior: Flickable.StopAtBounds
@ -70,6 +95,8 @@ DataListView {
}
Component.onCompleted: {
initFilters()
if(model > 0){
control.ready = true
control.status = 200
@ -80,9 +107,11 @@ DataListView {
}
autoScroll()
}
onWidgetDataChanged: {
// if the IFSC Calendar is open -> add the worldranking
if(params.nation === ""){
if(params.nation === "ICC"){
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"]})
}
}
@ -91,7 +120,7 @@ DataListView {
// function to scroll to the next competition that is not already over
var compList = control.widgetData["competitions"]
//console.log("scrolling")
console.log("scrolling")
if(parseInt(control.year) === new Date().getFullYear()){
for(var i = 0; i < compList.length; i ++){
@ -146,7 +175,7 @@ DataListView {
}
}
selector.appear(selectOptions, qsTr("select category"))
selector.appear(selectOptions, control.widgetData["competitions"][compIndex]['name'], getCompInfoUrl(compIndex) !== undefined ? ("<a href='" + getCompInfoUrl(compIndex) + "'>infosheet</a>"): "")
}
function changeYear(){
@ -223,6 +252,66 @@ DataListView {
}
function getCompInfoUrl(compIndex) {
switch(params.nation) {
case "GER":
if(control.widgetData["competitions"][compIndex]['info'] !== undefined){
return "http://ranking.alpenverein.de/" + control.year + "/GER/" + control.widgetData["competitions"][compIndex]['rkey'] + ".pdf"
}
return
case "SUI":
return
default:
if(control.widgetData["competitions"][compIndex]['info'] === undefined){
return control.widgetData["competitions"][compIndex]['info2']
}
else {
return control.widgetData["competitions"][compIndex]['info']
}
}
}
function filterCats(display, cats) {
//console.log("filtering cats: " + cats + " displaying: " + display)
for(var i = 0; i < cats.length; i ++){
if(control.displayedCompCats.indexOf(cats[i]) >= 0 && !display){
control.displayedCompCats.splice(control.displayedCompCats.indexOf(cats[i]), 1)
}
else if(control.displayedCompCats.indexOf(cats[i]) == -1 && display){
control.displayedCompCats.push(cats[i])
}
}
// trigger 'changed' signal
control.displayedCompCats = control.displayedCompCats
appSettings.write("displayedCompCats"+params.nation, JSON.stringify(displayedCompCats))
//console.log("new JSON string is: " + JSON.stringify(displayedCompCats))
//console.log("displayed cats is now: " + control.displayedCompCats)
}
function initFilters() {
if(appSettings.read("displayedCompCats"+params.nation) !== "false"){
//console.log(appSettings.read("displayedCompCats"+params.nation))
control.displayedCompCats = JSON.parse(appSettings.read("displayedCompCats"+params.nation))
}
if(control.displayedCompCats.length === 0){
var obj = app.compCats
var compCats = new Array
for(var prop in obj) {
// go through the whole array and search for data keys
if (obj.hasOwnProperty(prop) && obj[prop]["nation"] === params.nation) {
//console.log("found cat: " + obj[prop]['label'])
filterCats(true, obj[prop]['cat_id'])
}
}
}
// trigger 'changed' signal
control.displayedCompCats = control.displayedCompCats
//console.log(control.displayedCompCats)
}
Connections {
target: parent.selector
onSelectionFinished: {
@ -243,6 +332,18 @@ DataListView {
}
}
header: Item {
id: topSpacerItm
width: parent.width
height: 10
}
footer: Item {
id: bottomSpacerItm
width: parent.width
height: 10
}
delegate: ItemDelegate {
id: competitionDel
@ -255,13 +356,22 @@ DataListView {
property int catId: thisData["cat_id"] === undefined ? 0:thisData["cat_id"]
width: parent.width
height: compDelCol.height + 10
height: visible ? compDelCol.height + 10 : 0
enabled: thisData["cats"] !== undefined && thisData["cats"].length > 0
visible: control.displayedCompCats.indexOf(parseInt(thisData['cat_id'])) >= 0
opacity: 0
scale: 0.9
Connections {
target: control
onDisplayedCompCatsChanged: {
//console.log("filters changed")
competitionDel.visible = control.displayedCompCats.indexOf(parseInt(competitionDel.thisData['cat_id'])) >= 0
}
}
onThisDataChanged: {
fadeInPa.start()
}
@ -307,14 +417,6 @@ DataListView {
text: name
}
/*Label {
id: infola
width: parent.width
text: thisData.info
}*/
Label {
id: dateLa
@ -339,4 +441,188 @@ DataListView {
}
}
Dialog {
id: filterSelectPu
property var dataObj
property string subTitle: ""
signal selectionFinished(int index, var data)
x: 0 - control.anchors.leftMargin //root.width / 2 - width / 2
y: root.height - filterSelectPu.height * 0.7//root.height - height //root.height / 2 - height / 2
opacity: 0
width: control.width + control.anchors.leftMargin + control.anchors.rightMargin
height: selectorLv.implicitHeight
modal: true
focus: true
title: ""
function appear(dataObj, title, subTitle) {
if(dataObj.length > 0){
filterSelectPu.dataObj = dataObj
filterSelectPu.title = title
filterSelectPu.subTitle = subTitle === undefined ? "":subTitle
filterSelectPu.open()
}
}
header: Column {
id: filterSelectPuHeaderCol
width: parent.width
Label {
id: headerLa
visible: filterSelectPu.title
width: parent.width
elide: "ElideRight"
padding: 24
bottomPadding: 0
font.bold: true
font.pixelSize: 16
background: Rectangle {
radius: 2
//color: filterSelectPu.Material.dialogColor
clip: true
}
text: filterSelectPu.title
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
Label {
id: headerSubLa
visible: filterSelectPu.subTitle
width: parent.width
elide: "ElideRight"
padding: 24
topPadding: 5
bottomPadding: 0
font.bold: true
font.pixelSize: 16
background: Rectangle {
radius: 2
//color: filterSelectPu.Material.dialogColor
clip: true
}
text: filterSelectPu.subTitle
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
}
ListView {
id: selectorLv
property int delegateHeight: 50
anchors.fill: parent
implicitWidth: parent.width
implicitHeight: root.height * 0.7 < ( (delegateHeight + spacing) * model ) ? root.height * 0.7 : (delegateHeight + spacing) * model + 100
model: filterSelectPu.dataObj !== undefined ? filterSelectPu.dataObj.length:0
ScrollIndicator.vertical: ScrollIndicator {
parent: selectorLv.parent
anchors {
top: selectorLv.top
left: selectorLv.right
margins: 10
leftMargin: 3
bottom: selectorLv.bottom
}
}
delegate: CheckDelegate {
id: catBt
width: parent.width
height: text !== "" ? selectorLv.delegateHeight:0
//flat: true
text: filterSelectPu.dataObj[index].text
Component.onCompleted: {
checked = getCheckedState()
}
Connections {
target: control
onDisplayedCompCatsChanged: {
//console.log("filters changed")
//competitionDel.visible = control.displayedCompCats.indexOf(parseInt(competitionDel.thisData['cat_id'])) >= 0
checked = getCheckedState()
}
}
function getCheckedState() {
for(var i = 0; i < filterSelectPu.dataObj[index].data.cat_id.length; i ++){
console.log("checking cat " + filterSelectPu.dataObj[index].data.label )
if(control.displayedCompCats.indexOf(filterSelectPu.dataObj[index].data.cat_id[i] ) >= 0){
return true
}
}
return false
}
onClicked: {
control.filterCats(checked, filterSelectPu.dataObj[index].data.cat_id)
if(control.displayedCompCats.length == 0){
control.filterCats(true, filterSelectPu.dataObj[index].data.cat_id)
checked = true
}
}
}
}
enter: Transition {
NumberAnimation {
property: "opacity";
//from: 0.0;
to: 1.0
}
NumberAnimation {
property: "y"
//from: root.height - filterSelectPu.height * 0.7
to: root.height - filterSelectPu.height
}
}
exit: Transition {
NumberAnimation {
property: "opacity";
//from: 1.0;
to: 0.0
}
NumberAnimation {
property: "y"
//from: root.height - filterSelectPu.height
to: root.height - filterSelectPu.height * 0.7
}
}
}
}

View file

@ -172,7 +172,7 @@ DataListView {
fontSizeMode: Text.Fit
font.bold: true
font.pixelSize: Math.abs( height * 0.4 )
font.pixelSize: Math.abs( height * 0.35 )
minimumPixelSize: height * 0.3
elide: "ElideRight"

View file

@ -194,7 +194,7 @@ DataListView {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
text: partDel.thisData["firstname"] + " " + partDel.thisData["lastname"]
text: partDel.thisData["firstname"] + " " + partDel.thisData["lastname"] + " (" + partDel.thisData["start_number"] + ")"
}
Label {
@ -235,7 +235,6 @@ DataListView {
Repeater {
id: boulderResRep
model: parseInt(widgetData[ "route_num_problems" ])
function getDataForIcon(index){

View file

@ -166,12 +166,12 @@ DataListView {
fontSizeMode: Text.Fit
font.bold: true
font.pixelSize: Math.abs( height * 0.45 )
font.pixelSize: Math.abs( height * 0.35 )
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
minimumPixelSize: 1
text: widgetData[ "participants" ][index]["firstname"] + " " + widgetData[ "participants" ][index]["lastname"]
text: widgetData[ "participants" ][index]["firstname"] + " " + widgetData[ "participants" ][index]["lastname"] + " (" + partDel.thisData["start_number"] + ")"
}
Label {

View file

@ -43,28 +43,44 @@ Window {
// - https://github.com/ralfbecker/ranking/blob/master/sitemgr/digitalrock/sac_calendar.php
property var compCats: {
'int' : {
// --- ICC ---
/*'int' : {
'label' : 'International',
'nation' : '',
'nation' : 'ICC',
'wettk_reg' : '^[0-9]{2,2}[_^E]{1}[^YJ]{1,1}.*',
'serie_reg' : '^[0-9]{2,2}_(WC|TR){1,1}.*',
'rang_title': 'CUWR continuously updated WORLDRANKING',
'bgcolor' : '#B8C8FF',
'nat_team_ranking' : '',
'cat_id' : [68,69,70,86,259]
'cat_id' : [68,86]//[68,69,70,86,259]
},*/
'worldcup': {
'label' : 'World Cups',
'nation' : 'ICC',
'bgcolor' : '#B8C8FF',
'cat_id' : [69]
},
'youth' : {
'label' : 'Int. Jugend',
'nation' : '',
'label' : 'Youth Events',
'nation' : 'ICC',
'wettk_reg' : '^[0-9]{2,2}(EYC|_J|_Y){1,1}.*',
'serie_reg' : '^[0-9]{2,2}_EYC',
'rang_title': '',
'bgcolor' : '#D8E8FF',
'cat_id' : [71,258]
},
'champandgames': {
'label': 'Championships and Games',
'nation': 'ICC',
'bgcolor' : '#B8C8FF',
'cat_id': [68,86]
},
'masters' : {
'label' : 'Masters',
'nation' : '',
'label' : 'Masters and Promo Events',
'nation' : 'ICC',
'wettk_reg' : '^[0-9]{2,2}_[^PWERASL]{1}.*',
// 'serie_reg' : '^[0-9]{2,2}_(WC|TR){1,1}.*',
// 'rang_title': 'CUWR continuously updated WORLDRANKING',
@ -72,18 +88,27 @@ Window {
'cat_id' : [70]
},
'para' : {
'label' : 'Paraclimbing',
'nation' : '',
'label' : 'Paraclimbing Events',
'nation' : 'ICC',
'wettk_reg' : '^[0-9]{2,2}_PE.*',
'bgcolor' : '#F0F0F0',
'cat_id' : [256,259]
},
'ger_boulder' : {
'cont': {
'label' : 'Continental Events',
'nation' : 'ICC',
'bgcolor' : '#B8C8FF',
'cat_id' : [262]
},
// --- GER ---
/*'ger_boulder' : {
'label' : 'Bouldern',
'nation' : 'GER',
'wettk_reg' : '^[0-9]{2,2}_B+.*',
'serie_reg' : '^[0-9]{2,2}_BC',
'bgcolor' : '#FFDBA8',
'bgcolor' : '#FFDBA8', //'#f59d30'
'cat_id' : [59]
},
'ger' : {
@ -91,7 +116,7 @@ Window {
'nation' : 'GER',
'wettk_reg' : '^[0-9]{2,2}[_J]{1,1}[^WLJ]+.*',
'serie_reg' : '^[0-9]{2,2}_DC',
'bgcolor' : '#A8F0A8',
'bgcolor' : '#A8F0A8', //'#69b9a9'
'cat_id' : [57]
},
'ger_speed' : {
@ -100,17 +125,24 @@ Window {
'wettk_reg' : '^[0-9]{2,2}[_J]{1,1}[^WLJ]+.*',
'serie_reg' : '',
'rang_title': '',
'bgcolor' : '#A8F0A8',
'bgcolor' : '#A8F0A8', //'#e72e5d'
'cat_id' : [60]
},*/
'ger_meisterschaft' : {
'label' : 'Deutsche Meisterschaft',
'nation' : 'GER',
'bgcolor' : '#A8F0A8',
'cat_id' : [57, 59, 60]
},
'ger_jugend' : {
'label' : 'Jugend',
'label' : 'Deutscher Jugendcup',
'nation' : 'GER',
'wettk_reg' : '^[0-9]{2,2}[_J]{1,1}[^WL]+.*',
'serie_reg' : '^[0-9]{2,2}_JC',
// 'rang_title': 'Deutsche Jugend RANGLISTE',
'bgcolor' : '#D8FFD8',
'cat_id' : [57,58]
'cat_id' : [58]
},
'ger_state' : {
'label' : 'Landesmeisterschaft',
@ -121,6 +153,9 @@ Window {
'bgcolor' : '#F0F0F0',
'cat_id' : [61,56]
},
// --- SUI ---
'sui' : {
'label' : 'Erwachsene',
'nation' : 'SUI',
@ -162,6 +197,7 @@ Window {
Component.onCompleted: {
//app.openAthlete(53139) // dorian: 53139 , rustam: 6933 , helen: 53300
//openWidget({nation:'GER'})
//mainStack.push("Pages/AthleteSearchPage.qml")
}
Shortcut {
@ -178,6 +214,10 @@ Window {
id: serverConn
}
AppSettings {
id: appSettings
}
StackView {
id: mainStack
@ -357,8 +397,20 @@ Window {
height: parent.height
onItemChanged: {
width = status === Loader.Ready ? item.width:0
onStatusChanged: {
//console.log("loader status changed: " + status)
if(status == 0){
extraComponentLoader.Layout.preferredWidth = 0
}
else {
extraComponentLoader.item.width = extraComponentLoader.item.implicitWidth
extraComponentLoader.Layout.preferredWidth = extraComponentLoader.item.width
}
//console.log("set loader width to: " + extraComponentLoader.Layout.preferredWidth + " for a item width of: " + extraComponentLoader.item.implicitWidth)
}
//sourceComponent: mainStack.currentItem.headerComponent

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

View file

@ -34,5 +34,13 @@
<file>icons/bluerock/20x20@2/calendar.png</file>
<file>icons/bluerock/20x20@3/calendar.png</file>
<file>icons/bluerock/20x20@4/calendar.png</file>
<file>icons/bluerock/20x20/filter.png</file>
<file>icons/bluerock/20x20/year.png</file>
<file>icons/bluerock/20x20@2/filter.png</file>
<file>icons/bluerock/20x20@2/year.png</file>
<file>icons/bluerock/20x20@3/filter.png</file>
<file>icons/bluerock/20x20@3/year.png</file>
<file>icons/bluerock/20x20@4/filter.png</file>
<file>icons/bluerock/20x20@4/year.png</file>
</qresource>
</RCC>

68
sources/appsettings.cpp Normal file
View file

@ -0,0 +1,68 @@
#include "headers/appsettings.h"
AppSettings::AppSettings(QObject* parent)
:QObject(parent)
{
// This is the Constructor of the AppSettings class
// get writable path to store the settings.ini file
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
qDebug() << "app settings path: " << path;
// create or open the settings.ini file
this->settingsManager = new QSettings(path+"/settings.ini", QSettings::IniFormat);
// set the values to their defaults if they haven't been created yet
// create or open the settings.ini file
this->themeSettingsManager = new QSettings(":/themes/" + this->read("theme") + ".ini", QSettings::IniFormat);
}
QString AppSettings::read(const QString &key)
{
// function to read values from the settings file
// open the value-group
this->settingsManager->beginGroup("AppSettings");
// read the value
QString value = this->settingsManager->value(key , false).toString();
// close the value-group
this->settingsManager->endGroup();
// return the value
return(value);
}
void AppSettings::write(const QString &key, const QVariant &value)
{
// function to write values to the settings file
// open the value-group
this->settingsManager->beginGroup("AppSettings");
// write the value
this->settingsManager->setValue(key, value);
// close the value-group
this->settingsManager->endGroup();
}
void AppSettings::setDefault(const QString &key, const QVariant &defaultValue)
{
// function to create a key (/ setting) with a default value if it hasnt been ceated yet
// read the current value
QString value = this->read(key);
if(value == "false"){
// if it is nor defined yet, the read function will return "false" (as a string)
// -> if that is the case -> create the key with the default value
this->write(key, defaultValue);
}
}
AppSettings::~AppSettings()
{
// This is the Destructor of the AppSettings class
// delete the settings manager
delete settingsManager;
}

View file

@ -23,6 +23,7 @@
#include <QIcon>
#include "headers/serverconn.h"
#include "headers/appsettings.h"
int main(int argc, char *argv[])
{
@ -36,6 +37,7 @@ int main(int argc, char *argv[])
QIcon::setThemeName("bluerock");
qmlRegisterType<ServerConn>("com.itsblue.digitalRockRanking", 1, 0, "ServerConn");
qmlRegisterType<AppSettings>("com.itsblue.digitalRockRanking", 1, 0, "AppSettings");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

View file

@ -22,70 +22,29 @@ ServerConn::ServerConn(QObject *parent) : QObject(parent)
{
}
QVariant ServerConn::getCalendar(QString nation, int year){
QString requestUrl = "http://egw.ifsc-climbing.org/egw/ranking/json.php?year=" + (year == 0 ? "":QString::number(year)) + "&nation=" + nation;
qDebug() << requestUrl;
QVariantMap ret = this->senddata(QUrl(requestUrl));
if(ret["status"] != 200){
// request was a failure
return QVariantMap({{"status", ret["status"]}, {"data", ""}});
}
QJsonDocument jsonReply = QJsonDocument::fromJson(ret["text"].toString().toUtf8());
QVariantMap rankingData = {{"status", 200}, {"data", jsonReply.toVariant()}};
return rankingData;
}
QVariant ServerConn::getRanking(int competiotionId, int categoryId, bool registrationData, bool rankingData, int routeNumber) {
QString requestUrl = "http://egw.ifsc-climbing.org/egw/ranking/json.php?" + QString(rankingData ? "cup":"comp") + "=" + QString::number( competiotionId ) + "&cat=" + QString::number( categoryId ) + (registrationData ? "&type=starters":"") + "&route=" + ((routeNumber == -2) ? "":QString::number(routeNumber));
qDebug() << requestUrl;
QVariantMap ret = this->senddata(QUrl(requestUrl));
if(ret["status"] != 200){
// request was a failure
return QVariantMap({{"status", ret["status"]}, {"data", ""}});
}
QJsonDocument jsonReply = QJsonDocument::fromJson(ret["text"].toString().toUtf8());
QVariantMap data = {{"status", 200}, {"data", jsonReply.toVariant()}};
return data;
}
QVariant ServerConn::getAthlete(int perId){
QString requestUrl = "http://egw.ifsc-climbing.org/egw/ranking/json.php?person=" + QString::number(perId);
qDebug() << requestUrl;
QVariantMap ret = this->senddata(QUrl(requestUrl));
if(ret["status"] != 200){
// request was a failure
return QVariantMap({{"status", ret["status"]}, {"data", ""}});
}
QJsonDocument jsonReply = QJsonDocument::fromJson(ret["text"].toString().toUtf8());
QVariantMap data = {{"status", 200}, {"data", jsonReply.toVariant()}};
return data;
}
QVariant ServerConn::getWidgetData(QVariantMap params){
QString requestUrl = "http://egw.ifsc-climbing.org/egw/ranking/json.php?";
QString requestUrl;
if(params["nation"].toString() == "ICC"){
requestUrl = "https://ifsc-egw.wavecdn.net/egw/ranking/json.php?";
params["nation"] = "";
}
else if (params["nation"].toString() == "GER") {
requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
}
else if (params["nation"].toString() == "SUI") {
requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
}
else {
params.remove("nation");
requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
}
for(QVariantMap::const_iterator iter = params.begin(); iter != params.end(); ++iter){
requestUrl += iter.key() + "=" + iter.value().toString() + "&";
}
requestUrl = requestUrl.left(requestUrl.length() - 1); // remove last &
qDebug() << requestUrl;
QVariantMap ret = this->senddata(QUrl(requestUrl));