diff --git a/core/core.pro b/core/core.pro index 941301e..3744519 100644 --- a/core/core.pro +++ b/core/core.pro @@ -202,4 +202,5 @@ OTHER_FILES += \ wizards/DecoderOffset.qml \ wizards/wizard.qml \ wizards/EngineConfig.qml \ - wizards/ActualDecoderOffset.qml + wizards/ActualDecoderOffset.qml \ + src/WarningLabel/WarningLabel.qml diff --git a/core/src/WarningLabel/WarningLabel.qml b/core/src/WarningLabel/WarningLabel.qml new file mode 100644 index 0000000..2e957a7 --- /dev/null +++ b/core/src/WarningLabel/WarningLabel.qml @@ -0,0 +1,62 @@ +import Qt 4.7 + + +Rectangle { + id: warninglabel + color:"red" + property bool flash: false + property string propertyMapProperty; + property string conditiontype; + property int conditionval; + property double conditionvalue; + property string message; + Timer { + id: flashertimer + interval: 500 + repeat: true + running: false + onTriggered: { + //console.log("Wee:" + conditionvalue); + if (parent.flash) + { + parent.flash = false; + parent.color = "orange"; + } + else + { + parent.flash = true; + parent.color = "red"; + } + } + } + onConditionvalueChanged: { + //console.log("CCalue:" + conditionvalue); + if (conditiontype == "over") + { + //console.log("CValue:" + conditionvalue + conditionval); + if (conditionvalue > conditionval) + { + flashertimer.running = true; + warninglabel.visible = true; + } + else + { + flashertimer.running = false; + warninglabel.visible = false; + } + } + } + Component.onCompleted: + { + warninglabel.visible = false; + } + + Text { + anchors.fill:parent + horizontalAlignment: Text.AlignHCenter; + verticalAlignment: Text.AlignVCenter; + wrapMode: Text.WrapAtWordBoundaryOrAnywhere; + font.pointSize: 14 + text: message; + } +} diff --git a/core/src/gauges.qml b/core/src/gauges.qml index da22b7f..b4a61b5 100644 --- a/core/src/gauges.qml +++ b/core/src/gauges.qml @@ -1,6 +1,6 @@ import Qt 4.7 import GaugeImage 0.1 - +import "WarningLabel" Rectangle { x:0 y:0 @@ -178,4 +178,20 @@ Rectangle { } } } + Component.onCompleted: { + + } + + WarningLabel { + id: warning; + x: (parent.width / 2.0) - 200 + width:200 + y: (parent.height / 2.0) - 100 + height:100 + propertyMapProperty: "CHT"; + conditiontype: "over"; + conditionval: 215; + conditionvalue: propertyMap["CHT"]; + message: "Warning!\nEngine is overheating!!!!!"; + } }