2019-04-20 22:57:40 +02:00
|
|
|
import QtQuick 2.6
|
|
|
|
import QtQuick.Controls 2.1
|
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import QtQuick.Controls.Material 2.3
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: control
|
|
|
|
height: 50
|
|
|
|
property bool showErrorBar: true
|
|
|
|
|
|
|
|
RectangularGlow {
|
|
|
|
id: toolBarEffect
|
|
|
|
glowRadius: 3
|
|
|
|
spread: 0.2
|
|
|
|
color: "black"
|
|
|
|
opacity: 0.3
|
|
|
|
anchors.fill: toolBar
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: toolBar
|
|
|
|
color: "white"
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: errorField
|
2019-04-22 12:38:23 +02:00
|
|
|
|
|
|
|
property int errorCode: app.errorCode
|
|
|
|
|
|
|
|
onErrorCodeChanged: {
|
|
|
|
if(!([-1, 200, 905].indexOf(app.errorCode) >= 0) && control.showErrorBar){
|
|
|
|
animateErrorBar.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
width: parent.width
|
2019-04-22 12:38:23 +02:00
|
|
|
height: 0
|
2019-04-20 22:57:40 +02:00
|
|
|
anchors.top: parent.bottom
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
color: app.getErrorInfo(errorCode)[0] > 0 ? app.getErrorInfo(errorCode)[0] > 1 ? "red":"grey" : "green"
|
|
|
|
|
|
|
|
SequentialAnimation {
|
|
|
|
id: animateErrorBar
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
target: errorField
|
|
|
|
property: "height"
|
|
|
|
duration: 200
|
|
|
|
from: 0
|
|
|
|
to: 30
|
|
|
|
easing.type: Easing.InOutQuad
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
PauseAnimation {
|
|
|
|
duration: 1300
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
NumberAnimation {
|
|
|
|
target: errorField
|
|
|
|
property: "height"
|
|
|
|
duration: 200
|
|
|
|
from: 30
|
|
|
|
to: 0
|
|
|
|
easing.type: Easing.InOutQuad
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
onRunningChanged: {
|
|
|
|
if(!running){
|
|
|
|
app.errorCode = -1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
2019-04-20 22:57:40 +02:00
|
|
|
id: errorText
|
2019-04-22 12:38:23 +02:00
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
color: "White"
|
2019-04-22 12:38:23 +02:00
|
|
|
|
|
|
|
font.pixelSize: height * 0.5
|
|
|
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
2019-04-20 22:57:40 +02:00
|
|
|
visible: parent.height !== 0
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
text: app.getErrorInfo(errorField.errorCode)[1]
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
2019-04-22 12:38:23 +02:00
|
|
|
}
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
}
|