ToolboxHeader.qml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.4
  5. import UM 1.1 as UM
  6. Item
  7. {
  8. id: header
  9. width: parent.width
  10. height: UM.Theme.getSize("toolbox_header").height
  11. Row
  12. {
  13. id: bar
  14. spacing: UM.Theme.getSize("default_margin").width
  15. height: childrenRect.height
  16. width: childrenRect.width
  17. anchors
  18. {
  19. left: parent.left
  20. leftMargin: UM.Theme.getSize("default_margin").width
  21. }
  22. ToolboxTabButton
  23. {
  24. text: catalog.i18nc("@title:tab", "Plugins")
  25. active: toolbox.viewCategory == "plugin" && enabled
  26. enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored"
  27. onClicked:
  28. {
  29. toolbox.filterModelByProp("packages", "type", "plugin")
  30. toolbox.viewCategory = "plugin"
  31. toolbox.viewPage = "overview"
  32. }
  33. }
  34. ToolboxTabButton
  35. {
  36. text: catalog.i18nc("@title:tab", "Materials")
  37. active: toolbox.viewCategory == "material" && enabled
  38. enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored"
  39. onClicked:
  40. {
  41. toolbox.filterModelByProp("authors", "package_types", "material")
  42. toolbox.viewCategory = "material"
  43. toolbox.viewPage = "overview"
  44. }
  45. }
  46. }
  47. ToolboxTabButton
  48. {
  49. text: catalog.i18nc("@title:tab", "Installed")
  50. active: toolbox.viewCategory == "installed"
  51. anchors
  52. {
  53. right: parent.right
  54. rightMargin: UM.Theme.getSize("default_margin").width
  55. }
  56. onClicked: toolbox.viewCategory = "installed"
  57. }
  58. ToolboxShadow
  59. {
  60. anchors.top: bar.bottom
  61. }
  62. }