2021-09-09 12:18:22 +03:00
|
|
|
import QtQuick 2.15
|
2022-09-26 14:12:59 +03:00
|
|
|
import QtQuick.Layouts 1.15
|
2022-06-08 03:30:22 +03:00
|
|
|
import QtQuick.Controls 2.15
|
2021-09-09 12:18:22 +03:00
|
|
|
|
2021-09-09 14:33:57 +03:00
|
|
|
import Style 1.0
|
|
|
|
|
2021-09-09 12:18:22 +03:00
|
|
|
Item {
|
|
|
|
id: errorBox
|
2022-09-26 14:12:59 +03:00
|
|
|
|
|
|
|
signal closeButtonClicked
|
2021-09-09 12:18:22 +03:00
|
|
|
|
2022-09-26 14:12:59 +03:00
|
|
|
property string text: ""
|
2021-09-09 14:33:57 +03:00
|
|
|
|
|
|
|
property color backgroundColor: Style.errorBoxBackgroundColor
|
2022-09-26 14:12:59 +03:00
|
|
|
property bool showCloseButton: false
|
2021-09-09 12:18:22 +03:00
|
|
|
|
2022-09-26 14:12:59 +03:00
|
|
|
implicitHeight: errorMessageLayout.implicitHeight + (2 * Style.standardSpacing)
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: solidStripe
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
|
|
width: Style.errorBoxStripeWidth
|
|
|
|
color: errorBox.backgroundColor
|
|
|
|
}
|
2021-09-09 12:18:22 +03:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
2021-09-09 14:33:57 +03:00
|
|
|
color: errorBox.backgroundColor
|
2022-09-26 14:12:59 +03:00
|
|
|
opacity: 0.2
|
2021-09-09 12:18:22 +03:00
|
|
|
}
|
|
|
|
|
2022-09-26 14:12:59 +03:00
|
|
|
GridLayout {
|
|
|
|
id: errorMessageLayout
|
|
|
|
|
2021-09-09 12:18:22 +03:00
|
|
|
anchors.fill: parent
|
2022-09-26 14:12:59 +03:00
|
|
|
anchors.margins: Style.standardSpacing
|
|
|
|
anchors.leftMargin: Style.standardSpacing + solidStripe.width
|
|
|
|
|
|
|
|
columns: 2
|
|
|
|
|
|
|
|
Label {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
color: Style.ncTextColor
|
|
|
|
font.bold: true
|
|
|
|
text: qsTr("Error")
|
|
|
|
visible: errorBox.showCloseButton
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
Layout.preferredWidth: Style.iconButtonWidth
|
|
|
|
Layout.preferredHeight: Style.iconButtonWidth
|
|
|
|
|
|
|
|
background: null
|
|
|
|
icon.color: Style.ncTextColor
|
|
|
|
icon.source: "qrc:///client/theme/close.svg"
|
|
|
|
|
|
|
|
visible: errorBox.showCloseButton
|
|
|
|
enabled: visible
|
|
|
|
|
|
|
|
onClicked: errorBox.closeButtonClicked()
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: errorMessage
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
|
|
|
color: Style.ncTextColor
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
text: errorBox.text
|
|
|
|
textFormat: Text.PlainText
|
|
|
|
}
|
2021-09-09 12:18:22 +03:00
|
|
|
}
|
|
|
|
}
|