TopHeader.qml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.1
  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("topheader").height
  13. implicitWidth: UM.Theme.getSize("topheader").width
  14. color: UM.Theme.getColor("topheader_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. anchors
  31. {
  32. horizontalCenter: parent.horizontalCenter
  33. leftMargin: UM.Theme.getSize("default_margin").width
  34. }
  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.toUpperCase()
  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. anchors
  61. {
  62. right: accountWidget.left
  63. rightMargin: UM.Theme.getSize("default_margin").width
  64. verticalCenter: parent.verticalCenter
  65. }
  66. style: ButtonStyle
  67. {
  68. background: Rectangle
  69. {
  70. color: control.hovered ? UM.Theme.getColor("secondary") : UM.Theme.getColor("topheader_button_background_active")
  71. radius: 2 * screenScaleFactor
  72. }
  73. label: Label
  74. {
  75. text: catalog.i18nc("@action:button", "Toolbox")
  76. color: UM.Theme.getColor("topheader_button_text_active")
  77. font: UM.Theme.getFont("action_button")
  78. renderType: Text.NativeRendering
  79. anchors.verticalCenter: control.verticalCenter
  80. }
  81. }
  82. action: Cura.Actions.browsePackages
  83. }
  84. AccountWidget
  85. {
  86. id: accountWidget
  87. anchors
  88. {
  89. right: parent.right
  90. rightMargin: UM.Theme.getSize("default_margin").width
  91. }
  92. }
  93. }