MWI icon when count is 0

Display MWI button if a voicemail URI is defined or MWI notification
Fix MWI call button size
This commit is contained in:
Christophe Deschamps 2024-11-25 12:13:25 +01:00
parent 345c90d244
commit b2d0c29d40
6 changed files with 53 additions and 17 deletions

View file

@ -0,0 +1,3 @@
<svg width="11" height="12" viewBox="0 0 11 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.38604 7.46169C9.03394 6.85605 8.84694 5.98675 8.84694 4.9495C8.84694 4.04579 8.48794 3.17909 7.84892 2.54007C7.2099 1.90105 6.3432 1.54205 5.43949 1.54205C4.53577 1.54205 3.66907 1.90105 3.03005 2.54007C2.39103 3.17909 2.03203 4.04579 2.03203 4.9495C2.03203 5.98715 1.84584 6.85605 1.49374 7.46169C1.42189 7.58522 1.3838 7.72547 1.38331 7.86838C1.38281 8.01128 1.41991 8.1518 1.4909 8.27583C1.56143 8.39992 1.66381 8.50294 1.78746 8.57425C1.91111 8.64556 2.05156 8.68258 2.19429 8.68148H3.66193C3.70218 9.12511 3.90687 9.53765 4.23577 9.83807C4.56468 10.1385 4.99403 10.305 5.43949 10.305C5.88494 10.305 6.31429 10.1385 6.6432 9.83807C6.9721 9.53765 7.17679 9.12511 7.21704 8.68148H8.68468C8.82721 8.68236 8.9674 8.64524 9.09082 8.57394C9.21423 8.50264 9.31642 8.39974 9.38686 8.27583C9.45815 8.15198 9.4956 8.01155 9.49546 7.86865C9.49532 7.72575 9.45758 7.5854 9.38604 7.46169ZM5.43949 9.33051C5.25246 9.33055 5.07116 9.26597 4.92627 9.1477C4.78139 9.02942 4.68182 8.86473 4.64441 8.68148H6.23456C6.19715 8.86473 6.09758 9.02942 5.9527 9.1477C5.80781 9.26597 5.62651 9.33055 5.43949 9.33051ZM2.46446 7.70792C2.82345 6.97775 3.00559 6.05044 3.00559 4.9495C3.00559 4.304 3.26202 3.68493 3.71846 3.22848C4.17491 2.77204 4.79398 2.51561 5.43949 2.51561C6.08499 2.51561 6.70406 2.77204 7.16051 3.22848C7.61695 3.68493 7.87338 4.304 7.87338 4.9495C7.87338 6.05003 8.05511 6.97775 8.41411 7.70792H2.46446Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -317,7 +317,7 @@ QString AccountModel::dialPlanAsString(const std::shared_ptr<linphone::DialPlan>
int AccountModel::getVoicemailCount() {
auto userData = getUserData(mMonitor);
if (userData) return userData->voicemailCount;
else return 1;
else return 0;
}
bool AccountModel::getShowMwi() {

View file

@ -146,9 +146,11 @@ Control.Control{
Voicemail {
Layout.leftMargin: 18 * DefaultStyle.dp
Layout.rightMargin: 20 * DefaultStyle.dp
Layout.preferredWidth: 27 * DefaultStyle.dp
Layout.preferredHeight: 28 * DefaultStyle.dp
visible: mainItem.account.core.showMwi
Layout.preferredWidth: 30 * DefaultStyle.dp
Layout.preferredHeight: 26 * DefaultStyle.dp
scaleFactor: 0.7
showMwi: mainItem.account.core.showMwi
visible: mainItem.account.core.voicemailAddress.length > 0 || mainItem.account.core.showMwi
voicemailCount: mainItem.account.core.voicemailCount
onClicked: {
if (mainItem.account.core.voicemailAddress.length > 0)

View file

@ -9,16 +9,22 @@ import SettingsCpp
Rectangle{
id: mainItem
property int voicemailCount: 0
width: 27 * DefaultStyle.dp
height: 28 * DefaultStyle.dp
property bool showMwi: false
width: 42 * DefaultStyle.dp * scaleFactor
height: 36 * DefaultStyle.dp * scaleFactor
property real scaleFactor: 1.0
signal clicked()
color: 'transparent'
Button {
anchors.bottom: parent.bottom
anchors.left: parent.left
icon.source: AppIcons.voicemail
width: 24 * DefaultStyle.dp
height: 24 * DefaultStyle.dp
icon.color: DefaultStyle.main2_600
width: 33 * DefaultStyle.dp * scaleFactor
height: width
icon.width: width
icon.height: width
padding: 0
background: Item {
anchors.fill: parent
}
@ -29,11 +35,31 @@ Rectangle{
Text {
anchors.top: parent.top
anchors.right: parent.right
width: 14 * DefaultStyle.dp * scaleFactor
height: width
horizontalAlignment: Text.AlignHCenter
font.weight: 700 * DefaultStyle.dp
font.pixelSize: 10 * DefaultStyle.dp
font.pixelSize: 13 * DefaultStyle.dp * scaleFactor
color: DefaultStyle.danger_500main
text: voicemailCount >= 100 ? '99+' : voicemailCount
visible: voicemailCount > 0
visible: showMwi && voicemailCount > 0
maximumLineCount: 1
}
Rectangle {
anchors.top: parent.top
anchors.right: parent.right
color: DefaultStyle.danger_500main
visible: showMwi && voicemailCount == 0
width: 14 * DefaultStyle.dp * scaleFactor
height: width
radius: width / 2
EffectImage {
anchors.fill: parent
anchors.margins: 1.5 * DefaultStyle.dp * scaleFactor
imageSource: AppIcons.bellMwi
colorizationColor: DefaultStyle.grey_0
}
}
}

View file

@ -295,28 +295,32 @@ Item {
}
Voicemail {
id: voicemail
Layout.preferredWidth: 27 * DefaultStyle.dp
Layout.preferredHeight: 28 * DefaultStyle.dp
Layout.preferredWidth: 42 * DefaultStyle.dp
Layout.preferredHeight: 36 * DefaultStyle.dp
Repeater {
model: accountProxy
delegate: Item {
Connections {
target: modelData.core
onShowMwiChanged: voicemail.updateCumulatedMwi()
onVoicemailAddressChanged: voicemail.updateCumulatedMwi()
}
}
}
function updateCumulatedMwi() {
var count = 0
var show = false
var showMwi = false
var supportsVoiceMail = false
for (var i=0 ; i < accountProxy.count ; i++ ) {
count += accountProxy.getAt(i).core.voicemailCount
show |= accountProxy.getAt(i).core.showMwi
var core = accountProxy.getAt(i).core
count += core.voicemailCount
showMwi |= core.showMwi
supportsVoiceMail |= core.voicemailAddress.length > 0
}
voicemail.visible = show
voicemail.showMwi = showMwi
voicemail.voicemailCount = count
voicemail.visible = showMwi || supportsVoiceMail
}
Component.onCompleted: {

View file

@ -124,4 +124,5 @@ QtObject {
property string power: "image://internal/power.svg"
property string resourcePackage: "image://internal/resource-package.svg"
property string appWindow: "image://internal/app-window.svg"
property string bellMwi: "image://internal/bell-mwi.svg"
}