ApplicationSwitcher.qml 7.5 KB

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