Commit 3cff97bf authored by Michal Policht's avatar Michal Policht

Merge commit '5b7074ce' into 2

parents 9978180f 5b7074ce
Pipeline #15420 passed with stages
in 11 minutes and 58 seconds
......@@ -21,13 +21,15 @@ Project {
"BasicDiscreteInstrumentSettings.qml",
"BladeDamperSettings.qml",
"CentrifugalFanSettings.qml",
"ElementSettings.qml",
"ElementSettings.qml",
"HeatRecoveryWheelSettings.qml",
"LICENSE",
"Main.qml",
"MotorActuatorSettings.qml",
"PumpSettings.qml",
"README.md",
"TankSettings.qml",
"ValveSettings.qml",
]
Depends { name: "cutehmi.doxygen" }
......
......@@ -267,6 +267,42 @@ Rectangle {
pump: pump
}
Label {
Layout.alignment: Qt.AlignCenter
text: qsTr("Tank")
}
Tank {
id: tank
Layout.alignment: Qt.AlignCenter
}
TankSettings {
Layout.alignment: Qt.AlignTop
tank: tank
}
Label {
Layout.alignment: Qt.AlignCenter
text: qsTr("Valve")
}
Valve {
id: valve
Layout.alignment: Qt.AlignCenter
}
ValveSettings {
Layout.alignment: Qt.AlignTop
valve: valve
}
}
}
}
......
import QtQml 2.2
import QtQuick 2.11
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import CuteHMI.Symbols.HVAC 0.0
ElementSettings {
element: tank
property Tank tank
GroupBox {
title: qsTr("Custom properties")
Layout.fillWidth: true
GridLayout {
columns: 2
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Head ratio:")
}
Slider {
from: 0
to: 50
value: tank.headRatio * 100
onValueChanged: tank.headRatio = value / 100
}
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Level:")
}
Slider {
from: 0
to: 100
value: tank.level * 100
onValueChanged: tank.level = value / 100
}
}
}
}
//(c)C: Copyright © 2020, Michał Policht <michal@policht.pl>. All rights reserved.
//(c)C: This file is a part of CuteHMI.
//(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
//(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
//(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
import QtQml 2.2
import QtQuick 2.11
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import CuteHMI.Symbols.HVAC 0.0
ElementSettings {
element: valve
property Valve valve
GroupBox {
title: qsTr("Custom properties")
Layout.fillWidth: true
GridLayout {
columns: 2
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Left way:")
}
CheckBox {
checked: valve.leftWay
onCheckedChanged: valve.leftWay = checked
}
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Right way:")
}
CheckBox {
checked: valve.rightWay
onCheckedChanged: valve.rightWay = checked
}
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Top way:")
}
CheckBox {
checked: valve.topWay
onCheckedChanged: valve.topWay = checked
}
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Bottom way:")
}
CheckBox {
checked: valve.bottomWay
onCheckedChanged: valve.bottomWay = checked
}
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Left closed:")
}
CheckBox {
checked: valve.leftClosed
onCheckedChanged: valve.leftClosed = checked
}
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Right closed:")
}
CheckBox {
checked: valve.rightClosed
onCheckedChanged: valve.rightClosed = checked
}
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Top closed:")
}
CheckBox {
checked: valve.topClosed
onCheckedChanged: valve.topClosed = checked
}
Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Bottom closed:")
}
CheckBox {
checked: valve.bottomClosed
onCheckedChanged: valve.bottomClosed = checked
}
}
}
}
//(c)C: Copyright © 2020, Michał Policht <michal@policht.pl>. All rights reserved.
//(c)C: This file is a part of CuteHMI.
//(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
//(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
//(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
......@@ -23,6 +23,7 @@ Element {
property real fill: 0.0
property real dirtyWarning: 0.75
property real dirtyAlarm: 0.9
property Component frame: Component {
......
......@@ -32,6 +32,8 @@ Project {
"Pump.qml",
"README.md",
"SymbolCanvas.qml",
"Tank.qml",
"Valve.qml",
"designer/HVAC.metainfo",
]
......
import QtQuick 2.0
import CuteHMI.GUI 0.0
/**
Tank.
*/
Element {
id: root
implicitWidth: units.quadrat * 0.75
implicitHeight: units.quadrat * 1.5
active: true
property real headRatio: 0.25
property real level: 0.0
property Component shell: Component {
SymbolCanvas {
element: root
onPaint: {
var ctx = getContext('2d')
ctx.save()
ctx.reset()
ctx.strokeStyle = root.color.stroke
ctx.fillStyle = root.color.fill
ctx.lineWidth = units.strokeWidth
var offset = units.strokeWidth / 2.0
var headRadius = height * root.headRatio
var shellHeight = height - headRadius - units.strokeWidth
// Draw top ellipsoidal head.
ctx.ellipse(offset, offset, width - units.strokeWidth, headRadius)
ctx.fill()
ctx.stroke()
// Draw bottom ellipsoidal head.
ctx.ellipse(offset, offset + shellHeight, width - units.strokeWidth, headRadius)
ctx.fill()
ctx.stroke()
// Draw shell.
ctx.beginPath()
ctx.rect(offset, offset + headRadius * 0.5, width - units.strokeWidth, shellHeight)
ctx.fill()
ctx.stroke()
ctx.restore()
}
Connections {
target: root
onHeadRatioChanged: requestPaint()
}
}
}
property Component liquid: Component {
Item {
property real headRadius: height * root.headRatio
property real shellHeight: height - headRadius - units.strokeWidth
property real liquidY: (height - 2 * units.strokeWidth) * (1.0 - level)
// Liquid in heads.
SymbolCanvas {
id: headsLiquidCanvas
anchors.fill: parent
element: root
onPaint: {
var ctx = getContext('2d')
ctx.save()
ctx.reset()
ctx.strokeStyle = root.color.stroke
ctx.fillStyle = root.color.shade
ctx.lineWidth = units.strokeWidth
ctx.ellipse(units.strokeWidth, units.strokeWidth, width - 2 * units.strokeWidth, headRadius - units.strokeWidth)
ctx.ellipse(units.strokeWidth, units.strokeWidth + shellHeight, width - 2 * units.strokeWidth, headRadius - units.strokeWidth)
ctx.clip()
ctx.beginPath()
ctx.rect(0, liquidY + units.strokeWidth, width, height - liquidY - 2 * units.strokeWidth)
ctx.fill()
if (level != 0 && level != 1) {
ctx.beginPath()
ctx.moveTo(0, liquidY + units.strokeWidth)
ctx.lineTo(width, liquidY + units.strokeWidth)
ctx.stroke()
}
ctx.restore()
}
}
// Liquid in a shell.
SymbolCanvas {
id: shellLiquidCanvas
anchors.fill: parent
element: root
onPaint: {
var ctx = getContext('2d')
ctx.save()
ctx.reset()
ctx.strokeStyle = root.color.stroke
ctx.fillStyle = root.color.shade
ctx.lineWidth = units.strokeWidth
ctx.rect(units.strokeWidth, units.strokeWidth + headRadius * 0.5, width - 2 * units.strokeWidth, shellHeight)
ctx.clip()
ctx.beginPath()
ctx.rect(0, liquidY + units.strokeWidth, width, height - liquidY - 2 * units.strokeWidth)
ctx.fill()
if (level != 0 && level != 1) {
ctx.beginPath()
ctx.moveTo(0, liquidY + units.strokeWidth)
ctx.lineTo(width, liquidY + units.strokeWidth)
ctx.stroke()
}
}
}
Connections {
target: root
onHeadRatioChanged: {
shellLiquidCanvas.requestPaint()
headsLiquidCanvas.requestPaint()
}
onLevelChanged: {
shellLiquidCanvas.requestPaint()
headsLiquidCanvas.requestPaint()
}
}
}
}
Loader {
width: root.width
height: root.height
sourceComponent: shell
}
Loader {
width: root.width
height: root.height
sourceComponent: liquid
}
}
//(c)C: Copyright © 2020, Michał Policht <michal@policht.pl>. All rights reserved.
//(c)C: This file is a part of CuteHMI.
//(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
//(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
//(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
import QtQuick 2.5
import CuteHMI.GUI 0.0
/**
Valve.
*/
Element {
id: root
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
active: true
property bool leftWay: true
property bool rightWay: true
property bool topWay: false
property bool bottomWay: false
property bool leftClosed: false
property bool rightClosed: false
property bool topClosed: false
property bool bottomClosed: false
property Component way: Component {
SymbolCanvas {
id: canvas
implicitWidth: units.quadrat * 0.25
implicitHeight: units.quadrat * 0.25
element: root
onPaint: {
var ctx = getContext('2d')
ctx.save()
ctx.reset()
ctx.strokeStyle = root.color.stroke
if (closed)
ctx.fillStyle = root.color.stroke
else
ctx.fillStyle = root.color.fill
ctx.lineWidth = units.strokeWidth
var offset = units.strokeWidth / 2.0
ctx.moveTo(offset, offset)
ctx.lineTo(width - offset, height * 0.5)
ctx.lineTo(offset, height - offset)
ctx.closePath()
ctx.fill()
ctx.stroke()
ctx.restore()
}
Connections {
target: parent
onClosedChanged: requestPaint()
}
}
}
Loader {
y: topWay ? 0.5 * height : 0
width: item ? item.implicitWidth : 0
height: item ? item.implicitHeight : 0
sourceComponent: leftWay ? way : undefined
property bool closed: leftClosed
}
Loader {
x: leftWay ? width : (topWay || bottomWay) ? width * 0.5 : 0
y: topWay ? 0.5 * height : 0
width: item ? item.implicitWidth : 0
height: item ? item.implicitHeight : 0
rotation: 180
sourceComponent: rightWay ? way : undefined
property bool closed: rightClosed
}
Loader {
x: leftWay ? width * 0.5 : 0
width: item ? item.implicitWidth : 0
height: item ? item.implicitHeight : 0
rotation: 90
sourceComponent: topWay ? way : undefined
property bool closed: topClosed
}
Loader {
x: leftWay ? width * 0.5 : 0
y: topWay ? height : (leftWay || rightWay) ? height * 0.5 : 0
width: item ? item.implicitWidth : 0
height: item ? item.implicitHeight : 0
rotation: -90
sourceComponent: bottomWay ? way : undefined
property bool closed: bottomClosed
}
}
//(c)C: Copyright © 2020, Michał Policht <michal@policht.pl>. All rights reserved.
//(c)C: This file is a part of CuteHMI.
//(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
//(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
//(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
......@@ -180,4 +180,30 @@ MetaInfo {
requiredImport: "CuteHMI.Symbols.HVAC"
}
}
Type {
name: "CuteHMI.Symbols.HVAC.Tank"
icon: ":/qtquickplugin/images/item-icon16.png"
ItemLibraryEntry {
name: "Tank"
category: "CuteHMI - Symbols - HVAC 0"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "0.0"
requiredImport: "CuteHMI.Symbols.HVAC"
}
}
Type {
name: "CuteHMI.Symbols.HVAC.Valve"
icon: ":/qtquickplugin/images/item-icon16.png"
ItemLibraryEntry {
name: "Valve"
category: "CuteHMI - Symbols - HVAC 0"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "0.0"
requiredImport: "CuteHMI.Symbols.HVAC"
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment