import QtQuick 2.3
import QtQml.Models 2.1
import QtQuick.Layouts 1.1
import QtQml 2.2
import "../../commons/"
Core {
id: container
width: 300
height: 360
property int vqml_output_logic_fan: 0
property int vqml_output_logic_heating: 1
property int vqml_output_logic_cooling: 0
property int vqml_input_logic_t_outside: -125
property int vqml_input_logic_t_inside: 185
property int vqml_input_logic_di_window: 0
property int vqml_counter_inside_demand_t: 210
property int vqml_counter_winter_seazon_mode: 0
property int vqml_counter_current_date_time_hour: 10
property int vqml_counter_current_date_time_min: 15
property int vqml_counter_current_date_time_day: 2
property int vqml_counter_current_date_time_month: 3
property int vqml_counter_current_date_time_year: 14
property int vqml_counter_current_day_of_week: 0
property date system_date: new Date()
/*
* Typy parametrów - opisane w Core.qml
*
*/
ListModel {
id: parametersModel
ListElement { param_group: "Wyjścia"; param_name: "Wentylator"; param_type: 1; param_p_0: "0;1"; param_p_1: "WYŁ;WŁ"; param_p_2: ""; param_value: 0 } // 0
ListElement { param_group: "Wyjścia"; param_name: "Grzanie"; param_type: 1; param_p_0: "0;1"; param_p_1: "WYŁ;WŁ"; param_p_2: ""; param_value: 0 } // 1
ListElement { param_group: "Wyjścia"; param_name: "Chłodzenie"; param_type: 1; param_p_0: "0;1"; param_p_1: "WYŁ;WŁ"; param_p_2: ""; param_value: 0 } // 2
ListElement { param_group: "Temperatury"; param_name: "Zewnętrzna"; param_type: 2; param_p_0: "10"; param_p_1: "°C"; param_p_2: "1"; param_value: 0 } // 3
ListElement { param_group: "Temperatury"; param_name: "Wewnętrzna"; param_type: 2; param_p_0: "10"; param_p_1: "°C"; param_p_2: "1"; param_value: 0 } // 4
ListElement { param_group: "Temperatury"; param_name: "Aktualnie Wymagana"; param_type: 2; param_p_0: "10"; param_p_1: "°C"; param_p_2: "1"; param_value: 0 } // 5
ListElement { param_group: "Okna"; param_name: "Zbiorczy czujnik"; param_type: 1; param_p_0: "0;1"; param_p_1: "Zamkniete;Otwarte"; param_p_2: ""; param_value: 0 } // 6
ListElement { param_group: "System"; param_name: "Sezon"; param_type: 1; param_p_0: "0;1"; param_p_1: "Lato;Zima"; param_p_2: ""; param_value: 0 } // 7
ListElement { param_group: "System"; param_name: "Godzina"; param_type: 3; param_p_0: ""; param_p_1: ""; param_p_2: ""; param_value: 0 } // 8
ListElement { param_group: "System"; param_name: "Data"; param_type: 4; param_p_0: ""; param_p_1: ""; param_p_2: ""; param_value: 0 } // 9
ListElement { param_group: "System"; param_name: "Dzień tygodnia"; param_type: 5; param_p_0: ""; param_p_1: ""; param_p_2: ""; param_value: 0 } // 10
}
function update() {
parametersModel.setProperty(0, "param_value", vqml_output_logic_fan)
parametersModel.setProperty(1, "param_value", vqml_output_logic_heating)
parametersModel.setProperty(2, "param_value", vqml_output_logic_cooling)
parametersModel.setProperty(3, "param_value", vqml_input_logic_t_outside)
parametersModel.setProperty(4, "param_value", vqml_input_logic_t_inside)
parametersModel.setProperty(5, "param_value", vqml_counter_inside_demand_t)
parametersModel.setProperty(6, "param_value", vqml_input_logic_di_window)
parametersModel.setProperty(7, "param_value", vqml_counter_winter_seazon_mode)
// godzina (czas)
parametersModel.setProperty(8, "param_value", vqml_counter_current_date_time_hour)
parametersModel.setProperty(8, "param_p_0", vqml_counter_current_date_time_min.toString())
// data
parametersModel.setProperty(9, "param_value", vqml_counter_current_date_time_year)
parametersModel.setProperty(9, "param_p_0", vqml_counter_current_date_time_month.toString())
parametersModel.setProperty(9, "param_p_1", vqml_counter_current_date_time_day.toString())
parametersModel.setProperty(10, "param_value", vqml_counter_current_day_of_week)
}
Timer {
id: timer
interval: 500; repeat: true
running: true
triggeredOnStart: true
onTriggered: update()
}
// The delegate for each section header
Component {
id: sectionHeading
Rectangle {
width: container.width
height: childrenRect.height
color: "lightsteelblue"
Text {
text: section
font.bold: true
font.pixelSize: 20
}
}
}
// The delegate for each item
Component {
id: parametersDelegate
RowLayout {
width: container.width
spacing: 10
Item {
Layout.fillWidth: true
Layout.minimumWidth: 150
Layout.preferredWidth: 100
Layout.minimumHeight: 20
// Rectangle {
// color: 'lightblue'
// anchors.fill: parent
// }
Text {
text: param_name
font.pixelSize: 18
Layout.fillWidth: true
}
}
Item {
Layout.fillWidth: true
Layout.minimumWidth: 110
Layout.preferredWidth: 110
Layout.maximumWidth: 110
Layout.preferredHeight: 20
Layout.alignment: Qt.AlignRight
// Rectangle {
// color: "plum"
// anchors.fill: parent
// }
Text {
text: funct_getValue(param_type, param_value, param_p_0, param_p_1, param_p_2, 1)
font.pixelSize: 18
horizontalAlignment: Text.AlignRight
textFormat: Text.RichText
}
}
}
}
ListView {
spacing: 1
anchors.fill: parent
model: parametersModel
delegate: parametersDelegate
section.property: "param_group"
section.criteria: ViewSection.FullString
section.delegate: sectionHeading
}
// Item {
// anchors.bottom: parent.bottom
// width: parent.width
// height: 50
// Rectangle {
// anchors.fill: parent
// color: "lightblue"
// }
// Text {
// anchors.centerIn: parent
// text: "button"
// }
// MouseArea {
// id: mouseArea1
// anchors.fill: parent
// onClicked: ++vqml_counter_current_day_of_week
// }
// }
}