DownloadPanel.qml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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: 250
  8. height: 105
  9. Item {
  10. anchors.fill: parent
  11. Column {
  12. Repeater {
  13. model: ListModel {
  14. ListElement {
  15. icon: "qrc:/resources/player/open-folder.svg"
  16. title: qsTr("Show in folder")
  17. shortcut: "Ctrl+E"
  18. action: function() {
  19. Qt.openUrlExternally(PlayingTrackInfo.folder)
  20. }
  21. }
  22. ListElement {
  23. icon: "qrc:/resources/player/open-file.svg"
  24. title: qsTr("Open file")
  25. shortcut: "Ctrl+O"
  26. action: function() {
  27. Qt.openUrlExternally(PlayingTrackInfo.file)
  28. }
  29. }
  30. ListElement {
  31. icon: "qrc:/resources/player/delete.svg"
  32. title: qsTr("Delete")
  33. shortcut: "Ctrl+Delete"
  34. action: function() {
  35. PlayingTrackInfo.remove()
  36. }
  37. }
  38. }
  39. delegate: Rectangle {
  40. height: 35
  41. width: root.width
  42. color: _mouse.containsPress? Style.panel.sellection.pressedBackground : _mouse.containsMouse? Style.panel.sellection.background : "transparent"
  43. MouseArea {
  44. id: _mouse
  45. anchors.fill: parent
  46. hoverEnabled: true
  47. onClicked: {
  48. action()
  49. GlobalFocus.item = ""
  50. }
  51. }
  52. Shortcut {
  53. sequence: shortcut
  54. context: Qt.ApplicationShortcut
  55. onActivated: {
  56. action()
  57. GlobalFocus.item = ""
  58. }
  59. }
  60. Icon {
  61. id: _icon
  62. anchors.verticalCenter: parent.verticalCenter
  63. anchors.left: parent.left
  64. anchors.leftMargin: 10
  65. width: 20
  66. height: 20
  67. color: _mouse.containsMouse? Style.panel.text.sellectedColor : Style.panel.text.unsellectedColor
  68. src: icon
  69. }
  70. DText {
  71. anchors.verticalCenter: parent.verticalCenter
  72. anchors.left: _icon.right
  73. anchors.leftMargin: 10
  74. color: _mouse.containsMouse? Style.panel.text.sellectedColor : Style.panel.text.unsellectedColor
  75. text: title
  76. }
  77. DText {
  78. anchors.verticalCenter: parent.verticalCenter
  79. anchors.right: parent.right
  80. anchors.rightMargin: 10
  81. color: Style.panel.text.darkColor
  82. text: shortcut
  83. }
  84. }
  85. }
  86. }
  87. layer.enabled: true
  88. layer.effect: OpacityMask {
  89. maskSource: Item {
  90. width: root.width
  91. height: root.height
  92. Rectangle {
  93. anchors.fill: parent
  94. radius: Style.panel.sellection.radius
  95. }
  96. }
  97. }
  98. }
  99. }