PlayerControls.qml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import QtQuick 2.0
  2. import DMusic 1.0
  3. Item {
  4. id: root
  5. property bool playing
  6. property bool shuffle
  7. property int loop
  8. signal pause_or_play()
  9. signal next()
  10. signal prev()
  11. signal setShuffle(bool v)
  12. signal setLoop(int v)
  13. PlayerControlsButton {
  14. id: _play_pause
  15. anchors.centerIn: root
  16. width: 30
  17. height: 30
  18. icon: playing? "qrc:/resources/player/pause.svg" : "qrc:/resources/player/play.svg"
  19. onClick: pause_or_play()
  20. }
  21. PlayerControlsButton {
  22. id: _next
  23. anchors.verticalCenter: root.verticalCenter
  24. anchors.horizontalCenter: root.horizontalCenter
  25. anchors.horizontalCenterOffset: 50
  26. icon: "qrc:/resources/player/next.svg"
  27. onClick: next()
  28. }
  29. PlayerControlsButton {
  30. id: _prev
  31. anchors.verticalCenter: root.verticalCenter
  32. anchors.horizontalCenter: root.horizontalCenter
  33. anchors.horizontalCenterOffset: -50
  34. icon: "qrc:/resources/player/prev.svg"
  35. onClick: prev()
  36. }
  37. PlayerControlsButton {
  38. id: _shuffle
  39. anchors.verticalCenter: root.verticalCenter
  40. anchors.horizontalCenter: root.horizontalCenter
  41. anchors.horizontalCenterOffset: -50 - 50
  42. icon: "qrc:/resources/player/shuffle.svg"
  43. style: shuffle? Style.panel.icon.accent : Style.panel.icon.normal
  44. onClick: setShuffle(!shuffle)
  45. }
  46. PlayerControlsButton {
  47. id: _loop
  48. anchors.verticalCenter: root.verticalCenter
  49. anchors.horizontalCenter: root.horizontalCenter
  50. anchors.horizontalCenterOffset: 50 + 50
  51. icon: loop == 2? "qrc:/resources/player/loop-track.svg" : "qrc:/resources/player/loop-playlist.svg"
  52. style: loop == 0? Style.panel.icon.normal : Style.panel.icon.accent
  53. onClick: setLoop((loop + 1) % 3)
  54. }
  55. }