PrepareMenu.qml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Layouts 1.1
  5. import QtQuick.Controls 2.3
  6. import UM 1.3 as UM
  7. import Cura 1.1 as Cura
  8. import QtGraphicalEffects 1.0 // For the dropshadow
  9. Item
  10. {
  11. id: prepareMenu
  12. UM.I18nCatalog
  13. {
  14. id: catalog
  15. name: "cura"
  16. }
  17. anchors
  18. {
  19. left: parent.left
  20. right: parent.right
  21. leftMargin: UM.Theme.getSize("wide_margin").width
  22. rightMargin: UM.Theme.getSize("wide_margin").width
  23. }
  24. // Item to ensure that all of the buttons are nicely centered.
  25. Item
  26. {
  27. anchors.horizontalCenter: parent.horizontalCenter
  28. width: parent.width - 2 * UM.Theme.getSize("wide_margin").width
  29. height: parent.height
  30. RowLayout
  31. {
  32. id: itemRow
  33. anchors.left: openFileButton.right
  34. anchors.right: parent.right
  35. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  36. height: parent.height
  37. spacing: 0
  38. Cura.MachineSelector
  39. {
  40. id: machineSelection
  41. headerCornerSide: Cura.RoundedRectangle.Direction.Left
  42. Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width
  43. Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width
  44. Layout.fillWidth: true
  45. Layout.fillHeight: true
  46. }
  47. // Separator line
  48. Rectangle
  49. {
  50. height: parent.height
  51. width: UM.Theme.getSize("default_lining").width
  52. color: UM.Theme.getColor("lining")
  53. }
  54. Cura.ConfigurationMenu
  55. {
  56. id: printerSetup
  57. Layout.fillHeight: true
  58. Layout.fillWidth: true
  59. Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width
  60. }
  61. // Separator line
  62. Rectangle
  63. {
  64. height: parent.height
  65. width: UM.Theme.getSize("default_lining").width
  66. color: UM.Theme.getColor("lining")
  67. }
  68. Item
  69. {
  70. id: printSetupSelectorItem
  71. // This is a work around to prevent the printSetupSelector from having to be re-loaded every time
  72. // a stage switch is done.
  73. children: [printSetupSelector]
  74. height: childrenRect.height
  75. width: childrenRect.width
  76. }
  77. }
  78. Button
  79. {
  80. id: openFileButton
  81. height: UM.Theme.getSize("stage_menu").height
  82. width: UM.Theme.getSize("stage_menu").height
  83. onClicked: Cura.Actions.open.trigger()
  84. hoverEnabled: true
  85. contentItem: Item
  86. {
  87. anchors.fill: parent
  88. UM.RecolorImage
  89. {
  90. id: buttonIcon
  91. anchors.centerIn: parent
  92. source: UM.Theme.getIcon("load")
  93. width: UM.Theme.getSize("button_icon").width
  94. height: UM.Theme.getSize("button_icon").height
  95. color: UM.Theme.getColor("icon")
  96. sourceSize.height: height
  97. }
  98. }
  99. background: Rectangle
  100. {
  101. id: background
  102. height: UM.Theme.getSize("stage_menu").height
  103. width: UM.Theme.getSize("stage_menu").height
  104. radius: UM.Theme.getSize("default_radius").width
  105. color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
  106. }
  107. DropShadow
  108. {
  109. id: shadow
  110. // Don't blur the shadow
  111. radius: 0
  112. anchors.fill: background
  113. source: background
  114. verticalOffset: 2
  115. visible: true
  116. color: UM.Theme.getColor("action_button_shadow")
  117. // Should always be drawn behind the background.
  118. z: background.z - 1
  119. }
  120. }
  121. }
  122. }