Changeset View
Changeset View
Standalone View
Standalone View
applets/mediacontroller/contents/ui/main.qml
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 32 | property string track: { | |||
---|---|---|---|---|---|
44 | } | 44 | } | ||
45 | var lastSlashPos = xesamUrl.lastIndexOf('/') | 45 | var lastSlashPos = xesamUrl.lastIndexOf('/') | ||
46 | if (lastSlashPos < 0) { | 46 | if (lastSlashPos < 0) { | ||
47 | return "" | 47 | return "" | ||
48 | } | 48 | } | ||
49 | var lastUrlPart = xesamUrl.substring(lastSlashPos + 1) | 49 | var lastUrlPart = xesamUrl.substring(lastSlashPos + 1) | ||
50 | return decodeURIComponent(lastUrlPart) | 50 | return decodeURIComponent(lastUrlPart) | ||
51 | } | 51 | } | ||
52 | property string artist: currentMetadata ? currentMetadata["xesam:artist"] || "" : "" | 52 | property string artist: { | ||
53 | if (!currentMetadata) { | ||||
54 | return "" | ||||
55 | } | ||||
56 | var xesamArtist = currentMetadata["xesam:artist"] | ||||
57 | if (!xesamArtist) { | ||||
58 | return ""; | ||||
59 | } | ||||
60 | | ||||
61 | if (typeof xesamArtist == "string") { | ||||
broulik: Perhaps this should be turned around to check `Array.isArray(xesamArtist)` and in doubt have it… | |||||
That would make much more sence, but (at least for now) QStringList is array-like object and not an actual Array instance, and I don't really feel like I want to mess with all those "is-arrayish" javascript stuff. Strings are way easier to check. lesf0: That would make much more sence, but (at least for now) `QStringList` is array-like object and… | |||||
That's odd, I thought a QStringList would just turn into a plain JS Array on QML side. Fair enough. Will land this for you tomorrow, thanks. broulik: That's odd, I thought a `QStringList` would just turn into a plain JS `Array` on QML side. Fair… | |||||
62 | return xesamArtist | ||||
63 | } else { | ||||
64 | return xesamArtist.join(", ") | ||||
65 | } | ||||
66 | } | ||||
53 | property string albumArt: currentMetadata ? currentMetadata["mpris:artUrl"] || "" : "" | 67 | property string albumArt: currentMetadata ? currentMetadata["mpris:artUrl"] || "" : "" | ||
54 | 68 | | |||
55 | readonly property string identity: !root.noPlayer ? mpris2Source.currentData.Identity || mpris2Source.current : "" | 69 | readonly property string identity: !root.noPlayer ? mpris2Source.currentData.Identity || mpris2Source.current : "" | ||
56 | 70 | | |||
57 | property bool noPlayer: mpris2Source.sources.length <= 1 | 71 | property bool noPlayer: mpris2Source.sources.length <= 1 | ||
58 | 72 | | |||
59 | readonly property bool canControl: (!root.noPlayer && mpris2Source.currentData.CanControl) || false | 73 | readonly property bool canControl: (!root.noPlayer && mpris2Source.currentData.CanControl) || false | ||
60 | readonly property bool canGoPrevious: (canControl && mpris2Source.currentData.CanGoPrevious) || false | 74 | readonly property bool canGoPrevious: (canControl && mpris2Source.currentData.CanGoPrevious) || false | ||
▲ Show 20 Lines • Show All 221 Lines • Show Last 20 Lines |
Perhaps this should be turned around to check Array.isArray(xesamArtist) and in doubt have it cast to string?