2023-07-20 10:38:49 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-08-17 15:30:02 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
2023-07-20 10:38:49 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
Control {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property string title
|
|
|
|
property string feeText
|
|
|
|
|
|
|
|
property bool highlightFee: false
|
|
|
|
property bool errorFee: false
|
|
|
|
|
|
|
|
background: null
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
implicitHeight: Math.max(titleText.implicitHeight,
|
|
|
|
feeText.implicitHeight)
|
|
|
|
|
2024-10-15 19:26:12 +00:00
|
|
|
readonly property int halfWidth: (width - Theme.padding) / 2
|
2023-07-20 10:38:49 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: titleText
|
|
|
|
|
|
|
|
width: parent.halfWidth
|
|
|
|
|
|
|
|
text: root.title
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
maximumLineCount: 2
|
|
|
|
lineHeight: 22
|
|
|
|
lineHeightMode: Text.FixedHeight
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2023-07-20 10:38:49 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: feeText
|
|
|
|
|
|
|
|
readonly property color baseColor: root.highlightFee
|
|
|
|
? Theme.palette.directColor1
|
|
|
|
: Theme.palette.baseColor1
|
|
|
|
|
|
|
|
width: parent.halfWidth
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
textFormat: Text.RichText
|
|
|
|
text: `<span style="color:${baseColor};` +
|
2024-10-15 19:26:12 +00:00
|
|
|
`font-size:${Theme.tertiaryTextFontSize}px;">` +
|
2023-08-17 15:30:02 +00:00
|
|
|
`${qsTr("Max.")}</span> ${SQUtils.StringUtils.escapeHtml(root.feeText)}`
|
2023-07-20 10:38:49 +00:00
|
|
|
|
|
|
|
visible: root.feeText !== ""
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
color: root.errorFee ? Theme.palette.dangerColor1 : baseColor
|
|
|
|
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2023-07-20 10:38:49 +00:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
maximumLineCount: 2
|
|
|
|
|
|
|
|
// Setting text format to Text.RichText behaves similarly as
|
|
|
|
// as adding vapid onLineLaidOut handler described in
|
|
|
|
// https://bugreports.qt.io/browse/QTBUG-62057
|
|
|
|
// lineHeight: 22
|
|
|
|
// lineHeightMode: Text.FixedHeight
|
|
|
|
}
|
|
|
|
|
|
|
|
LoadingComponent {
|
|
|
|
visible: root.feeText === ""
|
|
|
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: feeText.verticalCenter
|
|
|
|
width: 160
|
|
|
|
height: 11
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|