PrepareMenu.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. // Item to ensure that all of the buttons are nicely centered.
  18. Item
  19. {
  20. anchors.horizontalCenter: parent.horizontalCenter
  21. width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width
  22. height: parent.height
  23. RowLayout
  24. {
  25. id: itemRow
  26. anchors.left: openFileButton.right
  27. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  28. width: Math.round(0.9 * prepareMenu.width)
  29. height: parent.height
  30. spacing: 0
  31. Cura.MachineSelector
  32. {
  33. id: machineSelection
  34. headerCornerSide: Cura.RoundedRectangle.Direction.Left
  35. Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width
  36. Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width
  37. Layout.fillWidth: true
  38. Layout.fillHeight: true
  39. }
  40. // Separator line
  41. Rectangle
  42. {
  43. height: parent.height
  44. width: UM.Theme.getSize("default_lining").width
  45. color: UM.Theme.getColor("lining")
  46. }
  47. Cura.ConfigurationMenu
  48. {
  49. id: printerSetup
  50. Layout.fillHeight: true
  51. Layout.fillWidth: true
  52. Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width
  53. }
  54. // Separator line
  55. Rectangle
  56. {
  57. height: parent.height
  58. width: UM.Theme.getSize("default_lining").width
  59. color: UM.Theme.getColor("lining")
  60. }
  61. Item
  62. {
  63. id: printSetupSelectorItem
  64. // This is a work around to prevent the printSetupSelector from having to be re-loaded every time
  65. // a stage switch is done.
  66. children: [printSetupSelector]
  67. height: childrenRect.height
  68. width: childrenRect.width
  69. }
  70. }
  71. Button
  72. {
  73. id: openFileButton
  74. height: UM.Theme.getSize("stage_menu").height
  75. width: UM.Theme.getSize("stage_menu").height
  76. onClicked: Cura.Actions.open.trigger()
  77. hoverEnabled: true
  78. contentItem: Item
  79. {
  80. anchors.fill: parent
  81. UM.RecolorImage
  82. {
  83. id: buttonIcon
  84. anchors.centerIn: parent
  85. source: UM.Theme.getIcon("load")
  86. width: UM.Theme.getSize("button_icon").width
  87. height: UM.Theme.getSize("button_icon").height
  88. color: UM.Theme.getColor("icon")
  89. sourceSize.height: height
  90. }
  91. }
  92. background: Rectangle
  93. {
  94. id: background
  95. height: UM.Theme.getSize("stage_menu").height
  96. width: UM.Theme.getSize("stage_menu").height
  97. radius: UM.Theme.getSize("default_radius").width
  98. color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
  99. }
  100. DropShadow
  101. {
  102. id: shadow
  103. // Don't blur the shadow
  104. radius: 0
  105. anchors.fill: background
  106. source: background
  107. verticalOffset: 2
  108. visible: true
  109. color: UM.Theme.getColor("action_button_shadow")
  110. // Should always be drawn behind the background.
  111. z: background.z - 1
  112. }
  113. }
  114. }
  115. }