on xenial help sign in
Further tweaks
commit1e727489ede9014ca07609008afabc3740484f98 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateTue 4 Feb 2014, 13:43 (13 years ago) parent8d7fa99
3 files changed+9−8
qml/Dash/Previews/AudioPlayer.qml+2−1 qml/Dash/Previews/PreviewWidget.qml+2−2 tests/qmltests/Dash/Previews/tst_AudioPlayer.qml+5−5
qml/Dash/Previews/AudioPlayer.qml+2−1
@@ -29,7 +29,7 @@ PreviewWidget {
2929 id: root
3030 implicitHeight: childrenRect.height
3131
32− onFocusedChanged: if (!focused) audio.stop()
32+ onIsCurrentPreviewChanged: if (!isCurrentPreview) audio.stop()
3333
3434 Audio {
3535 id: audio
@@ -39,6 +39,7 @@ PreviewWidget {
3939 property Item playingItem
4040
4141 Component.onDestruction: {
42+ // destructing the component doesn't automatically send stop to the media service, probably a bug in QtMultimedia
4243 audio.stop();
4344 }
4445
qml/Dash/Previews/PreviewWidget.qml+2−2
@@ -19,8 +19,8 @@ import QtQuick 2.0
1919/*! Interface for preview widgets. */
2020
2121Item {
22− /// type:bool Specifies the preview widget being focused or not
23− property bool focused: true
22+ /// type:bool Specifies the preview widget being currently used or not
23+ property bool isCurrentPreview: true
2424
2525 /// Variable used to contain widget's data
2626 property var widgetData
tests/qmltests/Dash/Previews/tst_AudioPlayer.qml+5−5
@@ -36,9 +36,9 @@ Rectangle {
3636 }
3737
3838 property var tracksModel2: {
39− "tracks": [ { title: "Some track name", length: "30", source: "../../tests/qmltests/Dash/Music/data/testsound1.ogg" },
40− { title: "Some other track name", subtitle: "Subtitle", length: "83", source: "../../tests/qmltests/Dash/Music/data/testsound2.ogg" },
41− { title: "And another one", length: "7425", source: "../../tests/qmltests/Dash/Music/data/testsound3.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: "not-existing_testsound2.ogg" },
41+ { title: "And another one", length: "7425", source: "not-existing_testsound3.ogg" } ]
4242 }
4343
4444 AudioPlayer {
@@ -170,8 +170,8 @@ Rectangle {
170170 tryCompare(track1ProgressBar, "visible", false);
171171 tryCompare(track2ProgressBar, "visible", true);
172172
173− // Calling stop() should make all players shut up!
174− audioPlayer.focused = false
173+ // Changing preview should make all players shut up!
174+ audioPlayer.isCurrentPreview = false
175175 tryCompare(audio, "playbackState", Audio.StoppedState);
176176 }
177177 }