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

View file

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