Ui: Fix progress bar view on low numbers, button display on contact devices.

This commit is contained in:
Julien Wadel 2024-10-21 10:55:41 +02:00
parent fea341444c
commit d0bb53ddc6
2 changed files with 24 additions and 11 deletions

View file

@ -9,9 +9,17 @@ ProgressBar {
property color backgroundColor: DefaultStyle.main2_100
property color innerColor: DefaultStyle.info_500_main
property color innerTextColor: DefaultStyle.grey_0
property color innerTextColor: centeredText ? DefaultStyle.info_500_main : DefaultStyle.grey_0
property bool innerTextVisible: true
property string innerText: Number.parseFloat(value*100).toFixed(0) + "%"
property int barWidth: mainItem.visualPosition * mainItem.width
property bool centeredText: textSize.width >= barWidth
TextMetrics{
id: textSize
text: mainItem.innerText
}
background: Rectangle {
color: mainItem.backgroundColor
@ -22,19 +30,20 @@ ProgressBar {
}
contentItem: Item {
Rectangle {
id: bar
color: mainItem.innerColor
radius: 50 * DefaultStyle.dp
width: mainItem.visualPosition * mainItem.width
width: mainItem.barWidth
height: parent.height
Text {
visible: innerTextVisible && mainItem.value > 0
text: mainItem.innerText
anchors.centerIn: parent
color: mainItem.innerTextColor
font {
pixelSize: 10 * DefaultStyle.dp
weight: 700 * DefaultStyle.dp
}
}
Text {
visible: mainItem.innerTextVisible
text: mainItem.innerText
anchors.centerIn: mainItem.centeredText ? parent : bar
color: mainItem.innerTextColor
font {
pixelSize: 10 * DefaultStyle.dp
weight: 700 * DefaultStyle.dp
}
}
}

View file

@ -591,6 +591,7 @@ AbstractMainPage {
}
RoundedPane {
Layout.preferredWidth: 360 * DefaultStyle.dp
bottomPadding: 21 * DefaultStyle.dp
contentItem: ColumnLayout {
spacing: 13 * DefaultStyle.dp
Text {
@ -637,9 +638,12 @@ AbstractMainPage {
}
Button {
Layout.preferredHeight: 30 * DefaultStyle.dp
visible: modelData.securityLevel != LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified
color: DefaultStyle.main1_100
icon.source: AppIcons.warningCircle
icon.height: 14 * DefaultStyle.dp
icon.width: 14 * DefaultStyle.dp
contentImageColor: DefaultStyle.main1_500_main
textColor: DefaultStyle.main1_500_main
textSize: 13 * DefaultStyle.dp