PrepareMenu.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. Layout.fillHeight: true
  50. Layout.fillWidth: true
  51. Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width
  52. }
  53. // Separator line
  54. Rectangle
  55. {
  56. height: parent.height
  57. width: UM.Theme.getSize("default_lining").width
  58. color: UM.Theme.getColor("lining")
  59. }
  60. Item
  61. {
  62. id: printSetupSelectorItem
  63. // This is a work around to prevent the printSetupSelector from having to be re-loaded every time
  64. // a stage switch is done.
  65. children: [printSetupSelector]
  66. height: childrenRect.height
  67. width: childrenRect.width
  68. }
  69. }
  70. Button
  71. {
  72. id: openFileButton
  73. height: UM.Theme.getSize("stage_menu").height
  74. width: UM.Theme.getSize("stage_menu").height
  75. onClicked: Cura.Actions.open.trigger()
  76. hoverEnabled: true
  77. contentItem: Item
  78. {
  79. anchors.fill: parent
  80. UM.RecolorImage
  81. {
  82. id: buttonIcon
  83. anchors.centerIn: parent
  84. source: UM.Theme.getIcon("load")
  85. width: UM.Theme.getSize("button_icon").width
  86. height: UM.Theme.getSize("button_icon").height
  87. color: UM.Theme.getColor("icon")
  88. sourceSize.height: height
  89. }
  90. }
  91. background: Rectangle
  92. {
  93. id: background
  94. height: UM.Theme.getSize("stage_menu").height
  95. width: UM.Theme.getSize("stage_menu").height
  96. radius: UM.Theme.getSize("default_radius").width
  97. color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
  98. }
  99. DropShadow
  100. {
  101. id: shadow
  102. // Don't blur the shadow
  103. radius: 0
  104. anchors.fill: background
  105. source: background
  106. verticalOffset: 2
  107. visible: true
  108. color: UM.Theme.getColor("action_button_shadow")
  109. // Should always be drawn behind the background.
  110. z: background.z - 1
  111. }
  112. }
  113. }
  114. }