2018-06-21 08:47:09 +02:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: root
|
2018-06-25 08:07:05 +02:00
|
|
|
objectName: "MainPage"
|
2018-06-21 08:47:09 +02:00
|
|
|
anchors.fill: parent
|
2018-06-25 10:04:11 +02:00
|
|
|
|
2018-06-30 11:05:39 +02:00
|
|
|
Shortcut {
|
|
|
|
sequences: ["Esc", "Back"]
|
|
|
|
enabled: stackView.depth > 1
|
|
|
|
onActivated: {
|
|
|
|
stackView.pop()
|
|
|
|
listView.currentIndex = -1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-21 16:41:02 +02:00
|
|
|
header: AppToolBar {
|
2018-06-21 08:47:09 +02:00
|
|
|
contentHeight: toolButton.implicitHeight
|
|
|
|
|
|
|
|
ToolButton {
|
|
|
|
id: toolButton
|
2018-06-25 10:04:11 +02:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
leftMargin: 5
|
|
|
|
}
|
|
|
|
|
|
|
|
background: Label {
|
|
|
|
text: stackView.depth > 1 ? "\u25C0" : "\u4E09"
|
|
|
|
font.pixelSize: Qt.application.font.pixelSize * 2
|
|
|
|
color: "white"
|
|
|
|
}
|
2018-06-21 16:41:02 +02:00
|
|
|
|
2018-06-21 08:47:09 +02:00
|
|
|
onClicked: {
|
|
|
|
if (stackView.depth > 1) {
|
|
|
|
stackView.pop()
|
|
|
|
} else {
|
|
|
|
drawer.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
text: stackView.currentItem.title
|
|
|
|
anchors.centerIn: parent
|
2018-06-25 10:04:11 +02:00
|
|
|
color: "white"
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Drawer {
|
|
|
|
id: drawer
|
|
|
|
width: window.width * 0.66
|
|
|
|
height: window.height
|
|
|
|
|
|
|
|
Column {
|
|
|
|
anchors.fill: parent
|
|
|
|
ItemDelegate {
|
2018-06-21 16:41:02 +02:00
|
|
|
text: qsTr("Fanny Webseite")
|
2018-06-21 08:47:09 +02:00
|
|
|
width: parent.width
|
|
|
|
onClicked: {
|
2018-06-21 16:41:02 +02:00
|
|
|
stackView.push("WebsitePage.qml")
|
2018-06-21 08:47:09 +02:00
|
|
|
drawer.close()
|
|
|
|
}
|
|
|
|
}
|
2018-06-22 15:33:16 +02:00
|
|
|
|
|
|
|
ItemDelegate {
|
|
|
|
text: qsTr("Speiseplan")
|
|
|
|
width: parent.width
|
|
|
|
onClicked: {
|
2018-06-25 00:15:18 +02:00
|
|
|
busyDialog.open()
|
|
|
|
var ret = _cppServerConn.getFoodPlan();
|
2018-06-22 15:33:16 +02:00
|
|
|
drawer.close()
|
2018-06-25 00:15:18 +02:00
|
|
|
busyDialog.close()
|
|
|
|
if(ret === 200 || _cppServerConn.getFoodPlanData(1).cookteam !== ""){
|
|
|
|
stackView.push("FoodPlanForm.qml")
|
|
|
|
}
|
2018-06-22 15:33:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-21 08:47:09 +02:00
|
|
|
ItemDelegate {
|
2018-06-21 16:41:02 +02:00
|
|
|
text: qsTr("abmelden")
|
2018-06-21 08:47:09 +02:00
|
|
|
width: parent.width
|
|
|
|
onClicked: {
|
2018-06-21 16:41:02 +02:00
|
|
|
confirmationDialog.open()
|
|
|
|
}
|
|
|
|
Dialog {
|
|
|
|
id: confirmationDialog
|
|
|
|
|
|
|
|
x: (window.width - width) / 2
|
|
|
|
y: (window.height - height) / 2
|
|
|
|
parent: ApplicationWindow.overlay
|
|
|
|
|
|
|
|
|
|
|
|
modal: true
|
|
|
|
standardButtons: Dialog.Cancel | Dialog.Ok
|
|
|
|
Column {
|
|
|
|
spacing: 20
|
|
|
|
anchors.fill: parent
|
|
|
|
Label {
|
|
|
|
text: "Möchtest du dich wirklich abmelden?"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onAccepted: {
|
|
|
|
_cppServerConn.logout()
|
|
|
|
drawer.close()
|
|
|
|
root.StackView.view.push("LoginPage.qml")
|
|
|
|
}
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StackView {
|
|
|
|
id: stackView
|
|
|
|
initialItem: "HomeForm.qml"
|
|
|
|
anchors.fill: parent
|
|
|
|
}
|
2018-06-25 00:15:18 +02:00
|
|
|
|
|
|
|
Dialog {
|
|
|
|
id: busyDialog
|
|
|
|
modal: true
|
|
|
|
focus: true
|
|
|
|
//title: "Please wait..."
|
|
|
|
x: (window.width - width) / 2
|
|
|
|
y: window.height / 6
|
|
|
|
//width: Math.min(window.width, window.height) / 3 * 2
|
|
|
|
height: contentHeight * 1.5
|
|
|
|
width: contentWidth * 1.5
|
|
|
|
contentHeight: busyIndicator.height
|
|
|
|
contentWidth: busyIndicator.width
|
|
|
|
BusyIndicator {
|
|
|
|
id: busyIndicator
|
|
|
|
visible: true
|
|
|
|
anchors.centerIn: parent
|
|
|
|
Label {
|
|
|
|
id: progress
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: _cppServerConn.getProgress()
|
|
|
|
}
|
|
|
|
Timer {
|
|
|
|
id: refreshTimer
|
|
|
|
interval: 1;
|
|
|
|
running: busyDialog.visible
|
|
|
|
repeat: true
|
|
|
|
onTriggered: {
|
|
|
|
var ret = _cppServerConn.getProgress()
|
|
|
|
progress.text = Math.round( ret * 100 ) + "%"
|
|
|
|
progressBar.value = ret
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ProgressBar {
|
|
|
|
id: progressBar
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.topMargin: busyDialog.height / 1.5
|
|
|
|
}
|
|
|
|
}
|
2018-06-21 08:47:09 +02:00
|
|
|
}
|