TopHeader.qml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 "../Account"
  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. // The topheader is dynamically filled with all available stages
  35. Repeater
  36. {
  37. id: stagesHeader
  38. model: UM.StageModel { }
  39. delegate: Button
  40. {
  41. text: model.name.toUpperCase()
  42. checkable: true
  43. checked: model.active
  44. exclusiveGroup: topheaderMenuGroup
  45. style: UM.Theme.styles.topheader_tab
  46. height: UM.Theme.getSize("topheader").height
  47. onClicked: UM.Controller.setActiveStage(model.id)
  48. iconSource: model.stage.iconSource
  49. property color overlayColor: "transparent"
  50. property string overlayIconSource: ""
  51. }
  52. }
  53. ExclusiveGroup { id: topheaderMenuGroup }
  54. }
  55. // Shortcut button to quick access the Toolbox
  56. Button
  57. {
  58. id: toolboxShortcutButton
  59. text: catalog.i18nc("@action:button", "Toolbox")
  60. anchors
  61. {
  62. right: accountWidget.left
  63. rightMargin: UM.Theme.getSize("default_margin").width
  64. }
  65. style: UM.Theme.styles.topheader_tab
  66. action: Cura.Actions.browsePackages
  67. }
  68. AccountWidget
  69. {
  70. id: accountWidget
  71. anchors
  72. {
  73. right: parent.right
  74. rightMargin: UM.Theme.getSize("default_margin").width
  75. }
  76. }
  77. }