MainWindowHeader.qml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.Controls 1.4
  5. import QtQuick.Controls.Styles 1.1
  6. import UM 1.4 as UM
  7. import Cura 1.0 as Cura
  8. import "../Account"
  9. Rectangle
  10. {
  11. id: base
  12. implicitHeight: UM.Theme.getSize("main_window_header").height
  13. implicitWidth: UM.Theme.getSize("main_window_header").width
  14. color: UM.Theme.getColor("main_window_header_background")
  15. Image
  16. {
  17. id: logo
  18. anchors.left: parent.left
  19. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  20. anchors.verticalCenter: parent.verticalCenter
  21. source: UM.Theme.getImage("logo")
  22. width: UM.Theme.getSize("logo").width
  23. height: UM.Theme.getSize("logo").height
  24. sourceSize.width: width
  25. sourceSize.height: height
  26. }
  27. Row
  28. {
  29. id: stagesListContainer
  30. spacing: Math.round(UM.Theme.getSize("default_margin").width / 2)
  31. anchors
  32. {
  33. horizontalCenter: parent.horizontalCenter
  34. verticalCenter: parent.verticalCenter
  35. leftMargin: UM.Theme.getSize("default_margin").width
  36. }
  37. // The main window header is dynamically filled with all available stages
  38. Repeater
  39. {
  40. id: stagesHeader
  41. model: UM.StageModel { }
  42. delegate: Button
  43. {
  44. text: model.name.toUpperCase()
  45. checkable: true
  46. checked: model.active
  47. anchors.verticalCenter: parent.verticalCenter
  48. exclusiveGroup: mainWindowHeaderMenuGroup
  49. style: UM.Theme.styles.main_window_header_tab
  50. height: UM.Theme.getSize("main_window_header_button").height
  51. onClicked: UM.Controller.setActiveStage(model.id)
  52. iconSource: model.stage.iconSource
  53. property color overlayColor: "transparent"
  54. property string overlayIconSource: ""
  55. }
  56. }
  57. ExclusiveGroup { id: mainWindowHeaderMenuGroup }
  58. }
  59. // Shortcut button to quick access the Toolbox
  60. Cura.ActionButton
  61. {
  62. anchors
  63. {
  64. right: accountWidget.left
  65. rightMargin: UM.Theme.getSize("default_margin").width
  66. verticalCenter: parent.verticalCenter
  67. }
  68. leftPadding: UM.Theme.getSize("default_margin").width
  69. rightPadding: UM.Theme.getSize("default_margin").width
  70. text: catalog.i18nc("@action:button", "Marketplace")
  71. height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height)
  72. color: UM.Theme.getColor("main_window_header_secondary_button_background_active")
  73. hoverColor: UM.Theme.getColor("main_window_header_secondary_button_background_hovered")
  74. outlineColor: UM.Theme.getColor("main_window_header_secondary_button_outline_active")
  75. outlineHoverColor: UM.Theme.getColor("main_window_header_secondary_button_outline_hovered")
  76. textColor: UM.Theme.getColor("main_window_header_secondary_button_text_active")
  77. textHoverColor: UM.Theme.getColor("main_window_header_secondary_button_text_hovered")
  78. onClicked: Cura.Actions.browsePackages.trigger()
  79. }
  80. AccountWidget
  81. {
  82. id: accountWidget
  83. anchors
  84. {
  85. right: parent.right
  86. rightMargin: UM.Theme.getSize("default_margin").width
  87. }
  88. }
  89. }