Changeset View
Changeset View
Standalone View
Standalone View
applets/mediacontroller/contents/ui/main.qml
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 28 | Item { | |||
---|---|---|---|---|---|
52 | property string artist: currentMetadata ? currentMetadata["xesam:artist"] || "" : "" | 52 | property string artist: currentMetadata ? currentMetadata["xesam:artist"] || "" : "" | ||
53 | property string albumArt: currentMetadata ? currentMetadata["mpris:artUrl"] || "" : "" | 53 | property string albumArt: currentMetadata ? currentMetadata["mpris:artUrl"] || "" : "" | ||
54 | 54 | | |||
55 | property bool noPlayer: mpris2Source.sources.length <= 1 | 55 | property bool noPlayer: mpris2Source.sources.length <= 1 | ||
56 | 56 | | |||
57 | readonly property bool canControl: !root.noPlayer && mpris2Source.currentData.CanControl | 57 | readonly property bool canControl: !root.noPlayer && mpris2Source.currentData.CanControl | ||
58 | readonly property bool canGoPrevious: canControl && mpris2Source.currentData.CanGoPrevious | 58 | readonly property bool canGoPrevious: canControl && mpris2Source.currentData.CanGoPrevious | ||
59 | readonly property bool canGoNext: canControl && mpris2Source.currentData.CanGoNext | 59 | readonly property bool canGoNext: canControl && mpris2Source.currentData.CanGoNext | ||
60 | readonly property bool canPlay: canControl && mpris2Source.currentData.CanPlay | ||||
61 | readonly property bool canPause: canControl && mpris2Source.currentData.CanPause | ||||
60 | 62 | | |||
61 | Plasmoid.switchWidth: units.gridUnit * 14 | 63 | Plasmoid.switchWidth: units.gridUnit * 14 | ||
62 | Plasmoid.switchHeight: units.gridUnit * 10 | 64 | Plasmoid.switchHeight: units.gridUnit * 10 | ||
63 | Plasmoid.icon: albumArt ? albumArt : "media-playback-start" | 65 | Plasmoid.icon: albumArt ? albumArt : "media-playback-start" | ||
64 | Plasmoid.toolTipMainText: i18n("No media playing") | 66 | Plasmoid.toolTipMainText: i18n("No media playing") | ||
65 | Plasmoid.toolTipSubText: "" | 67 | Plasmoid.toolTipSubText: "" | ||
66 | Plasmoid.toolTipTextFormat: Text.PlainText | 68 | Plasmoid.toolTipTextFormat: Text.PlainText | ||
67 | Plasmoid.status: PlasmaCore.Types.ActiveStatus | 69 | Plasmoid.status: PlasmaCore.Types.ActiveStatus | ||
Show All 14 Lines | 83 | if (canControl) { | |||
82 | plasmoid.setAction("previous", i18nc("Play previous track", "Previous Track"), | 84 | plasmoid.setAction("previous", i18nc("Play previous track", "Previous Track"), | ||
83 | Qt.application.layoutDirection === Qt.RightToLeft ? "media-skip-forward" : "media-skip-backward"); | 85 | Qt.application.layoutDirection === Qt.RightToLeft ? "media-skip-forward" : "media-skip-backward"); | ||
84 | plasmoid.action("previous").enabled = Qt.binding(function() { | 86 | plasmoid.action("previous").enabled = Qt.binding(function() { | ||
85 | return root.canGoPrevious | 87 | return root.canGoPrevious | ||
86 | }) | 88 | }) | ||
87 | 89 | | |||
88 | if (root.state == "playing") { | 90 | if (root.state == "playing") { | ||
89 | plasmoid.setAction("playPause", i18nc("Pause playback", "Pause"), "media-playback-pause") | 91 | plasmoid.setAction("playPause", i18nc("Pause playback", "Pause"), "media-playback-pause") | ||
92 | plasmoid.action("playPause").enabled = Qt.binding(function() { | ||||
93 | return root.canPause; | ||||
94 | }); | ||||
90 | } else { | 95 | } else { | ||
91 | plasmoid.setAction("playPause", i18nc("Start playback", "Play"), "media-playback-start") | 96 | plasmoid.setAction("playPause", i18nc("Start playback", "Play"), "media-playback-start") | ||
97 | plasmoid.action("playPause").enabled = Qt.binding(function() { | ||||
98 | return root.canPlay; | ||||
99 | }); | ||||
92 | } | 100 | } | ||
93 | 101 | | |||
94 | plasmoid.setAction("next", i18nc("Play next track", "Next Track"), | 102 | plasmoid.setAction("next", i18nc("Play next track", "Next Track"), | ||
95 | Qt.application.layoutDirection === Qt.RightToLeft ? "media-skip-backward" : "media-skip-forward") | 103 | Qt.application.layoutDirection === Qt.RightToLeft ? "media-skip-backward" : "media-skip-forward") | ||
96 | plasmoid.action("next").enabled = Qt.binding(function() { | 104 | plasmoid.action("next").enabled = Qt.binding(function() { | ||
97 | return root.canGoNext | 105 | return root.canGoNext | ||
98 | }) | 106 | }) | ||
99 | 107 | | |||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |