ApplicationSwitcher.qml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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: Math.round(0.5 * UM.Theme.getSize("main_window_header").height)
  12. height: width
  13. Button
  14. {
  15. id: applicationSwitcherButton
  16. anchors.fill: parent
  17. background: Item
  18. {
  19. Rectangle
  20. {
  21. anchors.fill: parent
  22. radius: UM.Theme.getSize("action_button_radius").width
  23. color: applicationSwitcherButton.hovered ? UM.Theme.getColor("primary_text") : "transparent"
  24. opacity: applicationSwitcherButton.hovered ? 0.2 : 0
  25. }
  26. UM.RecolorImage
  27. {
  28. anchors.fill: parent
  29. color: UM.Theme.getColor("primary_text")
  30. source: UM.Theme.getIcon("BlockGrid")
  31. }
  32. }
  33. onClicked:
  34. {
  35. if (applicationSwitcherPopup.opened)
  36. {
  37. applicationSwitcherPopup.close()
  38. } else {
  39. applicationSwitcherPopup.open()
  40. }
  41. }
  42. }
  43. Popup
  44. {
  45. id: applicationSwitcherPopup
  46. y: parent.height + UM.Theme.getSize("default_arrow").height
  47. // Move the x position by the default margin so that the arrow isn't drawn exactly on the corner
  48. x: parent.width - width + UM.Theme.getSize("default_margin").width
  49. closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
  50. opacity: opened ? 1 : 0
  51. Behavior on opacity { NumberAnimation { duration: 100 } }
  52. padding: 0
  53. width: contentWidth + 2 * UM.Theme.getSize("wide_margin").width
  54. height: contentHeight + 2 * UM.Theme.getSize("wide_margin").width
  55. contentItem: Item
  56. {
  57. id: applicationsContainer
  58. anchors.fill: parent
  59. anchors.margins: UM.Theme.getSize("wide_margin").width
  60. Column
  61. {
  62. id: contentsColumn
  63. anchors.top: parent.top
  64. anchors.left: parent.left
  65. width: ultimakerPlatformLinksGrid.width
  66. Grid
  67. {
  68. id: ultimakerPlatformLinksGrid
  69. columns: 3
  70. spacing: UM.Theme.getSize("default_margin").width
  71. Repeater
  72. {
  73. model:
  74. [
  75. {
  76. displayName: catalog.i18nc("@label:button", "My printers"),
  77. thumbnail: UM.Theme.getIcon("PrinterTriple", "high"),
  78. description: catalog.i18nc("@tooltip:button", "Manage your printers in the Digital Factory."),
  79. link: "https://digitalfactory.ultimaker.com/app/printers?utm_source=cura&utm_medium=software&utm_campaign=switcher-digital-factory-printers"
  80. },
  81. {
  82. displayName: "Digital Library", //Not translated, since it's a brand name.
  83. thumbnail: UM.Theme.getIcon("Library", "high"),
  84. description: catalog.i18nc("@tooltip:button", "Manage your files in the Digital Library."),
  85. link: "https://digitalfactory.ultimaker.com/app/library?utm_source=cura&utm_medium=software&utm_campaign=switcher-library"
  86. },
  87. {
  88. displayName: catalog.i18nc("@label:button", "Print jobs"),
  89. thumbnail: UM.Theme.getIcon("FoodBeverages"),
  90. description: catalog.i18nc("@tooltip:button", "Manage things that are being printed."),
  91. link: "https://digitalfactory.ultimaker.com/app/print-jobs?utm_source=cura&utm_medium=software&utm_campaign=switcher-digital-factory- printjobs"
  92. },
  93. {
  94. displayName: "Ultimaker Marketplace", //Not translated, since it's a brand name.
  95. thumbnail: UM.Theme.getIcon("Shop", "high"),
  96. description: catalog.i18nc("@tooltip:button", "Extend Ultimaker Cura with new plug-ins and profiles."),
  97. link: "https://marketplace.ultimaker.com/?utm_source=cura&utm_medium=software&utm_campaign=switcher-marketplace-materials"
  98. },
  99. {
  100. displayName: "Ultimaker Academy", //Not translated, since it's a brand name.
  101. thumbnail: UM.Theme.getIcon("Knowledge"),
  102. description: catalog.i18nc("@tooltip:button", "Become an expert in 3D printing."),
  103. link: "https://academy.ultimaker.com/?utm_source=cura&utm_medium=software&utm_campaign=switcher-academy"
  104. },
  105. {
  106. displayName: catalog.i18nc("@label:button", "Ultimaker support"),
  107. thumbnail: UM.Theme.getIcon("Help", "high"),
  108. description: catalog.i18nc("@tooltip:button", "Get help with how to use Ultimaker Cura."),
  109. link: "https://support.ultimaker.com/?utm_source=cura&utm_medium=software&utm_campaign=switcher-support"
  110. },
  111. {
  112. displayName: catalog.i18nc("@label:button", "Ask a question"),
  113. thumbnail: UM.Theme.getIcon("Speak", "high"),
  114. description: catalog.i18nc("@tooltip:button", "Consult the Ultimaker community."),
  115. link: "https://community.ultimaker.com/?utm_source=cura&utm_medium=software&utm_campaign=switcher-community"
  116. },
  117. {
  118. displayName: catalog.i18nc("@label:button", "Report a bug"),
  119. thumbnail: UM.Theme.getIcon("Bug", "high"),
  120. description: catalog.i18nc("@tooltip:button", "Notify the developers that something is going wrong."),
  121. link: "https://github.com/Ultimaker/Cura/issues/new/choose"
  122. },
  123. {
  124. displayName: "Ultimaker.com", //Not translated, since it's a URL.
  125. thumbnail: UM.Theme.getIcon("Browser"),
  126. description: catalog.i18nc("@tooltip:button", "Visit Ultimaker's website."),
  127. link: "https://ultimaker.com/?utm_source=cura&utm_medium=software&utm_campaign=switcher-umwebsite"
  128. }
  129. ]
  130. delegate: ApplicationButton
  131. {
  132. displayName: modelData.displayName
  133. iconSource: modelData.thumbnail
  134. tooltipText: modelData.description
  135. isExternalLink: true
  136. onClicked: Qt.openUrlExternally(modelData.link)
  137. }
  138. }
  139. }
  140. }
  141. }
  142. background: UM.PointingRectangle
  143. {
  144. color: UM.Theme.getColor("tool_panel_background")
  145. borderColor: UM.Theme.getColor("lining")
  146. borderWidth: UM.Theme.getSize("default_lining").width
  147. // Move the target by the default margin so that the arrow isn't drawn exactly on the corner
  148. target: Qt.point(width - UM.Theme.getSize("default_margin").width - (applicationSwitcherButton.width / 2), -10)
  149. arrowSize: UM.Theme.getSize("default_arrow").width
  150. }
  151. }
  152. }