2023-07-17 10:49:06 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Controls.Material
|
2022-03-09 13:36:34 +01:00
|
|
|
|
2023-02-10 14:11:31 +01:00
|
|
|
TextHighlightPane {
|
2022-03-09 13:36:34 +01:00
|
|
|
enum IconStyle {
|
|
|
|
|
None,
|
|
|
|
|
Info,
|
|
|
|
|
Warn,
|
2023-03-30 11:24:50 +02:00
|
|
|
Error,
|
|
|
|
|
Progress,
|
|
|
|
|
Pending,
|
2023-04-14 13:34:05 +02:00
|
|
|
Done,
|
|
|
|
|
Spinner
|
2022-03-09 13:36:34 +01:00
|
|
|
}
|
|
|
|
|
|
2022-10-19 14:15:24 +02:00
|
|
|
property alias text: infotext.text
|
2022-03-09 13:36:34 +01:00
|
|
|
property int iconStyle: InfoTextArea.IconStyle.Info
|
2022-08-26 13:21:49 +02:00
|
|
|
property alias textFormat: infotext.textFormat
|
2023-05-12 15:31:06 +02:00
|
|
|
property bool compact: false
|
2022-03-09 13:36:34 +01:00
|
|
|
|
2023-02-10 14:11:31 +01:00
|
|
|
borderColor: iconStyle == InfoTextArea.IconStyle.Info
|
|
|
|
|
? constants.colorInfo
|
|
|
|
|
: iconStyle == InfoTextArea.IconStyle.Warn
|
|
|
|
|
? constants.colorWarning
|
|
|
|
|
: iconStyle == InfoTextArea.IconStyle.Error
|
|
|
|
|
? constants.colorError
|
2023-04-14 13:34:05 +02:00
|
|
|
: iconStyle == InfoTextArea.IconStyle.Progress || iconStyle == InfoTextArea.IconStyle.Spinner
|
2023-03-30 11:24:50 +02:00
|
|
|
? constants.colorProgress
|
|
|
|
|
: iconStyle == InfoTextArea.IconStyle.Done
|
|
|
|
|
? constants.colorDone
|
|
|
|
|
: constants.colorInfo
|
2023-05-12 15:31:06 +02:00
|
|
|
padding: compact ? constants.paddingMedium : constants.paddingXLarge
|
2023-02-10 14:11:31 +01:00
|
|
|
|
|
|
|
|
RowLayout {
|
2022-10-19 14:15:24 +02:00
|
|
|
width: parent.width
|
2023-05-12 15:31:06 +02:00
|
|
|
spacing: compact ? constants.paddingMedium : constants.paddingLarge
|
2023-02-16 13:22:24 +01:00
|
|
|
|
2023-02-10 14:11:31 +01:00
|
|
|
Image {
|
2023-05-12 15:31:06 +02:00
|
|
|
Layout.preferredWidth: compact ? constants.iconSizeSmall : constants.iconSizeMedium
|
|
|
|
|
Layout.preferredHeight: compact ? constants.iconSizeSmall : constants.iconSizeMedium
|
2023-04-24 12:38:41 +02:00
|
|
|
visible: iconStyle != InfoTextArea.IconStyle.Spinner && iconStyle != InfoTextArea.IconStyle.None
|
2023-02-10 14:11:31 +01:00
|
|
|
source: iconStyle == InfoTextArea.IconStyle.Info
|
|
|
|
|
? "../../../icons/info.png"
|
|
|
|
|
: iconStyle == InfoTextArea.IconStyle.Warn
|
|
|
|
|
? "../../../icons/warning.png"
|
|
|
|
|
: iconStyle == InfoTextArea.IconStyle.Error
|
|
|
|
|
? "../../../icons/expired.png"
|
2023-03-30 11:24:50 +02:00
|
|
|
: iconStyle == InfoTextArea.IconStyle.Progress
|
|
|
|
|
? "../../../icons/unconfirmed.png"
|
|
|
|
|
: iconStyle == InfoTextArea.IconStyle.Pending
|
|
|
|
|
? "../../../icons/unpaid.png"
|
|
|
|
|
: iconStyle == InfoTextArea.IconStyle.Done
|
|
|
|
|
? "../../../icons/confirmed.png"
|
|
|
|
|
: ""
|
2023-04-14 13:34:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
2023-05-12 15:31:06 +02:00
|
|
|
Layout.preferredWidth: compact ? constants.iconSizeSmall : constants.iconSizeMedium
|
|
|
|
|
Layout.preferredHeight: compact ? constants.iconSizeSmall : constants.iconSizeMedium
|
2023-04-14 13:34:05 +02:00
|
|
|
visible: iconStyle == InfoTextArea.IconStyle.Spinner
|
|
|
|
|
|
|
|
|
|
BusyIndicator {
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
scale: 0.66
|
|
|
|
|
smooth: true
|
|
|
|
|
running: visible
|
|
|
|
|
}
|
2022-03-09 13:36:34 +01:00
|
|
|
}
|
|
|
|
|
|
2023-02-14 15:37:17 +01:00
|
|
|
Label {
|
2022-10-19 14:15:24 +02:00
|
|
|
id: infotext
|
|
|
|
|
Layout.fillWidth: true
|
2023-02-10 14:11:31 +01:00
|
|
|
wrapMode: Text.Wrap
|
2022-10-19 14:15:24 +02:00
|
|
|
}
|
2022-03-09 13:36:34 +01:00
|
|
|
}
|
|
|
|
|
}
|