This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/ScStwSrc/resources/qml/ProfilesDialog/ProfilesStack.qml

176 lines
4.3 KiB
QML

/*
Speed Climbing Stopwatch - Simple Stopwatch for Climbers
Copyright (C) 2018 - 2019 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/>.
*/
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import com.itsblue.speedclimbingstopwatch 1.0
import "../components"
StackView {
id: profilesStack
property int text_pixelSize: width * 0.08
//initialItem: profileListComp
onCurrentItemChanged: {
currentItem.opened()
}
function init() {
if(profilesStack.depth === 0){
profilesStack.openAthletes()
}
else {
profilesStack.currentItem.opened()
}
}
function openAthletes() {
var athsComp = profileListComp.createObject(null, {})
profilesStack.push(athsComp)
}
function openResults( userName ){
var resComp = resultViewComp.createObject(null, {"userName": userName})
profilesStack.push(resComp)
}
function createAthlete() {
var createAthleteComp = addProfileComp.createObject(null, {})
profilesStack.push(createAthleteComp)
}
/*-----List of all profiles-----*/
Component {
id: profileListComp
ProfileListPage {}
}
/*-----Option to add a profile-----*/
Component {
id: addProfileComp
AddProfilePage {}
}
// --- Result View ---
Component {
id: resultViewComp
ResultListPage {}
}
/*-----Custom animations-----*/
property int animationDuration: 200
pushEnter: Transition {
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: profilesStack.animationDuration
easing.type: Easing.InOutQuad
}
/*NumberAnimation {
property: "x"
from: width * 0.1
to: 0
duration: 300
}*/
NumberAnimation {
property: "scale"
from: 1.1
to: 1
duration: profilesStack.animationDuration
}
}
pushExit: Transition {
NumberAnimation {
property: "opacity"
from: 1
to: 0
duration: profilesStack.animationDuration
easing.type: Easing.InOutQuad
}
/*NumberAnimation {
property: "x"
to: -width * 0.1
from: 0
duration: 300
}*/
NumberAnimation {
property: "scale"
from: 1
to: 0.9
duration: profilesStack.animationDuration
}
}
popExit: Transition {
NumberAnimation {
property: "opacity"
from: 1
to: 0
duration: profilesStack.animationDuration
easing.type: Easing.InOutQuad
}
/*NumberAnimation {
property: "x"
to: width * 0.1
from: 0
duration: 300
}*/
NumberAnimation {
property: "scale"
from: 1
to: 1.1
duration: profilesStack.animationDuration
}
}
popEnter: Transition {
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: profilesStack.animationDuration
easing.type: Easing.InOutQuad
}
/*NumberAnimation {
property: "x"
from: -width * 0.1
to: 0
duration: 300
}*/
NumberAnimation {
property: "scale"
from: 0.9
to: 1
duration: profilesStack.animationDuration
}
}
}