2023-02-22 01:48:49 +03:00
|
|
|
// SPDX-FileCopyrightText: Nheko Contributors
|
2021-09-02 04:15:07 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.2
|
|
|
|
import im.nheko 1.0
|
|
|
|
|
2023-02-28 02:33:27 +03:00
|
|
|
Rectangle {
|
2023-02-24 05:57:53 +03:00
|
|
|
id: warningRoot
|
|
|
|
|
|
|
|
required property string text
|
|
|
|
|
2023-02-28 02:33:27 +03:00
|
|
|
implicitHeight: visible ? warningDisplay.implicitHeight + 4 * Nheko.paddingSmall : 0
|
2021-09-02 04:15:07 +03:00
|
|
|
height: implicitHeight
|
|
|
|
Layout.fillWidth: true
|
2023-02-28 02:33:27 +03:00
|
|
|
color: Nheko.colors.window // required to hide the timeline behind this warning
|
2021-09-02 04:15:07 +03:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: warningRect
|
|
|
|
|
2023-02-28 02:33:27 +03:00
|
|
|
visible: warningRoot.visible
|
2023-02-23 07:23:13 +03:00
|
|
|
// TODO: Qt.alpha() would make more sense but it wasn't working...
|
|
|
|
color: Qt.rgba(Nheko.theme.error.r, Nheko.theme.error.g, Nheko.theme.error.b, 0.3)
|
|
|
|
border.width: 1
|
|
|
|
border.color: Nheko.theme.error
|
|
|
|
radius: 3
|
2021-09-02 04:15:07 +03:00
|
|
|
anchors.fill: parent
|
2023-02-28 02:33:27 +03:00
|
|
|
anchors.margins: visible ? Nheko.paddingSmall : 0
|
2021-09-02 04:15:07 +03:00
|
|
|
z: 3
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: warningDisplay
|
|
|
|
|
|
|
|
anchors.left: parent.left
|
2023-02-23 07:23:13 +03:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.margins: Nheko.paddingSmall
|
|
|
|
color: Nheko.colors.text
|
2023-02-24 05:57:53 +03:00
|
|
|
text: warningRoot.text
|
2021-09-02 04:15:07 +03:00
|
|
|
textFormat: Text.PlainText
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|