TrackPanel.qml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import QtQuick 2.15
  2. import QtGraphicalEffects 1.15
  3. import DMusic 1.0
  4. import "components"
  5. FloatingPanel {
  6. id: root
  7. width: 245
  8. height: 265
  9. property PopupController ppc
  10. Item {
  11. anchors.fill: parent
  12. RoundedImage {
  13. id: _icon
  14. source: (ppc.opened || ppc.running)? PlayingTrackInfo.hqCover : ""
  15. anchors.left: parent.left
  16. anchors.top: parent.top
  17. anchors.leftMargin: 15
  18. anchors.topMargin: 15
  19. width: 180
  20. height: 180
  21. sourceSize.width: 180
  22. sourceSize.height: 180
  23. fillMode: Image.PreserveAspectCrop
  24. clip: true
  25. radius: 5
  26. MouseArea {
  27. anchors.fill: parent
  28. enabled: ppc.opened && PlayingTrackInfo.originalUrl.toString().length > 0
  29. cursorShape: enabled? Qt.PointingHandCursor : Qt.ArrowCursor
  30. onClicked: Qt.openUrlExternally(PlayingTrackInfo.originalUrl)
  31. }
  32. }
  33. Column {
  34. width: 20
  35. anchors.right: parent.right
  36. anchors.top: parent.top
  37. anchors.rightMargin: 15
  38. anchors.topMargin: 20
  39. spacing: 18
  40. PlayerControlsButton {
  41. icon: PlayingTrackInfo.liked? "qrc:/resources/player/liked.svg" : "qrc:/resources/player/like.svg"
  42. property bool value: PlayingTrackInfo.liked
  43. width: 20
  44. height: 20
  45. style: value? Style.panel.icon.accent : Style.panel.icon.normal
  46. onClick: PlayingTrackInfo.liked = !PlayingTrackInfo.liked
  47. Shortcut {
  48. sequence: "L"
  49. context: Qt.ApplicationShortcut
  50. onActivated: PlayingTrackInfo.liked = !PlayingTrackInfo.liked
  51. }
  52. }
  53. PlayerControlsButton {
  54. icon: "qrc:/resources/player/dislike.svg"
  55. property bool value: PlayingTrackInfo.disliked
  56. width: 20
  57. height: 20
  58. style: value? Style.panel.icon.accent : Style.panel.icon.normal
  59. onClick: PlayingTrackInfo.disliked = !PlayingTrackInfo.disliked
  60. Shortcut {
  61. sequence: "Ctrl+L"
  62. context: Qt.ApplicationShortcut
  63. onActivated: PlayingTrackInfo.disliked = !PlayingTrackInfo.disliked
  64. }
  65. }
  66. }
  67. layer.enabled: true
  68. layer.effect: OpacityMask {
  69. maskSource: Item {
  70. width: root.width
  71. height: root.height
  72. Rectangle {
  73. anchors.fill: parent
  74. radius: Style.panel.sellection.radius
  75. }
  76. }
  77. }
  78. }
  79. }