2018-10-14 18:39:09 +02:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id:root
|
|
|
|
//anchors.fill: parent
|
|
|
|
property bool cookplanChanged
|
|
|
|
title: qsTr("Vertretungsplan")
|
|
|
|
property string icon: "qrc:/graphics/FannyLogo_small.png"
|
|
|
|
property string link: "http://www.fanny-leicht.de/j34"
|
|
|
|
|
|
|
|
// Image{
|
|
|
|
// source: "qrc:/graphics/chat_background.jpg";
|
|
|
|
// height: parent.height
|
|
|
|
// width: parent.width
|
|
|
|
// fillMode: Image.Tile
|
|
|
|
// horizontalAlignment: Image.AlignLeft
|
|
|
|
// verticalAlignment: Image.AlignTop
|
|
|
|
// }
|
|
|
|
// LinearGradient {
|
|
|
|
// anchors.fill: parent
|
|
|
|
// start: Qt.point(0, 0)
|
|
|
|
// end: Qt.point(0, parent.height)
|
|
|
|
// gradient: Gradient {
|
|
|
|
// GradientStop { position: 0.0; color: "#4db2b3" }
|
|
|
|
// GradientStop { position: 1.0; color: "#8f4dae" }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
id: firstLoadTimer
|
|
|
|
interval: 1;
|
|
|
|
running: true
|
|
|
|
repeat: false
|
|
|
|
|
|
|
|
onTriggered: {
|
|
|
|
_cppServerConn.getFoodPlan()
|
|
|
|
cookplanChanged = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
id:scroll
|
|
|
|
anchors.fill: parent
|
|
|
|
ListView {
|
|
|
|
id: listView
|
|
|
|
//width: 514
|
|
|
|
model: _cppServerConn.getEventCount()
|
|
|
|
spacing: 0
|
|
|
|
property var today: new Date
|
|
|
|
anchors {
|
|
|
|
right: parent.right
|
|
|
|
left: parent.left
|
|
|
|
top: parent.top
|
|
|
|
bottom: parent.bottom
|
|
|
|
leftMargin: 5
|
|
|
|
rightMargin: 5
|
|
|
|
topMargin: 3
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: Button {
|
|
|
|
|
|
|
|
width: listView.width
|
|
|
|
id: delegate
|
2018-10-21 17:25:35 +02:00
|
|
|
height: visible ? cookteam.height + date.height + text.height + spacer.height + cust_spacing*9 + 5:0
|
2018-10-14 18:39:09 +02:00
|
|
|
visible: listView.isDayVisible(index)
|
|
|
|
|
|
|
|
property int cust_spacing: 5
|
|
|
|
|
|
|
|
Label {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 10
|
|
|
|
font.bold: true
|
2018-10-21 17:25:35 +02:00
|
|
|
font.pixelSize: date.font.pixelSize * 1.5
|
2018-10-14 18:39:09 +02:00
|
|
|
id: cookteam
|
|
|
|
text: _cppServerConn.getEventData(index).grade
|
|
|
|
width: parent.width - 10
|
|
|
|
wrapMode: Label.Wrap
|
2018-10-21 17:25:35 +02:00
|
|
|
height: text!==""? undefined:0
|
2018-10-14 18:39:09 +02:00
|
|
|
}
|
|
|
|
Label {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
anchors.top: cookteam.bottom
|
|
|
|
id: date
|
2018-10-21 17:25:35 +02:00
|
|
|
text: _cppServerConn.getEventData(index).hour + " | "
|
|
|
|
+ _cppServerConn.getEventData(index).replace + " | "
|
|
|
|
+ _cppServerConn.getEventData(index).subject + " | "
|
|
|
|
+ _cppServerConn.getEventData(index).room + " | "
|
2018-10-14 18:39:09 +02:00
|
|
|
|
|
|
|
width: parent.width - 10
|
|
|
|
wrapMode: Label.Wrap
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 10
|
2018-10-21 17:25:35 +02:00
|
|
|
anchors.top: date.bottom
|
2018-10-14 18:39:09 +02:00
|
|
|
anchors.topMargin: cust_spacing
|
2018-10-21 17:25:35 +02:00
|
|
|
font.pixelSize: date.font.pixelSize * 2
|
|
|
|
font.bold: true
|
|
|
|
id: text
|
|
|
|
text: _cppServerConn.getEventData(index).to + " " + _cppServerConn.getEventData(index).text
|
2018-10-14 18:39:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 10
|
2018-10-21 17:25:35 +02:00
|
|
|
anchors.top: test.bottom
|
2018-10-14 18:39:09 +02:00
|
|
|
anchors.topMargin: cust_spacing
|
|
|
|
id: spacer
|
|
|
|
text: ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getDateString(index){
|
|
|
|
var date = _cppServerConn.getEventData(index).date
|
|
|
|
console.log(date.getTime())
|
|
|
|
console.log(today.getTime())
|
|
|
|
if(date.getDate() === today.getDate()){
|
|
|
|
return("Heute")
|
|
|
|
}
|
|
|
|
else if(date.getTime() < (today.getTime() + (24 * 60 * 60 * 1000) )/*date.getDate() === today.getDate() + 1 || (date.getDate() === 1 && date.getMonth() === today.getMonth() + 1)*/){
|
|
|
|
return("Morgen")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return(Qt.formatDateTime(_cppServerConn.getEventData(index).date, "dddd, d.M.yy"))
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
function isDayVisible(index){
|
|
|
|
return(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|