Replaces old available property, which is not used anywhere
and also was completely wrong.
Details
- Reviewers
romangg - Group Reviewers
Plasma - Commits
- R115:fc4ee177396e: Port: Expose port availability to QML
R994:fc4ee177396e: Port: Expose port availability to QML
Verified it is accessible from QML: port.availability == Port.Available
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.
src/port.h | ||
---|---|---|
37 | Not needed, perhaps even enum Availability { Unknown = -1, Unavailable, Available }; |
Don't set first enum value to 0
src/port.h | ||
---|---|---|
37 | It matches the PA enum values (not that it is actually used though). |
Tested it and it works fine. Only problem was that I couldn't use "Port.Available", but probably only because I didn't define it somewhere in the QML file. What worked in DeviceListItem.qml:
Ports[portbox.currentIndex].availability == 1
What do I need to add in this file to make the comparision with "Port.Available" instead?
Some higher level questions regarding the overall goals:
- We now know which ports of which sink are currently connected, right? When I take a look at my audio sink directly on the mainboard, it has one port at the back (lineout) and one at the front (headphones). I can switch between them in the KCM, which only changes the volume, but not the direction. I.e. when I have connected headphones I cannot change here to the port on the back, the sound will still come via the front port and the back port is marked as not available. When I manually disconnect the headphone, it switches to the back again. So is there a way to change this behaviour?
- To know if a device is currently "connected", we would need to loop over all its port and check if atleast one of them is connected, right? But what about the "State" property of a sink? It seems to also indicate, if the device is currently used. Should we use this one instead?
src/port.cpp | ||
---|---|---|
39 ↗ | (On Diff #11669) | Ok |
src/port.h | ||
66 ↗ | (On Diff #11669) | There is a way around it, but probably doesn't make sense here. So ok. |
What do I need to add in this file to make the comparision with "Port.Available" instead?
You probably forgot import org.kde.plasma.private.volume.
We now know which ports of which sink are currently connected, right? When I take a look at my audio sink directly on the mainboard, it has one port at the back (lineout) and one at the front (headphones). I can switch between them in the KCM, which only changes the volume, but not the direction. I.e. when I have connected headphones I cannot change here to the port on the back, the sound will still come via the front port and the back port is marked as not available. When I manually disconnect the headphone, it switches to the back again. So is there a way to change this behaviour?
You can probably change it, but only in pulseaudio configuration (most likely changing some modules properties or loading/unlading modules). You can't do that with plasma-pa.
To know if a device is currently "connected", we would need to loop over all its port and check if atleast one of them is connected, right? But what about the "State" property of a sink? It seems to also indicate, if the device is currently used. Should we use this one instead?
Correct, it indicates if you have "jack" connected in port. State property of Device is different thing, it indicates whether the device is currently playing any audio (if it has some streams, if the streams are currently playing or not).