on xenial help sign in
Further tweaks
1e72748Andrea Cimitan
qml/Dash/Previews/AudioPlayer.qml+2−1
@@ -29,7 +29,7 @@ PreviewWidget {
29 id: root
29 id: root
30 implicitHeight: childrenRect.height
30 implicitHeight: childrenRect.height
31
31
32− onFocusedChanged: if (!focused) audio.stop()
32+ onIsCurrentPreviewChanged: if (!isCurrentPreview) audio.stop()
33
33
34 Audio {
34 Audio {
35 id: audio
35 id: audio
@@ -39,6 +39,7 @@ PreviewWidget {
39 property Item playingItem
39 property Item playingItem
40
40
41 Component.onDestruction: {
41 Component.onDestruction: {
42+ // destructing the component doesn't automatically send stop to the media service, probably a bug in QtMultimedia
42 audio.stop();
43 audio.stop();
43 }
44 }
44
45
qml/Dash/Previews/PreviewWidget.qml+2−2
@@ -19,8 +19,8 @@ import QtQuick 2.0
19/*! Interface for preview widgets. */
19/*! Interface for preview widgets. */
20
20
21Item {
21Item {
22− /// type:bool Specifies the preview widget being focused or not
22+ /// type:bool Specifies the preview widget being currently used or not
23− property bool focused: true
23+ property bool isCurrentPreview: true
24
24
25 /// Variable used to contain widget's data
25 /// Variable used to contain widget's data
26 property var widgetData
26 property var widgetData
tests/qmltests/Dash/Previews/tst_AudioPlayer.qml+5−5
@@ -36,9 +36,9 @@ Rectangle {
36 }
36 }
37
37
38 property var tracksModel2: {
38 property var tracksModel2: {
39− "tracks": [ { title: "Some track name", length: "30", source: "../../tests/qmltests/Dash/Music/data/testsound1.ogg" },
39+ "tracks": [ { title: "Some track name", length: "30", source: "not-existing_testsound1.ogg" },
40− { title: "Some other track name", subtitle: "Subtitle", length: "83", source: "../../tests/qmltests/Dash/Music/data/testsound2.ogg" },
40+ { title: "Some other track name", subtitle: "Subtitle", length: "83", source: "not-existing_testsound2.ogg" },
41− { title: "And another one", length: "7425", source: "../../tests/qmltests/Dash/Music/data/testsound3.ogg" } ]
41+ { title: "And another one", length: "7425", source: "not-existing_testsound3.ogg" } ]
42 }
42 }
43
43
44 AudioPlayer {
44 AudioPlayer {
@@ -170,8 +170,8 @@ Rectangle {
170 tryCompare(track1ProgressBar, "visible", false);
170 tryCompare(track1ProgressBar, "visible", false);
171 tryCompare(track2ProgressBar, "visible", true);
171 tryCompare(track2ProgressBar, "visible", true);
172
172
173− // Calling stop() should make all players shut up!
173+ // Changing preview should make all players shut up!
174− audioPlayer.focused = false
174+ audioPlayer.isCurrentPreview = false
175 tryCompare(audio, "playbackState", Audio.StoppedState);
175 tryCompare(audio, "playbackState", Audio.StoppedState);
176 }
176 }
177 }
177 }