TrackPanel.qml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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: 280
  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. id: _buttonsLeft
  35. width: 20
  36. anchors.left: _icon.right
  37. anchors.top: parent.top
  38. anchors.leftMargin: 15
  39. anchors.topMargin: 20
  40. spacing: 18
  41. PlayerControlsButton {
  42. icon: PlayingTrackInfo.liked? "qrc:/resources/player/liked.svg" : "qrc:/resources/player/like.svg"
  43. property bool value: PlayingTrackInfo.liked
  44. width: 20
  45. height: 20
  46. style: value? Style.panel.icon.accent : Style.panel.icon.normal
  47. onClick: PlayingTrackInfo.liked = !PlayingTrackInfo.liked
  48. Shortcut {
  49. sequence: "L"
  50. context: Qt.ApplicationShortcut
  51. onActivated: PlayingTrackInfo.liked = !PlayingTrackInfo.liked
  52. }
  53. }
  54. PlayerControlsButton {
  55. icon: "qrc:/resources/player/dislike.svg"
  56. property bool value: PlayingTrackInfo.disliked
  57. width: 20
  58. height: 20
  59. style: value? Style.panel.icon.accent : Style.panel.icon.normal
  60. onClick: PlayingTrackInfo.disliked = !PlayingTrackInfo.disliked
  61. Shortcut {
  62. sequence: "Ctrl+L"
  63. context: Qt.ApplicationShortcut
  64. onActivated: PlayingTrackInfo.disliked = !PlayingTrackInfo.disliked
  65. }
  66. }
  67. PlayerControlsButton {
  68. icon: "qrc:/resources/player/share.svg"
  69. width: 20
  70. height: 20
  71. style: Style.panel.icon.normal
  72. onClick: Clipboard.copyCurrentTrackPicture()
  73. Shortcut {
  74. sequence: "Ctrl+C"
  75. context: Qt.ApplicationShortcut
  76. onActivated: Clipboard.copyCurrentTrackPicture()
  77. }
  78. }
  79. }
  80. Column {
  81. id: _buttonsRight
  82. width: 20
  83. anchors.left: _buttonsLeft.right
  84. anchors.top: parent.top
  85. anchors.leftMargin: 15
  86. anchors.topMargin: 20
  87. spacing: 18
  88. PlayerControlsButton {
  89. enabled: PlayingTrackInfo.canStartYandexRadio
  90. icon: "qrc:/resources/player/radio.svg"
  91. width: 20
  92. height: 20
  93. style: Style.panel.icon.normal
  94. onClick: AudioPlayer.playRadioFromYmTrack(PlayingTrackInfo.id)
  95. Shortcut {
  96. sequence: "Ctrl+R"
  97. context: Qt.ApplicationShortcut
  98. onActivated: AudioPlayer.playRadioFromYmTrack(PlayingTrackInfo.id)
  99. }
  100. }
  101. }
  102. layer.enabled: true
  103. layer.effect: OpacityMask {
  104. maskSource: Item {
  105. width: root.width
  106. height: root.height
  107. Rectangle {
  108. anchors.fill: parent
  109. radius: Style.panel.sellection.radius
  110. }
  111. }
  112. }
  113. }
  114. }