2018-11-24 13:50:06 +01:00
|
|
|
import QtQuick 2.11
|
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import "./"
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
signal pageOpened()
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: column
|
2018-11-27 19:32:17 +01:00
|
|
|
//spacing: height / 40
|
2018-11-24 13:50:06 +01:00
|
|
|
width: parent.width
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.topMargin: parent.height * 0.02
|
|
|
|
anchors.bottomMargin: parent.height * 0.02
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: heading
|
|
|
|
font.pixelSize: parent.width * 0.075
|
2018-12-15 19:44:11 +01:00
|
|
|
text: "Calender"
|
2018-11-24 13:50:06 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: parent.width * 0.5 - width * 0.5
|
|
|
|
Layout.rightMargin: parent.width * 0.5 - width * 0.5
|
|
|
|
}
|
|
|
|
|
2018-11-27 19:32:17 +01:00
|
|
|
Label {
|
|
|
|
id: tickIntervalInfo
|
|
|
|
text: "Interval:"
|
|
|
|
font.pixelSize: parent.height * 0.05
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
}
|
|
|
|
|
2018-11-24 13:50:06 +01:00
|
|
|
|
|
|
|
TextField {
|
|
|
|
id: tickInterval
|
2018-12-15 19:44:11 +01:00
|
|
|
text: calender.tickInterval
|
2018-11-24 13:50:06 +01:00
|
|
|
placeholderText: "interval"
|
2018-12-15 19:44:11 +01:00
|
|
|
validator: IntValidator {bottom: 1; top: 1000000;}
|
2018-11-24 13:50:06 +01:00
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
Layout.rightMargin: parent.width * 0.05
|
2018-11-26 19:33:59 +01:00
|
|
|
Keys.onReturnPressed: root.start()
|
2018-11-24 13:50:06 +01:00
|
|
|
}
|
|
|
|
|
2018-11-27 19:32:17 +01:00
|
|
|
Label {
|
2018-12-15 19:44:11 +01:00
|
|
|
id: dateCountInfo
|
|
|
|
text: "Dates:"
|
2018-11-27 19:32:17 +01:00
|
|
|
font.pixelSize: parent.height * 0.05
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
}
|
|
|
|
|
2018-11-24 13:50:06 +01:00
|
|
|
TextField {
|
2018-12-15 19:44:11 +01:00
|
|
|
id: dateCount
|
|
|
|
text: calender.dateCount
|
|
|
|
placeholderText: "dates"
|
2018-11-26 19:33:59 +01:00
|
|
|
validator: IntValidator {bottom: 1; top: 100000;}
|
2018-11-24 13:50:06 +01:00
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
Layout.rightMargin: parent.width * 0.05
|
2018-11-26 19:33:59 +01:00
|
|
|
Keys.onReturnPressed: root.start()
|
2018-11-24 13:50:06 +01:00
|
|
|
}
|
|
|
|
|
2018-11-27 19:32:17 +01:00
|
|
|
Label {
|
|
|
|
id: minInfo
|
|
|
|
text: "Minimum:"
|
|
|
|
font.pixelSize: parent.height * 0.05
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
}
|
|
|
|
|
2018-11-24 13:50:06 +01:00
|
|
|
TextField {
|
|
|
|
id: min
|
2018-12-15 19:44:11 +01:00
|
|
|
text: calender.min
|
2018-11-27 19:32:17 +01:00
|
|
|
placeholderText: "minimum"
|
2018-12-15 19:44:11 +01:00
|
|
|
validator: IntValidator {bottom: 1800; top: 10000;}
|
2018-11-24 13:50:06 +01:00
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
Layout.rightMargin: parent.width * 0.05
|
2018-11-26 19:33:59 +01:00
|
|
|
Keys.onReturnPressed: root.start()
|
2018-11-24 13:50:06 +01:00
|
|
|
}
|
|
|
|
|
2018-11-27 19:32:17 +01:00
|
|
|
Label {
|
|
|
|
id: maxInfo
|
|
|
|
text: "Maximum:"
|
|
|
|
font.pixelSize: parent.height * 0.05
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
}
|
|
|
|
|
2018-11-24 13:50:06 +01:00
|
|
|
TextField {
|
|
|
|
id: max
|
2018-12-15 19:44:11 +01:00
|
|
|
text: calender.max
|
2018-11-27 19:32:17 +01:00
|
|
|
placeholderText: "maximum"
|
2018-12-15 19:44:11 +01:00
|
|
|
validator: IntValidator {bottom: 1800; top: 10000;}
|
2018-11-24 13:50:06 +01:00
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
Layout.rightMargin: parent.width * 0.05
|
2018-11-26 19:33:59 +01:00
|
|
|
Keys.onReturnPressed: root.start()
|
2018-11-24 13:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
RoundButton {
|
|
|
|
id: startButton
|
|
|
|
text: "start"
|
|
|
|
height: parent.width * 0.1
|
|
|
|
width: height
|
|
|
|
//font.pixelSize: parent.width * 0.03
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: parent.width * 0.05
|
|
|
|
Layout.rightMargin: parent.width * 0.05
|
|
|
|
onClicked: {
|
2018-11-26 19:33:59 +01:00
|
|
|
root.start()
|
2018-11-24 13:50:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-11-26 19:33:59 +01:00
|
|
|
function start() {
|
2018-12-15 19:44:11 +01:00
|
|
|
if (tickInterval.text > 0 && dateCount.text > 0 && min.text >= 1800 && max.text >= min.text) {
|
|
|
|
root.updateVars()
|
|
|
|
calender.run()
|
|
|
|
}
|
2018-11-26 19:33:59 +01:00
|
|
|
}
|
|
|
|
|
2018-11-24 13:50:06 +01:00
|
|
|
function updateVars() {
|
2018-12-15 19:44:11 +01:00
|
|
|
calender.tickInterval = tickInterval.text
|
|
|
|
calender.dateCount = dateCount.text
|
|
|
|
calender.min = min.text
|
|
|
|
calender.max = max.text
|
2018-11-24 13:50:06 +01:00
|
|
|
}
|
|
|
|
}
|