/* 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 . */ 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: Material.background anchors.fill: parent Rectangle { id: errorField property int errorCode: app.errorCode onErrorCodeChanged: { if(!([-1, 200, 905].indexOf(app.errorCode) >= 0) && control.showErrorBar){ animateErrorBar.start() } } width: parent.width height: 0 anchors.top: parent.bottom 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 } PauseAnimation { duration: 1300 } NumberAnimation { target: errorField property: "height" duration: 200 from: 30 to: 0 easing.type: Easing.InOutQuad } onRunningChanged: { if(!running){ app.errorCode = -1 } } } Label { id: errorText anchors.fill: parent color: "White" font.pixelSize: height * 0.5 verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter visible: parent.height !== 0 text: app.getErrorInfo(errorField.errorCode)[1] } } } }