2018-06-21 08:47:09 +02:00
|
|
|
import QtQuick 2.9
|
2018-12-23 21:07:10 +01:00
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtGraphicalEffects 1.0
|
2018-06-21 08:47:09 +02:00
|
|
|
|
2018-12-21 12:23:12 +01:00
|
|
|
import "../Components"
|
|
|
|
import "../Forms"
|
2018-07-19 20:08:46 +02:00
|
|
|
|
2018-06-21 08:47:09 +02:00
|
|
|
Page {
|
|
|
|
id: root
|
2018-06-25 08:07:05 +02:00
|
|
|
objectName: "MainPage"
|
2018-06-25 10:04:11 +02:00
|
|
|
|
2018-06-30 11:05:39 +02:00
|
|
|
Shortcut {
|
|
|
|
sequences: ["Esc", "Back"]
|
2018-12-23 21:07:10 +01:00
|
|
|
enabled: formStack.depth > 1
|
2018-06-30 11:05:39 +02:00
|
|
|
onActivated: {
|
2018-12-23 21:07:10 +01:00
|
|
|
formStack.pop()
|
2018-06-30 11:05:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-23 21:07:10 +01:00
|
|
|
StackView {
|
|
|
|
id: formStack
|
|
|
|
property var currPage
|
|
|
|
property string eventDay: ""
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: toolBar.bottom
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
onCurrPageChanged: {
|
|
|
|
mainStack.replace(currPage)
|
|
|
|
}
|
|
|
|
|
|
|
|
onCurrentItemChanged: {
|
|
|
|
formStack.currentItem.opened()
|
|
|
|
}
|
|
|
|
|
|
|
|
initialItem: homeForm
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: homeForm
|
|
|
|
HomeForm {}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: foodPlanForm
|
|
|
|
FoodPlanForm {}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: eventForm
|
|
|
|
EventForm {
|
|
|
|
day: formStack.eventDay
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-25 00:15:25 +01:00
|
|
|
Component {
|
|
|
|
id: settingsForm
|
|
|
|
SettingsForm {}
|
|
|
|
}
|
|
|
|
|
2018-12-25 15:16:24 +01:00
|
|
|
Component {
|
|
|
|
id: filterForm
|
|
|
|
FilterForm {}
|
|
|
|
}
|
|
|
|
|
2018-12-23 21:07:10 +01:00
|
|
|
popEnter: Transition {
|
|
|
|
XAnimator {
|
|
|
|
from: (formStack.mirrored ? -1 : 1) * -formStack.width
|
|
|
|
to: 0
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
popExit: Transition {
|
|
|
|
XAnimator {
|
|
|
|
from: 0
|
|
|
|
to: (formStack.mirrored ? -1 : 1) * formStack.width
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
2018-06-21 08:47:09 +02:00
|
|
|
|
2018-12-23 21:07:10 +01:00
|
|
|
pushEnter: Transition {
|
|
|
|
XAnimator {
|
|
|
|
from: (formStack.mirrored ? -1 : 1) * formStack.width
|
|
|
|
to: 0
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pushExit: Transition {
|
|
|
|
XAnimator {
|
|
|
|
from: 0
|
|
|
|
to: (formStack.mirrored ? -1 : 1) * -formStack.width
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AppToolBar {
|
|
|
|
id: toolBar
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
topMargin: -60
|
|
|
|
}
|
|
|
|
|
|
|
|
height: 50
|
2018-07-19 20:08:46 +02:00
|
|
|
|
|
|
|
Button {
|
|
|
|
id:toolButton
|
2018-12-23 21:07:10 +01:00
|
|
|
enabled: true
|
2018-06-25 10:04:11 +02:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
verticalCenter: parent.verticalCenter
|
2018-07-19 20:08:46 +02:00
|
|
|
leftMargin: parent.width *0.02
|
2018-06-25 10:04:11 +02:00
|
|
|
}
|
2018-07-19 20:08:46 +02:00
|
|
|
height: parent.height - parent.height * 0.5
|
|
|
|
width: height
|
2018-06-21 16:41:02 +02:00
|
|
|
|
2018-06-21 08:47:09 +02:00
|
|
|
onClicked: {
|
2018-12-23 21:07:10 +01:00
|
|
|
if (formStack.depth > 1) {
|
|
|
|
formStack.pop()
|
2018-06-21 08:47:09 +02:00
|
|
|
} else {
|
|
|
|
drawer.open()
|
|
|
|
}
|
|
|
|
}
|
2018-07-19 20:08:46 +02:00
|
|
|
|
|
|
|
onPressed: toolButton.scale = 0.9
|
|
|
|
onReleased: toolButton.scale = 1.0
|
|
|
|
|
|
|
|
background: Image {
|
2018-12-23 21:07:10 +01:00
|
|
|
source: formStack.depth > 1 ? "qrc:/graphics/icons/backDark.png" : "qrc:/graphics/icons/drawer.png"
|
2018-07-19 20:08:46 +02:00
|
|
|
height: parent.height
|
|
|
|
width: parent.width
|
|
|
|
Behavior on scale {
|
|
|
|
PropertyAnimation {
|
|
|
|
duration: 100
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
2018-12-25 15:16:24 +01:00
|
|
|
text: getText()
|
2018-07-19 17:19:09 +02:00
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: toolButton.right
|
2018-07-19 20:08:46 +02:00
|
|
|
leftMargin: parent.width * 0.02
|
2018-07-19 17:19:09 +02:00
|
|
|
}
|
2018-07-19 20:08:46 +02:00
|
|
|
font.bold: true
|
2018-12-23 21:07:10 +01:00
|
|
|
color: "black"
|
2018-12-25 15:16:24 +01:00
|
|
|
|
|
|
|
function getText(){
|
|
|
|
var titleString = "";
|
|
|
|
for(var i=1; i<formStack.depth; i++){
|
|
|
|
if(i > 1){
|
|
|
|
titleString += " > "
|
|
|
|
}
|
|
|
|
|
|
|
|
titleString += formStack.get(i).title
|
|
|
|
}
|
|
|
|
return(titleString)
|
|
|
|
}
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|
2018-07-19 17:19:09 +02:00
|
|
|
|
2018-12-23 21:07:10 +01:00
|
|
|
Behavior on anchors.topMargin {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutCubic
|
2018-07-19 17:19:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-23 21:07:10 +01:00
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "closed"
|
|
|
|
when: formStack.depth === 1
|
|
|
|
PropertyChanges {
|
|
|
|
target: toolBar
|
|
|
|
anchors.topMargin: -60
|
2018-07-19 20:08:46 +02:00
|
|
|
}
|
2018-12-23 21:07:10 +01:00
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "open"
|
|
|
|
when: formStack.depth > 1
|
|
|
|
PropertyChanges {
|
|
|
|
target: toolBar
|
|
|
|
anchors.topMargin: 0
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|
|
|
|
}
|
2018-12-23 21:07:10 +01:00
|
|
|
]
|
2018-06-25 00:15:18 +02:00
|
|
|
}
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|