PrepareMenu.qml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import QtQuick 2.7
  2. import QtQuick.Layouts 1.1
  3. import QtQuick.Controls 1.4
  4. import UM 1.3 as UM
  5. import Cura 1.1 as Cura
  6. Item
  7. {
  8. id: prepareMenu
  9. // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
  10. signal showTooltip(Item item, point location, string text)
  11. signal hideTooltip()
  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: openFileButtonBackground.width + itemRowBackground.width
  22. height: parent.height
  23. Rectangle
  24. {
  25. id: itemRowBackground
  26. radius: UM.Theme.getSize("default_radius").width
  27. color: UM.Theme.getColor("toolbar_background")
  28. width: itemRow.width + UM.Theme.getSize("default_margin").width
  29. height: parent.height
  30. anchors.left: openFileButtonBackground.right
  31. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  32. RowLayout
  33. {
  34. id: itemRow
  35. anchors.centerIn: parent
  36. width: 0.9 * prepareMenu.width
  37. height: parent.height
  38. spacing: 0
  39. Cura.MachineSelector
  40. {
  41. id: machineSelection
  42. z: openFileButtonBackground.z - 1
  43. Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width
  44. Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width
  45. Layout.fillWidth: true
  46. Layout.fillHeight: true
  47. }
  48. // Separator line
  49. Rectangle
  50. {
  51. height: parent.height
  52. width: UM.Theme.getSize("default_lining").width
  53. color: UM.Theme.getColor("lining")
  54. }
  55. Cura.QuickConfigurationSelector
  56. {
  57. Layout.fillHeight: true
  58. Layout.fillWidth: true
  59. Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.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. Cura.PrintSetupSelector
  69. {
  70. id: printSetupSelector
  71. onShowTooltip: prepareMenu.showTooltip(item, location, text)
  72. onHideTooltip: prepareMenu.hideTooltip()
  73. Layout.minimumWidth: UM.Theme.getSize("print_setup_widget").width
  74. Layout.maximumWidth: UM.Theme.getSize("print_setup_widget").width
  75. Layout.fillWidth: true
  76. Layout.fillHeight: true
  77. }
  78. }
  79. }
  80. Rectangle
  81. {
  82. id: openFileButtonBackground
  83. height: UM.Theme.getSize("stage_menu").height
  84. width: UM.Theme.getSize("stage_menu").height
  85. radius: UM.Theme.getSize("default_radius").width
  86. color: UM.Theme.getColor("toolbar_background")
  87. Button
  88. {
  89. id: openFileButton
  90. text: catalog.i18nc("@action:button", "Open File")
  91. iconSource: UM.Theme.getIcon("load")
  92. style: UM.Theme.styles.toolbar_button
  93. tooltip: ""
  94. action: Cura.Actions.open
  95. anchors.centerIn: parent
  96. }
  97. }
  98. }
  99. }