Changeset View
Changeset View
Standalone View
Standalone View
applets/mediacontroller/contents/ui/ExpandedRepresentation.qml
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 32 | Item { | |||
---|---|---|---|---|---|
54 | function retrievePosition() { | 54 | function retrievePosition() { | ||
55 | var service = mpris2Source.serviceForSource(mpris2Source.current); | 55 | var service = mpris2Source.serviceForSource(mpris2Source.current); | ||
56 | var operation = service.operationDescription("GetPosition"); | 56 | var operation = service.operationDescription("GetPosition"); | ||
57 | service.startOperationCall(operation); | 57 | service.startOperationCall(operation); | ||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | Connections { | 60 | Connections { | ||
61 | target: plasmoid | 61 | target: plasmoid | ||
62 | onExpandedChanged: { | 62 | function onExpandedChanged() { | ||
63 | if (plasmoid.expanded) { | 63 | if (plasmoid.expanded) { | ||
64 | retrievePosition(); | 64 | retrievePosition(); | ||
65 | } | 65 | } | ||
66 | } | 66 | } | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | onPositionChanged: { | 69 | function onPositionChanged() { | ||
70 | // we don't want to interrupt the user dragging the slider | 70 | // we don't want to interrupt the user dragging the slider | ||
71 | if (!seekSlider.pressed && !keyPressed) { | 71 | if (!seekSlider.pressed && !keyPressed) { | ||
72 | // we also don't want passive position updates | 72 | // we also don't want passive position updates | ||
73 | disablePositionUpdate = true | 73 | disablePositionUpdate = true | ||
74 | seekSlider.value = position | 74 | seekSlider.value = position | ||
75 | disablePositionUpdate = false | 75 | disablePositionUpdate = false | ||
76 | } | 76 | } | ||
77 | } | 77 | } | ||
78 | 78 | | |||
79 | onLengthChanged: { | 79 | function onLengthChanged() { | ||
80 | disablePositionUpdate = true | 80 | disablePositionUpdate = true | ||
81 | // When reducing maximumValue, value is clamped to it, however | 81 | // When reducing maximumValue, value is clamped to it, however | ||
82 | // when increasing it again it gets its old value back. | 82 | // when increasing it again it gets its old value back. | ||
83 | // To keep us from seeking to the end of the track when moving | 83 | // To keep us from seeking to the end of the track when moving | ||
84 | // to a new track, we'll reset the value to zero and ask for the position again | 84 | // to a new track, we'll reset the value to zero and ask for the position again | ||
85 | seekSlider.value = 0 | 85 | seekSlider.value = 0 | ||
86 | seekSlider.to = length | 86 | seekSlider.to = length | ||
87 | retrievePosition() | 87 | retrievePosition() | ||
▲ Show 20 Lines • Show All 373 Lines • ▼ Show 20 Line(s) | 459 | PlasmaComponents3.ComboBox { | |||
461 | Layout.leftMargin: units.gridUnit*2 | 461 | Layout.leftMargin: units.gridUnit*2 | ||
462 | Layout.rightMargin: units.gridUnit*2 | 462 | Layout.rightMargin: units.gridUnit*2 | ||
463 | 463 | | |||
464 | id: playerCombo | 464 | id: playerCombo | ||
465 | textRole: "text" | 465 | textRole: "text" | ||
466 | visible: model.length > 2 // more than one player, @multiplex is always there | 466 | visible: model.length > 2 // more than one player, @multiplex is always there | ||
467 | model: root.mprisSourcesModel | 467 | model: root.mprisSourcesModel | ||
468 | 468 | | |||
469 | onModelChanged: { | 469 | function onModelChanged() { | ||
470 | // if model changes, ComboBox resets, so we try to find the current player again... | 470 | // if model changes, ComboBox resets, so we try to find the current player again... | ||
471 | for (var i = 0, length = model.length; i < length; ++i) { | 471 | for (var i = 0, length = model.length; i < length; ++i) { | ||
472 | if (model[i].source === mpris2Source.current) { | 472 | if (model[i].source === mpris2Source.current) { | ||
473 | currentIndex = i | 473 | currentIndex = i | ||
474 | break | 474 | break | ||
475 | } | 475 | } | ||
476 | } | 476 | } | ||
477 | } | 477 | } | ||
Show All 24 Lines |