2020-11-27 17:32:48 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-04-21 07:39:05 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-14 11:35:37 +00:00
|
|
|
import "../"
|
2021-10-14 12:14:11 +00:00
|
|
|
import "./"
|
2020-11-27 17:32:48 +00:00
|
|
|
|
|
|
|
Rectangle {
|
2021-04-21 07:39:05 +00:00
|
|
|
id: root
|
2022-08-05 19:52:34 +00:00
|
|
|
objectName: "moduleWarningBanner"
|
2020-11-27 17:32:48 +00:00
|
|
|
height: visible ? 32 : 0
|
2022-03-03 21:00:52 +00:00
|
|
|
implicitHeight: height
|
2020-11-27 17:32:48 +00:00
|
|
|
color: Style.current.red
|
2022-02-09 09:43:23 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
property string text: ""
|
|
|
|
property string btnText: ""
|
|
|
|
property int btnWidth: 58
|
2022-03-03 21:00:52 +00:00
|
|
|
property bool closing: false
|
2022-02-09 09:43:23 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
property var onClick: function() {}
|
2021-04-21 07:39:05 +00:00
|
|
|
|
2022-03-03 21:00:52 +00:00
|
|
|
signal closed()
|
|
|
|
|
2022-03-17 16:15:38 +00:00
|
|
|
function close() {
|
|
|
|
closeBtn.clicked(null)
|
2022-03-03 21:00:52 +00:00
|
|
|
closed();
|
2022-03-17 16:15:38 +00:00
|
|
|
}
|
|
|
|
|
2020-11-27 17:32:48 +00:00
|
|
|
Row {
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
StyledText {
|
2021-06-17 18:41:11 +00:00
|
|
|
text: root.text
|
2020-11-27 17:32:48 +00:00
|
|
|
font.pixelSize: 13
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
color: Style.current.white
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2021-06-17 18:41:11 +00:00
|
|
|
width: btnWidth
|
2020-11-27 17:32:48 +00:00
|
|
|
height: 24
|
|
|
|
contentItem: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
Text {
|
2021-06-17 18:41:11 +00:00
|
|
|
text: btnText
|
2020-11-27 17:32:48 +00:00
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.family: Style.current.fontRegular.name
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
color: Style.current.white
|
|
|
|
}
|
|
|
|
}
|
|
|
|
background: Rectangle {
|
|
|
|
radius: 4
|
|
|
|
anchors.fill: parent
|
|
|
|
border.color: Style.current.white
|
|
|
|
color: "#19FFFFFF"
|
|
|
|
}
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
2021-06-17 18:41:11 +00:00
|
|
|
onClicked: root.onClick()
|
2020-11-27 17:32:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-21 07:39:05 +00:00
|
|
|
SVGImage {
|
|
|
|
id: closeImg
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 6
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 18
|
2021-10-14 11:35:37 +00:00
|
|
|
source: Style.svg("close-white")
|
2021-04-21 07:39:05 +00:00
|
|
|
height: 20
|
|
|
|
width: 20
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: closeImg
|
|
|
|
source: closeImg
|
|
|
|
color: Style.current.white
|
|
|
|
opacity: 0.7
|
|
|
|
}
|
|
|
|
MouseArea {
|
2022-03-17 16:15:38 +00:00
|
|
|
id: closeBtn
|
2021-04-21 07:39:05 +00:00
|
|
|
anchors.fill: closeImg
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2022-03-03 21:00:52 +00:00
|
|
|
onClicked: {
|
|
|
|
closing = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ParallelAnimation {
|
|
|
|
running: closing
|
|
|
|
PropertyAnimation { target: root; property: "visible"; to: false; }
|
|
|
|
PropertyAnimation { target: root; property: "y"; to: -1 * root.height }
|
|
|
|
onRunningChanged: {
|
|
|
|
if(!running){
|
|
|
|
closing = false;
|
|
|
|
root.y = 0;
|
|
|
|
root.closed();
|
|
|
|
}
|
2021-04-21 07:39:05 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-11 13:57:43 +00:00
|
|
|
}
|