TopHeader.qml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import UM 1.4 as UM
  7. import Cura 1.0 as Cura
  8. import "components"
  9. Rectangle
  10. {
  11. id: base
  12. height: UM.Theme.getSize("topheader").height
  13. color: UM.Theme.getColor("topheader_background")
  14. Image
  15. {
  16. id: logo
  17. anchors.left: parent.left
  18. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  19. anchors.verticalCenter: parent.verticalCenter
  20. source: UM.Theme.getImage("logo")
  21. width: UM.Theme.getSize("logo").width
  22. height: UM.Theme.getSize("logo").height
  23. sourceSize.width: width
  24. sourceSize.height: height
  25. }
  26. Row
  27. {
  28. id: stagesListContainer
  29. anchors
  30. {
  31. horizontalCenter: parent.horizontalCenter
  32. leftMargin: UM.Theme.getSize("default_margin").width
  33. }
  34. spacing: UM.Theme.getSize("default_margin").width
  35. // The topheader is dynamically filled with all available stages
  36. Repeater
  37. {
  38. id: stagesHeader
  39. model: UM.StageModel { }
  40. delegate: Button
  41. {
  42. text: model.name
  43. checkable: true
  44. checked: model.active
  45. exclusiveGroup: topheaderMenuGroup
  46. style: UM.Theme.styles.topheader_tab
  47. height: UM.Theme.getSize("topheader").height
  48. onClicked: UM.Controller.setActiveStage(model.id)
  49. iconSource: model.stage.iconSource
  50. property color overlayColor: "transparent"
  51. property string overlayIconSource: ""
  52. }
  53. }
  54. ExclusiveGroup { id: topheaderMenuGroup }
  55. }
  56. // Shortcut button to quick access the Toolbox
  57. Button
  58. {
  59. id: toolboxShortcutButton
  60. text: catalog.i18nc("@action:button", "Toolbox")
  61. anchors
  62. {
  63. right: accountWidget.left
  64. rightMargin: UM.Theme.getSize("default_margin").width
  65. }
  66. style: UM.Theme.styles.topheader_tab
  67. action: Cura.Actions.browsePackages
  68. }
  69. AccountWidget
  70. {
  71. id: accountWidget
  72. anchors
  73. {
  74. right: parent.right
  75. rightMargin: UM.Theme.getSize("default_margin").width
  76. }
  77. }
  78. }