PrepareMenu.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. Item
  9. {
  10. id: prepareMenu
  11. UM.I18nCatalog
  12. {
  13. id: catalog
  14. name: "cura"
  15. }
  16. anchors
  17. {
  18. left: parent.left
  19. right: parent.right
  20. leftMargin: UM.Theme.getSize("wide_margin").width
  21. rightMargin: UM.Theme.getSize("wide_margin").width
  22. }
  23. // Item to ensure that all of the buttons are nicely centered.
  24. Item
  25. {
  26. anchors.horizontalCenter: parent.horizontalCenter
  27. width: parent.width - 2 * UM.Theme.getSize("wide_margin").width
  28. height: parent.height
  29. RowLayout
  30. {
  31. id: itemRow
  32. anchors.left: openFileButton.right
  33. anchors.right: parent.right
  34. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  35. property int machineSelectorWidth: Math.round((width - printSetupSelectorItem.width) / 3)
  36. height: parent.height
  37. // This is a trick to make sure that the borders of the two adjacent buttons' borders overlap. Otherwise
  38. // there will be double border (one from each button)
  39. spacing: -UM.Theme.getSize("default_lining").width
  40. Cura.MachineSelector
  41. {
  42. id: machineSelection
  43. headerCornerSide: Cura.RoundedRectangle.Direction.Left
  44. headerBackgroundBorder.width: UM.Theme.getSize("default_lining").width
  45. headerBackgroundBorder.color: UM.Theme.getColor("lining")
  46. enableHeaderShadow: false
  47. Layout.preferredWidth: parent.machineSelectorWidth
  48. Layout.fillWidth: true
  49. Layout.fillHeight: true
  50. }
  51. Cura.ConfigurationMenu
  52. {
  53. id: printerSetup
  54. enableHeaderShadow: false
  55. headerBackgroundBorder.width: UM.Theme.getSize("default_lining").width
  56. headerBackgroundBorder.color: UM.Theme.getColor("lining")
  57. Layout.fillHeight: true
  58. Layout.fillWidth: true
  59. Layout.preferredWidth: parent.machineSelectorWidth * 2
  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("Folder")
  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. border.color: UM.Theme.getColor("lining")
  98. border.width: UM.Theme.getSize("default_lining").width
  99. radius: UM.Theme.getSize("default_radius").width
  100. color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
  101. }
  102. }
  103. }
  104. }