ApplicationSwitcher.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // Copyright (c) 2021 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import QtQuick.Layouts 1.15
  6. import UM 1.4 as UM
  7. import Cura 1.1 as Cura
  8. Item
  9. {
  10. id: applicationSwitcherWidget
  11. width: appSwitcherButton.width
  12. height: width
  13. Button
  14. {
  15. id: appSwitcherButton
  16. anchors.verticalCenter: parent.verticalCenter
  17. anchors.horizontalCenter: parent.horizontalCenter
  18. width: Math.round(0.5 * UM.Theme.getSize("main_window_header").height)
  19. height: width
  20. background: UM.RecolorImage
  21. {
  22. width: UM.Theme.getSize("small_button_icon").width
  23. height: width
  24. anchors.verticalCenter: appSwitcherButton.verticalCenter
  25. anchors.horizontalCenter: appSwitcherButton.horizontalCenter
  26. color: UM.Theme.getColor("main_background")
  27. source: UM.Theme.getIcon("ApplicationSwitcher")
  28. }
  29. onClicked:
  30. {
  31. if (popup.opened)
  32. {
  33. popup.close()
  34. } else {
  35. popup.open()
  36. }
  37. }
  38. }
  39. Popup
  40. {
  41. id: popup
  42. y: parent.height + UM.Theme.getSize("default_arrow").height
  43. x: parent.width - width
  44. closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
  45. opacity: opened ? 1 : 0
  46. Behavior on opacity { NumberAnimation { duration: 100 } }
  47. padding: 0
  48. width: contentWidth + 2 * UM.Theme.getSize("wide_margin").width
  49. height: contentHeight + 2 * UM.Theme.getSize("wide_margin").width
  50. contentItem: Item
  51. {
  52. id: projectListContainer
  53. anchors.fill: parent
  54. anchors.margins: UM.Theme.getSize("wide_margin").width
  55. Column
  56. {
  57. id: contentsColumn
  58. anchors.top: parent.top
  59. anchors.left: parent.left
  60. width: gridLayout.width
  61. Grid
  62. {
  63. id: gridLayout
  64. columns: 3
  65. spacing: UM.Theme.getSize("default_margin").width
  66. Repeater
  67. {
  68. id:gridgenerate
  69. model:
  70. [
  71. { displayName: "Report issue1", thumbnail: UM.Theme.getIcon("Bug"), description: "This is the description1", link: "https://github.com/Ultimaker/Cura/issues/1" },
  72. { displayName: "My printers", thumbnail: UM.Theme.getIcon("Bug"), description: "This is the description2", link: "https://github.com/Ultimaker/Cura/issues/2" },
  73. { displayName: "Ultimaker.com", thumbnail: UM.Theme.getIcon("Bug"), description: "This is the description3", link: "https://ultimaker.com" },
  74. { displayName: "Report issue4", thumbnail: UM.Theme.getIcon("Bug"), description: "This is the description4", link: "https://github.com/Ultimaker/Cura/issues/4" },
  75. { displayName: "Report issue5", thumbnail: UM.Theme.getIcon("Bug"), description: "This is the description5", link: "https://github.com/Ultimaker/Cura/issues/5" }
  76. ]
  77. delegate: ApplicationButton
  78. {
  79. displayName: modelData.displayName
  80. iconSource: modelData.thumbnail
  81. tooltipText: modelData.description
  82. isExternalLink: (index % 2 == 0)
  83. onClicked: Qt.openUrlExternally(modelData.link)
  84. }
  85. }
  86. }
  87. }
  88. }
  89. background: UM.PointingRectangle
  90. {
  91. color: UM.Theme.getColor("tool_panel_background")
  92. borderColor: UM.Theme.getColor("lining")
  93. borderWidth: UM.Theme.getSize("default_lining").width
  94. target: Qt.point(width - (appSwitcherButton.width / 2), -10)
  95. arrowSize: UM.Theme.getSize("default_arrow").width
  96. }
  97. }
  98. }