2018-08-12 20:51:57 +02:00
|
|
|
/*
|
|
|
|
Speed Climbing Stopwatch - Simple Stopwatch for Climbers
|
|
|
|
Copyright (C) 2018 Itsblue Development - Dorian Zeder
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, version 3 of the License.
|
|
|
|
|
|
|
|
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 Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-08-02 12:50:55 +02:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtMultimedia 5.8
|
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtQuick.Layouts 1.3
|
2019-04-30 23:44:04 +02:00
|
|
|
import QtGraphicalEffects 1.0
|
2018-08-02 12:50:55 +02:00
|
|
|
import com.itsblue.speedclimbingstopwatch 1.0
|
2019-04-30 23:44:04 +02:00
|
|
|
import "./components"
|
2018-08-02 12:50:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
Popup {
|
|
|
|
id: root
|
2019-04-30 23:44:04 +02:00
|
|
|
|
2018-08-02 12:50:55 +02:00
|
|
|
modal: true
|
|
|
|
dim: false
|
|
|
|
|
2019-04-30 23:44:04 +02:00
|
|
|
opacity: 0
|
|
|
|
|
2018-08-02 12:50:55 +02:00
|
|
|
enter: Transition {
|
2019-04-30 23:44:04 +02:00
|
|
|
NumberAnimation { properties: "opacity"; to: 1; duration: 300; easing.type: Easing.InOutQuad }
|
|
|
|
NumberAnimation { properties: "scale"; from: 0.9; to: 1; duration: 300; easing.type: Easing.InOutQuad }
|
2018-08-02 12:50:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
exit: Transition {
|
2019-04-30 23:44:04 +02:00
|
|
|
NumberAnimation { properties: "opacity"; to: 0; duration: 300; easing.type: Easing.InOutQuad }
|
|
|
|
NumberAnimation { properties: "scale"; from: 1; to: 0.9; duration: 300; easing.type: Easing.InOutQuad }
|
2018-08-02 12:50:55 +02:00
|
|
|
}
|
|
|
|
|
2019-04-30 23:44:04 +02:00
|
|
|
background: Item {
|
|
|
|
|
|
|
|
RectangularGlow {
|
|
|
|
id: backgroundEffect
|
|
|
|
glowRadius: 7
|
|
|
|
spread: 0.02
|
|
|
|
color: "black"
|
|
|
|
opacity: 0.18
|
|
|
|
anchors.fill: backgroundRect
|
|
|
|
cornerRadius: backgroundRect.radius
|
|
|
|
scale: 1
|
2018-08-02 12:50:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
2019-04-30 23:44:04 +02:00
|
|
|
id: backgroundRect
|
2018-08-02 12:50:55 +02:00
|
|
|
anchors.fill: parent
|
2019-04-30 23:44:04 +02:00
|
|
|
radius: width * 0.1
|
|
|
|
color: appTheme.style.viewColor
|
2018-08-02 12:50:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-03 15:18:23 +02:00
|
|
|
|
|
|
|
StackView {
|
|
|
|
id: profiles_stack
|
|
|
|
property int text_pixelSize: headlineUnderline.width * 0.08
|
2019-05-03 22:54:32 +02:00
|
|
|
//initialItem: profileListComp
|
2018-08-03 15:18:23 +02:00
|
|
|
width: headlineUnderline.width
|
|
|
|
|
2018-08-02 12:50:55 +02:00
|
|
|
anchors {
|
2019-04-30 23:44:04 +02:00
|
|
|
top: topContainerItm.bottom
|
2018-08-02 12:50:55 +02:00
|
|
|
left: parent.left
|
|
|
|
leftMargin: ( parent.width - headlineUnderline.width ) / 2
|
2019-04-30 23:44:04 +02:00
|
|
|
//topMargin: headlineUnderline.anchors.topMargin * 1.2
|
2018-08-02 12:50:55 +02:00
|
|
|
bottom: parent.bottom
|
2019-05-02 22:39:22 +02:00
|
|
|
bottomMargin: topContainerItm.height
|
2018-08-02 12:50:55 +02:00
|
|
|
}
|
|
|
|
|
2018-08-03 15:18:23 +02:00
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {duration: 200}
|
|
|
|
}
|
2018-08-02 12:50:55 +02:00
|
|
|
|
2019-05-21 19:07:54 +02:00
|
|
|
Component.onCompleted: {
|
|
|
|
profiles_stack.init()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-03 22:54:32 +02:00
|
|
|
Connections {
|
|
|
|
target: root
|
|
|
|
onOpened: {
|
2019-05-21 19:07:54 +02:00
|
|
|
profiles_stack.init()
|
2019-05-03 22:54:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onCurrentItemChanged: {
|
|
|
|
currentItem.opened()
|
|
|
|
}
|
|
|
|
|
2019-05-21 19:07:54 +02:00
|
|
|
function init() {
|
|
|
|
if(profiles_stack.depth === 0){
|
|
|
|
profiles_stack.openAthletes()
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
profiles_stack.currentItem.opened()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-03 22:54:32 +02:00
|
|
|
function openAthletes() {
|
|
|
|
var athsComp = profileListComp.createObject(null, {})
|
|
|
|
profiles_stack.push(athsComp)
|
|
|
|
}
|
|
|
|
|
|
|
|
function openResults( userName ){
|
|
|
|
var resComp = resultViewComp.createObject(null, {"userName": userName})
|
|
|
|
profiles_stack.push(resComp)
|
|
|
|
}
|
|
|
|
|
2018-08-03 15:18:23 +02:00
|
|
|
/*-----List of all profiles-----*/
|
|
|
|
Component {
|
|
|
|
id: profileListComp
|
2018-08-11 23:54:34 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
RemoteDataListView {
|
|
|
|
id: profileList
|
2019-04-30 23:44:04 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
property int currentAthlete: -1
|
|
|
|
property string title: "profiles"
|
|
|
|
property string secondButt: "add"
|
2019-04-30 23:44:04 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
signal opened()
|
2019-05-02 22:39:22 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
onOpened: {
|
|
|
|
profileList.loadData()
|
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.topMargin: topContainerItm.height * 0.1
|
2018-08-02 12:50:55 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
loadData: function () {
|
|
|
|
status = 905
|
2019-05-21 18:40:45 +02:00
|
|
|
//listData = {}
|
2019-05-19 14:06:05 +02:00
|
|
|
var retData = speedBackend.getAthletes()
|
2019-05-02 22:39:22 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
if(retData === undefined){
|
|
|
|
status = 500
|
|
|
|
return
|
|
|
|
}
|
2019-05-02 22:39:22 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
listData = retData["allAthletes"]
|
|
|
|
currentAthlete = retData["activeAthlete"]
|
|
|
|
status = listData.lenght !== false ? 200:0
|
|
|
|
}
|
2019-05-02 22:39:22 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
delegate: SwipeDelegate {
|
|
|
|
id: swipeDelegate
|
2019-05-02 22:39:22 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
property bool active: profileList.currentAthlete === profileList.listData[index]["id"]
|
2018-08-11 23:54:34 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
text: profileList.listData[index]["fullName"]
|
|
|
|
width: profileList.width - (swipeDelegate.x)
|
2019-05-21 18:40:45 +02:00
|
|
|
height: profileList.height / 5
|
2019-05-02 22:39:22 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
font.pixelSize: profiles_stack.text_pixelSize
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
function remove() {
|
|
|
|
removeAnim.start()
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
onClicked: {
|
|
|
|
profiles_stack.openResults(profileList.listData[index]["userName"])
|
2019-05-03 22:54:32 +02:00
|
|
|
}
|
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
contentItem: Text {
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: swipeDelegate.width * 0.05
|
|
|
|
right: parent.right
|
|
|
|
rightMargin: swipeDelegate.rightPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
text: swipeDelegate.text
|
|
|
|
color: appTheme.style.textColor
|
|
|
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
|
|
|
|
font.pixelSize: swipeDelegate.height * 0.4
|
|
|
|
|
|
|
|
minimumPixelSize: 1
|
|
|
|
}
|
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
background: Rectangle {
|
2019-05-21 18:40:45 +02:00
|
|
|
color: pressed ? appTheme.style.delegatePressedColor : appTheme.style.delegateBackgroundColor
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
Behavior on color {
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
ColorAnimation {
|
|
|
|
duration: 200
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
}
|
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
CheckBox {
|
|
|
|
id: control
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
right: parent.right
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
height: parent.height * 0.6
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
checked: swipeDelegate.active
|
|
|
|
|
|
|
|
onCheckedChanged: {
|
|
|
|
if(checked && !swipeDelegate.active && speedBackend.selectAthlete(profileList.listData[index]["userName"])){
|
|
|
|
profileList.loadData()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
indicator: Rectangle {
|
|
|
|
implicitWidth: 26
|
|
|
|
implicitHeight: 26
|
|
|
|
|
|
|
|
height: parent.height
|
|
|
|
width: height
|
|
|
|
|
|
|
|
x: control.leftPadding
|
|
|
|
y: parent.height / 2 - height / 2
|
2019-05-03 22:54:32 +02:00
|
|
|
|
|
|
|
radius: width * 0.2
|
2019-05-19 14:06:05 +02:00
|
|
|
border.color: control.down ? "#17a81a" : "#21be2b"
|
2019-05-21 18:40:45 +02:00
|
|
|
color: control.down ? appTheme.style.delegatePressedColor : appTheme.style.delegateBackgroundColor
|
2019-05-19 14:06:05 +02:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
width: parent.width * 0.65
|
|
|
|
height: width
|
|
|
|
anchors.centerIn: parent
|
|
|
|
radius: control.checked ? width * 0.2:0
|
|
|
|
color: control.down ? "#17a81a" : "#21be2b"
|
|
|
|
opacity: control.checked ? 1:0
|
|
|
|
scale: control.checked ? 0.9:0
|
|
|
|
|
|
|
|
Behavior on color {
|
|
|
|
ColorAnimation {
|
|
|
|
duration: 200
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Behavior on radius {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 200
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 200
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Behavior on scale {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 200
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
}
|
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
Rectangle {
|
|
|
|
color: "grey"
|
|
|
|
height: 1
|
|
|
|
width: parent.width * 0.9
|
|
|
|
visible: index > 0
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
top: parent.top
|
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
}
|
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
NumberAnimation {
|
|
|
|
id: removeAnim
|
|
|
|
target: swipeDelegate
|
|
|
|
property: "height"
|
|
|
|
to: 0
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
onStopped: profileModel.model.remove(index)
|
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
swipe.transition: Transition {
|
|
|
|
SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic }
|
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
swipe.left: Row {
|
|
|
|
anchors.left: parent.left
|
2018-08-11 23:54:34 +02:00
|
|
|
height: parent.height
|
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
Label {
|
|
|
|
id: deleteLabel
|
|
|
|
text: qsTr("Delete")
|
2019-05-21 18:40:45 +02:00
|
|
|
color: appTheme.style.textColor
|
2019-05-19 14:06:05 +02:00
|
|
|
verticalAlignment: Label.AlignVCenter
|
|
|
|
padding: 12
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
SwipeDelegate.onClicked: {
|
|
|
|
profileList.status = 905
|
|
|
|
if(speedBackend.deleteAthlete(profileList.listData[index]["userName"])){
|
|
|
|
profileList.loadData()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
profileList.status = 200
|
2019-05-02 22:39:22 +02:00
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
|
2019-05-19 14:06:05 +02:00
|
|
|
background: Rectangle {
|
|
|
|
color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
|
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-02 12:50:55 +02:00
|
|
|
}
|
2019-05-19 14:06:05 +02:00
|
|
|
|
2018-08-03 15:18:23 +02:00
|
|
|
}
|
2018-08-02 12:50:55 +02:00
|
|
|
|
2018-08-03 15:18:23 +02:00
|
|
|
/*-----Option to add a profile-----*/
|
|
|
|
Component {
|
|
|
|
id: addProfileComp
|
|
|
|
Column {
|
|
|
|
property string title: "add profile"
|
|
|
|
property string secondButt: "ok"
|
|
|
|
property string newProfileName: ""
|
2019-05-02 22:39:22 +02:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: head_add
|
|
|
|
|
|
|
|
enabled: true
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
if(speedBackend.createAthlete(userNameTf.text, fullNameTf.text)){
|
2019-05-19 14:06:05 +02:00
|
|
|
profiles_stack.get(profiles_stack.depth - 2 ).opened()
|
2019-05-02 22:39:22 +02:00
|
|
|
profiles_stack.pop()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-03 15:18:23 +02:00
|
|
|
TextField {
|
2019-05-02 22:39:22 +02:00
|
|
|
id: fullNameTf
|
2018-08-03 15:18:23 +02:00
|
|
|
width: parent.width
|
2019-05-02 22:39:22 +02:00
|
|
|
placeholderText: "full name"
|
|
|
|
onTextChanged: {
|
|
|
|
parent.newProfileName = text
|
|
|
|
}
|
|
|
|
Keys.onReturnPressed: {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TextField {
|
|
|
|
id: userNameTf
|
|
|
|
width: parent.width
|
|
|
|
placeholderText: "username"
|
2018-08-03 15:18:23 +02:00
|
|
|
onTextChanged: {
|
|
|
|
parent.newProfileName = text
|
|
|
|
}
|
2018-08-11 23:54:34 +02:00
|
|
|
Keys.onReturnPressed: {
|
|
|
|
}
|
2018-08-03 15:18:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-03 22:54:32 +02:00
|
|
|
// --- Result View ---
|
|
|
|
Component {
|
|
|
|
id: resultViewComp
|
|
|
|
RemoteDataListView {
|
|
|
|
id: resultView
|
|
|
|
|
|
|
|
property string userName
|
|
|
|
property string title: userName
|
|
|
|
property string secondButt: "none"
|
|
|
|
|
|
|
|
signal opened()
|
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
|
2019-05-03 22:54:32 +02:00
|
|
|
onOpened: {
|
|
|
|
loadData()
|
|
|
|
}
|
|
|
|
|
|
|
|
loadData: function () {
|
|
|
|
status = 905
|
|
|
|
listData = {}
|
|
|
|
listData = speedBackend.getResults(userName)
|
|
|
|
status = listData.lenght !== false ? 200:0
|
|
|
|
}
|
2018-08-03 15:18:23 +02:00
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
delegate: SmoothItemDelegate {
|
2019-05-03 22:54:32 +02:00
|
|
|
id: resultDel
|
|
|
|
|
|
|
|
width: parent.width
|
2019-05-21 18:40:45 +02:00
|
|
|
height: resultView.height / 4
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
backgroundRect.radius: 0
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
function getDateText(){
|
|
|
|
var date = new Date(listData[index]["timestamp"]*1000).toLocaleString(Qt.locale(), "dddd, dd.MMM HH:mm")
|
|
|
|
return date
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
color: "grey"
|
|
|
|
height: 1
|
|
|
|
width: parent.width * 0.9
|
|
|
|
visible: index > 0
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
top: parent.top
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
Column {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: parent.width * 0.05
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
Label {
|
|
|
|
id: dateLa
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
height: parent.height / parent.children.length
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
font.pixelSize: height * 0.8
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
|
|
|
|
color: appTheme.style.textColor
|
|
|
|
|
|
|
|
text: resultDel.getDateText()
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: resultLa
|
|
|
|
|
|
|
|
height: parent.height / parent.children.length
|
|
|
|
|
|
|
|
font.pixelSize: height * 0.8
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
|
|
|
|
color: appTheme.style.textColor
|
|
|
|
|
|
|
|
text: qsTr("result: ") + (listData[index]["result"] / 1000).toFixed(3) + " s"
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: reactionTimeLa
|
|
|
|
|
|
|
|
height: parent.height / parent.children.length
|
|
|
|
|
|
|
|
font.pixelSize: height * 0.8
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
|
|
|
|
color: appTheme.style.textColor
|
|
|
|
|
|
|
|
text: qsTr("reaction time: ") + listData[index]["reactionTime"].toFixed(0) + " ms"
|
2019-05-03 22:54:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-----Custom animations-----*/
|
2018-08-03 15:18:23 +02:00
|
|
|
pushEnter: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
property: "opacity"
|
|
|
|
from: 0
|
|
|
|
to: 1
|
2019-05-03 22:54:32 +02:00
|
|
|
duration: 300
|
2018-08-03 15:18:23 +02:00
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
property: "x"
|
|
|
|
from: width * 0.1
|
|
|
|
to: 0
|
|
|
|
duration: 300
|
|
|
|
}
|
2018-08-03 15:18:23 +02:00
|
|
|
}
|
|
|
|
pushExit: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
property: "opacity"
|
|
|
|
from: 1
|
|
|
|
to: 0
|
2019-05-03 22:54:32 +02:00
|
|
|
duration: 300
|
2018-08-03 15:18:23 +02:00
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
property: "x"
|
|
|
|
to: -width * 0.1
|
|
|
|
from: 0
|
|
|
|
duration: 300
|
|
|
|
}
|
2018-08-03 15:18:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
popExit: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
property: "opacity"
|
|
|
|
from: 1
|
|
|
|
to: 0
|
2019-05-03 22:54:32 +02:00
|
|
|
duration: 300
|
2018-08-03 15:18:23 +02:00
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
NumberAnimation {
|
|
|
|
property: "x"
|
|
|
|
to: width * 0.1
|
|
|
|
from: 0
|
|
|
|
duration: 300
|
|
|
|
}
|
2018-08-03 15:18:23 +02:00
|
|
|
}
|
|
|
|
popEnter: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
property: "opacity"
|
|
|
|
from: 0
|
|
|
|
to: 1
|
2019-05-03 22:54:32 +02:00
|
|
|
duration: 300
|
2018-08-03 15:18:23 +02:00
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
2019-05-03 22:54:32 +02:00
|
|
|
NumberAnimation {
|
|
|
|
property: "x"
|
|
|
|
from: -width * 0.1
|
|
|
|
to: 0
|
|
|
|
duration: 300
|
|
|
|
}
|
2018-08-02 12:50:55 +02:00
|
|
|
}
|
|
|
|
}
|
2019-04-30 23:44:04 +02:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: topContainerItm
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
height: parent.height * 0.15
|
|
|
|
width: backgroundRect.width
|
|
|
|
|
|
|
|
RectangularGlow {
|
|
|
|
id: headerUnderlineEffect
|
|
|
|
glowRadius: 7
|
|
|
|
spread: 0.02
|
|
|
|
color: "black"
|
|
|
|
opacity: 0.18
|
|
|
|
anchors.fill: headlineUnderline
|
|
|
|
scale: 1
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: headlineUnderline
|
|
|
|
height: 1
|
|
|
|
width: parent.width
|
|
|
|
color: "grey"
|
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Canvas {
|
|
|
|
|
|
|
|
id: headerBackground
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
property color color: appTheme.style.viewColor
|
|
|
|
|
|
|
|
onPaint: {
|
|
|
|
var ctx = getContext("2d");
|
|
|
|
|
2019-05-03 22:54:32 +02:00
|
|
|
var topMargin = backgroundRect.radius
|
|
|
|
|
|
|
|
|
2019-04-30 23:44:04 +02:00
|
|
|
ctx.beginPath();
|
|
|
|
ctx.fillStyle = headerBackground.color
|
2019-05-03 22:54:32 +02:00
|
|
|
ctx.moveTo(width, topMargin);
|
|
|
|
//
|
|
|
|
//ctx.lineTo(width, topMargin);
|
2019-04-30 23:44:04 +02:00
|
|
|
ctx.lineTo(width, height);
|
|
|
|
ctx.lineTo(0, height);
|
2019-05-03 22:54:32 +02:00
|
|
|
ctx.lineTo(0, topMargin)
|
|
|
|
|
|
|
|
ctx.arc(topMargin, topMargin, topMargin, 1 * Math.PI, 1.5*Math.PI, false);
|
|
|
|
ctx.lineTo(width-topMargin, 0)
|
|
|
|
ctx.arc(width-topMargin, topMargin, topMargin, 1.5*Math.PI, 0, false)
|
2019-04-30 23:44:04 +02:00
|
|
|
ctx.fill();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: head_text
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
centerIn: parent
|
|
|
|
}
|
|
|
|
|
|
|
|
width: parent.width * 0.8
|
|
|
|
height: parent.height * 0.8
|
|
|
|
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
font.pixelSize: headlineUnderline.width * 0.1
|
|
|
|
minimumPixelSize: 0
|
|
|
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
2019-05-21 18:40:45 +02:00
|
|
|
color: appTheme.style.textColor
|
|
|
|
|
2019-04-30 23:44:04 +02:00
|
|
|
text: profiles_stack.currentItem.title
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
FancyButton {
|
|
|
|
id: head_back
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
2019-05-21 19:07:54 +02:00
|
|
|
leftMargin: -height * 0.3
|
2019-04-30 23:44:04 +02:00
|
|
|
top:parent.top
|
2019-05-21 19:07:54 +02:00
|
|
|
topMargin: anchors.leftMargin
|
2019-04-30 23:44:04 +02:00
|
|
|
}
|
|
|
|
|
2019-05-21 19:07:54 +02:00
|
|
|
height: topContainerItm.height * 0.8
|
2019-04-30 23:44:04 +02:00
|
|
|
width: height
|
|
|
|
|
|
|
|
glowOpacity: Math.pow( root.opacity, 100 )
|
|
|
|
|
|
|
|
backgroundColor: appTheme.style.buttonColor
|
|
|
|
|
2019-05-21 19:07:54 +02:00
|
|
|
image: appTheme.style.backIcon
|
2019-04-30 23:44:04 +02:00
|
|
|
|
|
|
|
onClicked: profiles_stack.depth > 1 ? profiles_stack.pop():root.close()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
FancyButton {
|
|
|
|
id: head_add
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
right: parent.right
|
2019-05-21 19:07:54 +02:00
|
|
|
rightMargin: -height * 0.3
|
2019-04-30 23:44:04 +02:00
|
|
|
top:parent.top
|
2019-05-21 19:07:54 +02:00
|
|
|
topMargin: anchors.rightMargin
|
2019-04-30 23:44:04 +02:00
|
|
|
}
|
2019-05-21 19:07:54 +02:00
|
|
|
|
|
|
|
height: topContainerItm.height * 0.8
|
2019-04-30 23:44:04 +02:00
|
|
|
width:height
|
|
|
|
|
2019-05-21 19:07:54 +02:00
|
|
|
opacity: root.opacity < 1 ? root.opacity : profiles_stack.currentItem.secondButt !== "none" ? 1:root.opacity
|
2019-05-03 22:54:32 +02:00
|
|
|
|
2019-05-21 19:07:54 +02:00
|
|
|
glowOpacity: root.opacity < 1 ? Math.pow( root.opacity, 100 ) : Math.pow( root.opacity, 100 )
|
2019-04-30 23:44:04 +02:00
|
|
|
|
|
|
|
backgroundColor: appTheme.style.buttonColor
|
|
|
|
|
|
|
|
image: "qrc:/graphics/icons/ok_black.png"
|
|
|
|
imageScale: profiles_stack.currentItem.secondButt === "ok" ? 1:0
|
|
|
|
|
|
|
|
Label {
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
topMargin: parent.height/2 - height*0.55
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: parent.width/2 - width/2
|
|
|
|
}
|
|
|
|
opacity: profiles_stack.currentItem.secondButt === "add" ? 1:0
|
2019-05-21 18:40:45 +02:00
|
|
|
|
|
|
|
color: appTheme.style.textColor
|
|
|
|
|
2019-04-30 23:44:04 +02:00
|
|
|
text: "+"
|
2019-05-21 19:07:54 +02:00
|
|
|
font.pixelSize: parent.height * 0.8
|
2019-04-30 23:44:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
switch(profiles_stack.currentItem.secondButt){
|
|
|
|
case "add":
|
|
|
|
profiles_stack.push(addProfileComp)
|
|
|
|
break
|
|
|
|
case "ok":
|
2019-05-02 22:39:22 +02:00
|
|
|
//speedBackend.createAthlete(fullNameTf.text, userNameTf.text)
|
2019-04-30 23:44:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Behavior on opacity {
|
2019-05-21 19:07:54 +02:00
|
|
|
enabled: root.opacity === 1
|
2019-04-30 23:44:04 +02:00
|
|
|
NumberAnimation {
|
2019-05-21 19:07:54 +02:00
|
|
|
duration: 200
|
2019-04-30 23:44:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-02 12:50:55 +02:00
|
|
|
}
|