[Applet]Always get valid device and stream name
ClosedPublic

Authored by gvgeo on Feb 7 2020, 10:45 AM.

Details

Summary

Added more checks and an error message.

Diff Detail

Repository
R115 Plasma Audio Volume Applet
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
gvgeo created this revision.Feb 7 2020, 10:45 AM
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 7 2020, 10:45 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
gvgeo requested review of this revision.Feb 7 2020, 10:45 AM
gvgeo added a comment.Feb 7 2020, 10:48 AM

Occasionally I get this.

kf5.ki18n: "0 instead of 1 arguments to message {Adjust volume for %1} supplied before conversion."
kf5.ki18n: "0 instead of 1 arguments to message {Mute %1} supplied before conversion."
kf5.ki18n: "0 instead of 1 arguments to message {Show additional opti...} supplied before conversion."
org.kde.plasma.pulseaudio: No object for name "alsa_output.pci-0000_00_1b.0.analog-stereo"
qrc:/plasma/plasmoids/org.kde.plasma.volume/contents/ui/ListItemBase.qml:118: TypeError: Value is undefined and could not be converted to an object
qrc:/plasma/plasmoids/org.kde.plasma.volume/contents/ui/ListItemBase.qml:144: TypeError: Value is undefined and could not be converted to an object
kf5.ki18n: "0 instead of 1 arguments to message {Adjust volume for %1} supplied before conversion."
kf5.ki18n: "0 instead of 1 arguments to message {Mute %1} supplied before conversion."
kf5.ki18n: "0 instead of 1 arguments to message {Show additional opti...} supplied before conversion."
org.kde.plasma.pulseaudio: No object for name "alsa_output.pci-0000_00_1b.0.analog-stereo"
org.kde.plasma.pulseaudio: No object for name "alsa_input.pci-0000_00_1b.0.analog-stereo"
org.kde.plasma.pulseaudio: No object for name "PulseEffects_apps.monitor"
org.kde.plasma.pulseaudio: No object for name "PulseEffects_apps.monitor"
org.kde.plasma.pulseaudio: No object for name "alsa_input.pci-0000_00_1b.0.analog-stereo"

This patch will hide the warnings from the applet side and make it more foolproof.
The problem still exists.

ngraham added a reviewer: VDG.Feb 7 2020, 2:06 PM
ngraham added inline comments.
applet/contents/ui/DeviceListItem.qml
49

If this is something that should be shown to the user (is it?), then it needs to be localized by wrapping it in i18n()

applet/contents/ui/StreamListItem.qml
35

ditto

gvgeo updated this revision to Diff 75167.Feb 7 2020, 2:43 PM

localize

gvgeo added a comment.Feb 7 2020, 2:45 PM

If this is something that should be shown to the user

It should not. It worked like that for years. I have never encounter this, as a UI bug. And I don't expect that I'll ever see that message.
It's more to avoid error messages. And for the rare occasion for a device not having a Description.

But if it exist, it can be shown to user. Feel sorry for the translators. This may never be read.

gvgeo planned changes to this revision.Feb 7 2020, 3:08 PM

I get some more messages now...

gvgeo updated this revision to Diff 75176.Feb 7 2020, 3:43 PM

i18n without context.
Fix typo, from previous commit.

gvgeo marked an inline comment as done.Feb 7 2020, 3:43 PM
ngraham accepted this revision.Feb 18 2020, 5:01 AM
This revision is now accepted and ready to land.Feb 18 2020, 5:01 AM
This revision was automatically updated to reflect the committed changes.