Guest User

main.qml

a guest
Oct 21st, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import QtQuick 2.6
  2. import QtMultimedia 5.6
  3. import org.kde.plasma.core 2.0 as Plasmacore
  4.  
  5. Item {
  6.  
  7. property var i: 0
  8. property var j: 0
  9.  
  10. MediaPlayer {
  11. id: playlistplayer
  12. autoPlay: true
  13. muted: wallpaper.configuration.Muted
  14. onStatusChanged: {
  15. if ( wallpaper.configuration.Shuffle ) { shuffleList() }
  16. }
  17. playlist: Playlist {
  18. id: playlist
  19. playbackMode: Playlist.Loop
  20. property var videoList: load( wallpaper.configuration.Playlist )
  21. }
  22. }
  23.  
  24. VideoOutput {
  25. fillMode: VideoOutput.PreserveAspectCrop
  26. anchors.fill: parent
  27. source: playlistplayer
  28. }
  29.  
  30. function shuffleList() {
  31. if ( !(i % 2 == 0)) {
  32. j++
  33. }
  34. i++
  35. if ( j > playlist.itemCount ) {
  36. j = 0
  37. i = 0
  38. }
  39. if ( j == 1 ) {
  40. // more random shuffling
  41. for (var k = 0; k < Math.ceil(Math.random() * 10) ; k++) {
  42. playlist.shuffle()
  43.  
  44. }
  45. }
  46. }
  47. }
Add Comment
Please, Sign In to add comment