2019-05-11 15:21:43 +02:00
|
|
|
/*
|
|
|
|
blueROCK - for digital rock
|
|
|
|
Copyright (C) 2019 Dorian Zedler
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Controls 2.4
|
2019-06-09 13:32:52 +02:00
|
|
|
import QtQuick.Layouts 1.3
|
2021-06-06 18:34:27 +02:00
|
|
|
import QtQuick.Controls.Material 2.12
|
2020-03-20 17:14:23 +01:00
|
|
|
import QtPurchasing 1.12
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2021-06-11 11:49:09 +02:00
|
|
|
import de.itsblue.blueROCK 1.0
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
import "./Pages"
|
|
|
|
import "./Components"
|
|
|
|
|
2021-06-20 15:09:53 +02:00
|
|
|
import "./Widgets"
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
Window {
|
|
|
|
visible: true
|
|
|
|
width: 540
|
|
|
|
height: 960
|
2021-06-20 20:11:19 +02:00
|
|
|
title: "blueROCK"
|
2019-04-20 22:57:40 +02:00
|
|
|
|
|
|
|
Page {
|
|
|
|
id: app
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
property int errorCode: -1
|
|
|
|
|
2021-06-08 19:23:55 +02:00
|
|
|
property var colorShade: Material.theme === Material.Light ? Material.Shade300 : Material.Shade700
|
|
|
|
property color nationalAdultsColor: Material.color(Material.Green, colorShade)
|
|
|
|
property color nationalYouthColor: Material.color(Material.LightGreen, colorShade)
|
2021-06-17 13:50:18 +02:00
|
|
|
property color federalColor: Material.color(Material.Grey, colorShade)
|
2021-06-08 19:23:55 +02:00
|
|
|
|
2019-05-23 23:17:27 +02:00
|
|
|
// comp cats source:
|
|
|
|
// - https://github.com/ralfbecker/ranking/blob/master/sitemgr/digitalrock/dav_calendar.php
|
|
|
|
// - https://github.com/ralfbecker/ranking/blob/master/sitemgr/digitalrock/sac_calendar.php
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-05-14 18:18:42 +02:00
|
|
|
property var compCats: {
|
2021-06-20 19:38:50 +02:00
|
|
|
// --- ICC ---
|
|
|
|
|
|
|
|
/*'int' : {
|
|
|
|
'label' : 'International',
|
|
|
|
'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,86]//[68,69,70,86,259]
|
|
|
|
},*/
|
|
|
|
'worldcup': {
|
|
|
|
'label' : 'World Cups',
|
|
|
|
'nation' : 'ICC',
|
|
|
|
'bgcolor' : '#B8C8FF',
|
|
|
|
'sort_rank': 1,
|
|
|
|
'cat_id' : [69]
|
|
|
|
},
|
|
|
|
'youth' : {
|
|
|
|
'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',
|
|
|
|
'sort_rank': 2,
|
|
|
|
'cat_id' : [71,258]
|
|
|
|
},
|
|
|
|
'cont': {
|
|
|
|
'label' : 'Continental Events',
|
|
|
|
'nation' : 'ICC',
|
|
|
|
'bgcolor' : '#B8C8FF',
|
|
|
|
'sort_rank': 3,
|
|
|
|
'cat_id' : [262]
|
|
|
|
},
|
|
|
|
'masters' : {
|
|
|
|
'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',
|
|
|
|
'bgcolor' : '#F0F0F0',
|
|
|
|
'sort_rank': 4,
|
|
|
|
'cat_id' : [70]
|
|
|
|
},
|
|
|
|
'para' : {
|
|
|
|
'label' : 'Paraclimbing Events',
|
|
|
|
'nation' : 'ICC',
|
|
|
|
'wettk_reg' : '^[0-9]{2,2}_PE.*',
|
|
|
|
'bgcolor' : '#F0F0F0',
|
|
|
|
'sort_rank': 5,
|
|
|
|
'cat_id' : [256,259]
|
|
|
|
},
|
|
|
|
'games': {
|
|
|
|
'label': 'Games',
|
|
|
|
'nation': 'ICC',
|
|
|
|
'bgcolor' : '#B8C8FF',
|
|
|
|
'sort_rank': 6,
|
|
|
|
'cat_id': [68,86]
|
|
|
|
},
|
2019-06-23 10:55:08 +02:00
|
|
|
|
|
|
|
// --- GER ---
|
|
|
|
|
|
|
|
'ger_meisterschaft' : {
|
|
|
|
'label' : 'Deutsche Meisterschaft',
|
|
|
|
'nation' : 'GER',
|
2021-06-08 19:23:55 +02:00
|
|
|
'bgcolor' : app.nationalAdultsColor,//'#A8F0A8',
|
2019-07-09 09:11:27 +02:00
|
|
|
'sort_rank': 1,
|
2019-06-23 10:55:08 +02:00
|
|
|
'cat_id' : [57, 59, 60]
|
2019-05-14 18:18:42 +02:00
|
|
|
},
|
2019-06-23 10:55:08 +02:00
|
|
|
|
2019-05-14 18:18:42 +02:00
|
|
|
'ger_jugend' : {
|
2019-06-23 10:55:08 +02:00
|
|
|
'label' : 'Deutscher Jugendcup',
|
2019-05-14 18:18:42 +02:00
|
|
|
'nation' : 'GER',
|
|
|
|
'wettk_reg' : '^[0-9]{2,2}[_J]{1,1}[^WL]+.*',
|
|
|
|
'serie_reg' : '^[0-9]{2,2}_JC',
|
2021-06-05 21:18:21 +02:00
|
|
|
// 'rang_title': 'Deutsche Jugend RANGLISTE',
|
2021-06-08 19:23:55 +02:00
|
|
|
'bgcolor' : app.nationalYouthColor,//'#D8FFD8',
|
2019-07-09 09:11:27 +02:00
|
|
|
'sort_rank': 2,
|
2019-06-23 10:55:08 +02:00
|
|
|
'cat_id' : [58]
|
2019-05-14 18:18:42 +02:00
|
|
|
},
|
|
|
|
'ger_state' : {
|
|
|
|
'label' : 'Landesmeisterschaft',
|
|
|
|
'nation' : 'GER',
|
|
|
|
'wettk_reg' : '^[0-9]{2,2}[_J]{1,1}LM.*',
|
|
|
|
'serie_reg' : '^[0-9]{2,2}[_J]{1,1}LM.*',
|
|
|
|
'rang_title': '',
|
2021-06-08 19:23:55 +02:00
|
|
|
'bgcolor' : app.federalColor, //'#F0F0F0',
|
2019-07-09 09:11:27 +02:00
|
|
|
'sort_rank': 3,
|
2019-05-14 18:18:42 +02:00
|
|
|
'cat_id' : [61,56]
|
|
|
|
},
|
2019-06-23 10:55:08 +02:00
|
|
|
|
|
|
|
// --- SUI ---
|
|
|
|
|
2019-05-14 18:18:42 +02:00
|
|
|
'sui' : {
|
|
|
|
'label' : 'Erwachsene',
|
|
|
|
'nation' : 'SUI',
|
|
|
|
'wettk_reg' : '^[0-9]{2,2}_[^R].*',
|
|
|
|
'serie_reg' : '.*',
|
|
|
|
'rang_title': 'SWISS RANKING',
|
2021-06-08 19:23:55 +02:00
|
|
|
'bgcolor' : app.nationalAdultsColor, //'#A8F0A8',
|
2019-07-09 09:11:27 +02:00
|
|
|
'sort_rank': 1,
|
2019-05-14 18:18:42 +02:00
|
|
|
'cat_id' : [62,63]
|
|
|
|
},
|
|
|
|
'sui_jugend' : {
|
|
|
|
'label' : 'Jugend',
|
|
|
|
'nation' : 'SUI',
|
|
|
|
'wettk_reg' : '^[0-9]{2,2}_[^R].*',
|
|
|
|
'serie_reg' : '.*',
|
|
|
|
'rang_title': 'SWISS RANKING',
|
2021-06-08 19:23:55 +02:00
|
|
|
'bgcolor' : app.nationalYouthColor, //'#D8FFD8',
|
2019-07-09 09:11:27 +02:00
|
|
|
'sort_rank': 2,
|
2019-05-14 18:18:42 +02:00
|
|
|
'cat_id' : [65]
|
|
|
|
},
|
|
|
|
'sui_local' : {
|
|
|
|
'label' : 'RegioCups',
|
|
|
|
'nation' : 'SUI',
|
|
|
|
'wettk_reg' : '^[0-9]{2,2}_RG_.*',
|
|
|
|
'rang_title': '',
|
2021-06-08 19:23:55 +02:00
|
|
|
'bgcolor' : app.federalColor, //'#F0F0F0',
|
2019-07-09 09:11:27 +02:00
|
|
|
'sort_rank': 3,
|
2019-05-14 18:18:42 +02:00
|
|
|
'cat_id' : [64]
|
|
|
|
},
|
|
|
|
'sui_ice' : {
|
|
|
|
'label' : 'Iceclimbing',
|
|
|
|
'nation' : 'SUI',
|
2021-06-20 15:09:53 +02:00
|
|
|
'wparams["valid"]ettk_reg' : '^[0-9]{2,2}_RC_.*',
|
2019-05-14 18:18:42 +02:00
|
|
|
'rang_title': '',
|
2021-06-08 19:23:55 +02:00
|
|
|
'bgcolor' : app.federalColor, //'#F0F0F0',
|
2019-07-09 09:11:27 +02:00
|
|
|
'sort_rank': 4,
|
2019-05-14 18:18:42 +02:00
|
|
|
'cat_id' : [84]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2021-06-17 13:50:18 +02:00
|
|
|
Material.theme: appSettings.read("darkTheme") === "true" ? Material.Dark:Material.Light
|
2021-06-06 18:34:27 +02:00
|
|
|
|
2019-05-12 21:33:22 +02:00
|
|
|
Component.onCompleted: {
|
2021-06-06 00:15:54 +02:00
|
|
|
//loadingDl.open()
|
2021-06-06 18:34:27 +02:00
|
|
|
//app.openAthlete() // dorian: 53139 , rustam: 6933 , helen: 53300
|
2019-05-24 14:15:07 +02:00
|
|
|
//openWidget({nation:'GER'})
|
2019-06-23 10:55:08 +02:00
|
|
|
//mainStack.push("Pages/AthleteSearchPage.qml")
|
2021-07-08 11:42:31 +02:00
|
|
|
//openWidget({comp: 11651, cat: 26})
|
2021-06-06 18:34:27 +02:00
|
|
|
//openWidget({person: 6623})
|
2021-06-20 15:09:53 +02:00
|
|
|
//console.log(JSON.stringify(serverConn.getParamsFromUrl("")))
|
2021-07-08 12:23:55 +02:00
|
|
|
//openWidgetFromUrl("https://l.bluerock.dev/?comp=11501&cat=GER_M")
|
2022-08-11 08:51:05 +02:00
|
|
|
//openWidgetFromUrl("https://www.digitalrock.de/egroupware/ranking/json.php?cat=12&comp=12171&type=")
|
2019-05-12 21:33:22 +02:00
|
|
|
}
|
|
|
|
|
2021-06-17 13:50:18 +02:00
|
|
|
FontLoader {
|
|
|
|
id: fa5solid
|
|
|
|
source: "qrc:/fonts/fa5solid.otf"
|
|
|
|
}
|
|
|
|
|
|
|
|
FontLoader {
|
|
|
|
id: fa5regular
|
|
|
|
source: "qrc:/fonts/fa5regular.otf"
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
Shortcut {
|
|
|
|
sequences: ["Esc", "Back"]
|
|
|
|
enabled: mainStack.depth > 1
|
2021-06-06 00:15:54 +02:00
|
|
|
onActivated: app.goBack()
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2021-06-11 11:49:09 +02:00
|
|
|
BlueRockBackend {
|
2019-04-20 22:57:40 +02:00
|
|
|
id: serverConn
|
2021-06-20 19:04:36 +02:00
|
|
|
|
|
|
|
onOpenedViaUrl: {
|
|
|
|
app.openWidgetFromUrl(url)
|
|
|
|
}
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-06-23 10:55:08 +02:00
|
|
|
AppSettings {
|
|
|
|
id: appSettings
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
StackView {
|
|
|
|
id: mainStack
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: toolBar.bottom
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
initialItem: startPgComp
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: startPgComp
|
|
|
|
StartPage {}
|
|
|
|
}
|
|
|
|
|
|
|
|
popEnter: Transition {
|
|
|
|
XAnimator {
|
|
|
|
from: (mainStack.mirrored ? -1 : 1) * -mainStack.width
|
|
|
|
to: 0
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
popExit: Transition {
|
|
|
|
XAnimator {
|
|
|
|
from: 0
|
|
|
|
to: (mainStack.mirrored ? -1 : 1) * mainStack.width
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pushEnter: Transition {
|
|
|
|
XAnimator {
|
|
|
|
from: (mainStack.mirrored ? -1 : 1) * mainStack.width
|
|
|
|
to: 0
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pushExit: Transition {
|
|
|
|
XAnimator {
|
|
|
|
from: 0
|
|
|
|
to: (mainStack.mirrored ? -1 : 1) * -mainStack.width
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AppToolBar {
|
|
|
|
id: toolBar
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
2019-04-22 12:38:23 +02:00
|
|
|
topMargin: -height
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
height: 50
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
showErrorBar: true
|
|
|
|
|
2019-06-09 13:32:52 +02:00
|
|
|
RowLayout {
|
2019-04-21 18:35:28 +02:00
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
spacing: width * 0.02
|
|
|
|
|
2019-06-09 13:32:52 +02:00
|
|
|
ToolButton {
|
2019-04-21 18:35:28 +02:00
|
|
|
id:toolButton
|
|
|
|
|
2019-06-09 13:32:52 +02:00
|
|
|
height: parent.height
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2021-06-06 00:15:54 +02:00
|
|
|
onClicked: app.goBack()
|
2021-06-17 13:50:18 +02:00
|
|
|
|
|
|
|
text: "\uf053"
|
|
|
|
font.family: fa5solid.name
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
Column {
|
|
|
|
|
2019-06-09 13:32:52 +02:00
|
|
|
Layout.fillWidth: true
|
2019-04-21 18:35:28 +02:00
|
|
|
|
|
|
|
height: childrenRect.height
|
2019-04-22 12:38:23 +02:00
|
|
|
width: parent.width - extraComponentLoader.width - toolButton.width - 3 * parent.spacing
|
2019-04-21 18:35:28 +02:00
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
MovingLabel {
|
2019-04-21 18:35:28 +02:00
|
|
|
id: toolBarTitleLa
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
syncWithLabel: toolBarSubTitleLa
|
2019-04-22 12:38:23 +02:00
|
|
|
width: parent.width
|
2019-05-12 21:33:22 +02:00
|
|
|
scale: 1
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
font.bold: true
|
2019-04-22 12:38:23 +02:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
text: getText()
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
function getText(){
|
|
|
|
var titleString = "";
|
|
|
|
|
|
|
|
if(!mainStack.currentItem.titleIsPageTitle){
|
|
|
|
for(var i=1; i<mainStack.depth; i++){
|
|
|
|
if(i > 1){
|
|
|
|
titleString += " > "
|
|
|
|
}
|
|
|
|
|
|
|
|
titleString += mainStack.get(i).title
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
titleString = mainStack.currentItem.title
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
return(titleString)
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
2019-05-12 21:33:22 +02:00
|
|
|
|
|
|
|
Behavior on text {
|
|
|
|
FadeAnimation {
|
|
|
|
target: toolBarTitleLa
|
|
|
|
}
|
|
|
|
}
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
MovingLabel {
|
2019-04-21 18:35:28 +02:00
|
|
|
id: toolBarSubTitleLa
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
visible: text !== ""
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
syncWithLabel: toolBarTitleLa
|
|
|
|
width: parent.width
|
2019-05-11 15:16:23 +02:00
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
font.bold: false
|
|
|
|
|
|
|
|
text: getText()
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
function getText(){
|
|
|
|
var titleString = "";
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
if(mainStack.currentItem.subTitle !== undefined){
|
|
|
|
titleString = mainStack.currentItem.subTitle
|
|
|
|
}
|
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
return titleString
|
2019-04-21 18:35:28 +02:00
|
|
|
}
|
2019-05-12 21:33:22 +02:00
|
|
|
|
|
|
|
Behavior on text {
|
|
|
|
FadeAnimation {
|
|
|
|
target: toolBarSubTitleLa
|
|
|
|
}
|
|
|
|
}
|
2019-04-21 18:35:28 +02:00
|
|
|
}
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-04-21 18:35:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: extraComponentLoader
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-05-29 20:59:01 +02:00
|
|
|
property int maximumWidth: parent.width * 0.4 - toolButton.width - 3
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2019-05-29 20:59:01 +02:00
|
|
|
height: parent.height
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2021-06-05 21:18:21 +02:00
|
|
|
onItemChanged: {
|
2021-06-06 18:34:27 +02:00
|
|
|
if(item === null) {
|
|
|
|
extraComponentLoader.Layout.preferredWidth = 0
|
2021-06-05 21:18:21 +02:00
|
|
|
return
|
2021-06-06 18:34:27 +02:00
|
|
|
}
|
2019-06-23 10:55:08 +02:00
|
|
|
|
2021-06-05 21:18:21 +02:00
|
|
|
extraComponentLoader.item.width = extraComponentLoader.item.implicitWidth
|
|
|
|
extraComponentLoader.Layout.preferredWidth = extraComponentLoader.item.width
|
|
|
|
widthChangedCon.target = extraComponentLoader.item
|
2019-05-29 20:59:01 +02:00
|
|
|
}
|
|
|
|
|
2019-05-12 21:33:22 +02:00
|
|
|
Connections {
|
|
|
|
target: mainStack
|
2021-06-05 21:18:21 +02:00
|
|
|
function onCurrentItemChanged() {
|
2019-05-29 20:59:01 +02:00
|
|
|
secondCon.target = mainStack.currentItem
|
|
|
|
disappearNa.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
id: secondCon
|
2021-06-05 21:18:21 +02:00
|
|
|
target: null
|
|
|
|
function onHeaderComponentChanged() {
|
2019-05-12 21:33:22 +02:00
|
|
|
disappearNa.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-07 17:13:55 +02:00
|
|
|
Connections {
|
|
|
|
id: widthChangedCon
|
2021-06-05 21:18:21 +02:00
|
|
|
function onImplicitWidthChanged() {
|
2019-07-07 17:13:55 +02:00
|
|
|
extraComponentLoader.item.width = extraComponentLoader.item.implicitWidth
|
|
|
|
extraComponentLoader.Layout.preferredWidth = extraComponentLoader.item.implicitWidth
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-12 21:33:22 +02:00
|
|
|
ParallelAnimation {
|
|
|
|
id: appearNa
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
|
|
|
target: extraComponentLoader
|
|
|
|
property: "opacity"
|
|
|
|
|
|
|
|
from: 0
|
|
|
|
to: 1
|
|
|
|
|
|
|
|
duration: 150
|
|
|
|
}
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
|
|
|
target: extraComponentLoader
|
|
|
|
property: "scale"
|
|
|
|
|
|
|
|
from: 0.9
|
|
|
|
to: 1
|
|
|
|
|
|
|
|
duration: 150
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ParallelAnimation {
|
|
|
|
id: disappearNa
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
|
|
|
target: extraComponentLoader
|
|
|
|
property: "opacity"
|
|
|
|
|
|
|
|
from: 1
|
|
|
|
to: 0
|
|
|
|
|
|
|
|
duration: 150
|
|
|
|
}
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
|
|
|
target: extraComponentLoader
|
|
|
|
property: "scale"
|
|
|
|
|
|
|
|
from: 1
|
|
|
|
to: 0.9
|
|
|
|
|
|
|
|
duration: 150
|
|
|
|
}
|
|
|
|
|
|
|
|
onRunningChanged: {
|
|
|
|
if(!running){
|
|
|
|
extraComponentLoader.sourceComponent = mainStack.currentItem.headerComponent
|
|
|
|
appearNa.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
2019-04-21 18:35:28 +02:00
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Behavior on anchors.topMargin {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "closed"
|
|
|
|
when: mainStack.depth === 1
|
|
|
|
PropertyChanges {
|
|
|
|
target: toolBar
|
2019-04-22 12:38:23 +02:00
|
|
|
anchors.topMargin: -height
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "open"
|
|
|
|
when: mainStack.depth > 1
|
|
|
|
PropertyChanges {
|
|
|
|
target: toolBar
|
|
|
|
anchors.topMargin: 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2021-06-06 00:15:54 +02:00
|
|
|
Popup {
|
2019-04-20 22:57:40 +02:00
|
|
|
id: loadingDl
|
|
|
|
|
|
|
|
x: ( app.width - width ) / 2
|
|
|
|
y: ( app.height - height ) / 2
|
|
|
|
|
|
|
|
modal: true
|
|
|
|
closePolicy: Dialog.NoAutoClose
|
|
|
|
|
|
|
|
contentItem: Column {
|
2021-06-06 00:15:54 +02:00
|
|
|
|
|
|
|
spacing: 50
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
FancyBusyIndicator {
|
|
|
|
running: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
font.bold: true
|
2021-06-06 00:15:54 +02:00
|
|
|
color: "white"
|
2019-04-20 22:57:40 +02:00
|
|
|
|
2021-06-20 21:08:59 +02:00
|
|
|
//% "Loading"
|
|
|
|
text: qsTrId("#loading") + "..."
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
}
|
2021-06-06 00:15:54 +02:00
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
color: "transparent"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-07-10 22:05:53 +02:00
|
|
|
Store {
|
2021-06-06 21:53:41 +02:00
|
|
|
id: inAppProductStore
|
|
|
|
|
2019-07-10 22:05:53 +02:00
|
|
|
Product {
|
|
|
|
id: speedFlowChartProduct
|
2021-07-08 11:42:31 +02:00
|
|
|
identifier: "speed_flowchart"
|
|
|
|
//identifier: "android.test.purchased"
|
2021-06-06 21:53:41 +02:00
|
|
|
//identifier: "android.test.canceled"
|
|
|
|
//identifier: "android.test.refunded"
|
|
|
|
|
2019-07-10 22:05:53 +02:00
|
|
|
type: Product.Unlockable
|
|
|
|
|
|
|
|
onPurchaseRestored: {
|
|
|
|
appSettings.write("speedBackendPurchase", 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
onPurchaseSucceeded: {
|
|
|
|
appSettings.write("speedBackendPurchase", 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
onPurchaseFailed: {
|
|
|
|
appSettings.write("speedBackendPurchase", 0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-06 00:15:54 +02:00
|
|
|
function landscape() {
|
2019-04-20 22:57:40 +02:00
|
|
|
return app.height < app.width
|
|
|
|
}
|
|
|
|
|
2021-06-17 13:50:18 +02:00
|
|
|
function toggleDarkMode() {
|
|
|
|
var dark = app.Material.theme === Material.Light
|
|
|
|
|
|
|
|
app.Material.theme = dark ? Material.Dark : Material.Light
|
|
|
|
appSettings.write("darkTheme", dark)
|
|
|
|
}
|
|
|
|
|
2021-06-07 20:56:53 +02:00
|
|
|
function largeScreen() {
|
|
|
|
return Math.min(app.width, app.height) > 750
|
|
|
|
}
|
|
|
|
|
2021-06-06 00:15:54 +02:00
|
|
|
function openWidget(params) {
|
2019-05-23 23:17:27 +02:00
|
|
|
loadingDl.open()
|
|
|
|
|
2021-06-20 15:09:53 +02:00
|
|
|
console.log("Opening widget: ", JSON.stringify(params))
|
2019-05-29 20:59:01 +02:00
|
|
|
|
2021-06-20 15:09:53 +02:00
|
|
|
var result = false
|
|
|
|
|
|
|
|
if(Object.keys(params).length) {
|
|
|
|
var calComp = Qt.createComponent("qrc:/Pages/WidgetPage.qml").createObject(null, {"params": params})
|
|
|
|
app.errorCode = calComp.status
|
|
|
|
|
|
|
|
if(calComp.ready) {
|
|
|
|
mainStack.push(calComp)
|
|
|
|
result = true
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
delete(calComp)
|
|
|
|
}
|
2019-05-23 23:17:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
loadingDl.close()
|
2021-06-20 15:09:53 +02:00
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
function openWidgetFromUrl(url) {
|
|
|
|
var result = serverConn.getParamsFromUrl(url)
|
|
|
|
|
|
|
|
if(result["valid"]) {
|
|
|
|
openWidget(result["params"])
|
|
|
|
return app.errorCode !== 906
|
|
|
|
}
|
|
|
|
|
|
|
|
return result["valid"]
|
2019-05-23 23:17:27 +02:00
|
|
|
}
|
|
|
|
|
2021-06-06 00:15:54 +02:00
|
|
|
function defaultString(string, defaultString) {
|
|
|
|
if(string === undefined || string === null) {
|
2019-07-04 23:00:43 +02:00
|
|
|
return defaultString
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-06 00:15:54 +02:00
|
|
|
function goBack() {
|
|
|
|
if(!mainStack.currentItem.hasOwnProperty('onBackRequested') || mainStack.currentItem.onBackRequested())
|
|
|
|
mainStack.pop()
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
function getErrorInfo(errorCode) {
|
|
|
|
|
|
|
|
var infoLevel
|
|
|
|
// 0 - ok
|
|
|
|
// 1 - info
|
|
|
|
// 2 - error
|
|
|
|
|
|
|
|
var errorString
|
|
|
|
|
|
|
|
switch(errorCode) {
|
|
|
|
case 0:
|
|
|
|
infoLevel = 2
|
2021-06-20 20:11:19 +02:00
|
|
|
//% "No connection to server"
|
2021-06-20 21:08:59 +02:00
|
|
|
errorString = qsTrId("#noConnectionError")
|
2019-04-20 22:57:40 +02:00
|
|
|
break
|
2021-06-20 15:09:53 +02:00
|
|
|
case 404:
|
|
|
|
infoLevel = 2
|
2021-06-20 20:11:19 +02:00
|
|
|
//% "Not found"
|
2021-06-20 21:08:59 +02:00
|
|
|
errorString = qsTrId("#notFoundError")
|
2019-04-20 22:57:40 +02:00
|
|
|
break
|
|
|
|
case 901:
|
|
|
|
infoLevel = 1
|
2021-06-20 20:11:19 +02:00
|
|
|
//% "No Data"
|
2021-06-20 21:08:59 +02:00
|
|
|
errorString = qsTrId("#noDataError")
|
2019-04-21 12:35:11 +02:00
|
|
|
break
|
2021-06-20 15:09:53 +02:00
|
|
|
case 906:
|
|
|
|
infoLevel = 2
|
2021-06-20 20:11:19 +02:00
|
|
|
//% "Invalid Request"
|
2021-06-20 21:08:59 +02:00
|
|
|
errorString = qsTrId("#invalidRequestError")
|
2021-06-20 15:09:53 +02:00
|
|
|
errorDescription = "Invalid Request"
|
|
|
|
break
|
2019-04-20 22:57:40 +02:00
|
|
|
default:
|
|
|
|
infoLevel = 2
|
2021-06-20 20:11:19 +02:00
|
|
|
//% "Unexpected error"
|
2021-06-20 21:08:59 +02:00
|
|
|
errorString = qsTrId("#unexpectedError") + " ("+errorCode+")"
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2021-06-20 20:11:19 +02:00
|
|
|
return([infoLevel, errorString])
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
2019-05-31 12:18:35 +02:00
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
}
|