2019-05-11 15:21:43 +02:00
|
|
|
/*
|
|
|
|
blueROCK - for digital rock
|
|
|
|
Copyright (C) 2019 Dorian Zedler
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|