ToolboxHeader.qml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. id: pluginsTabButton
  25. text: catalog.i18nc("@title:tab", "Plugins")
  26. active: toolbox.viewCategory == "plugin" && enabled
  27. enabled: !toolbox.isDownloading && toolbox.viewPage != "loading" && toolbox.viewPage != "errored"
  28. onClicked:
  29. {
  30. toolbox.filterModelByProp("packages", "type", "plugin")
  31. toolbox.viewCategory = "plugin"
  32. toolbox.viewPage = "overview"
  33. }
  34. }
  35. ToolboxTabButton
  36. {
  37. id: materialsTabButton
  38. text: catalog.i18nc("@title:tab", "Materials")
  39. active: toolbox.viewCategory == "material" && enabled
  40. enabled: !toolbox.isDownloading && toolbox.viewPage != "loading" && toolbox.viewPage != "errored"
  41. onClicked:
  42. {
  43. toolbox.filterModelByProp("authors", "package_types", "material")
  44. toolbox.viewCategory = "material"
  45. toolbox.viewPage = "overview"
  46. }
  47. }
  48. }
  49. ToolboxTabButton
  50. {
  51. id: installedTabButton
  52. text: catalog.i18nc("@title:tab", "Installed")
  53. active: toolbox.viewCategory == "installed"
  54. enabled: !toolbox.isDownloading
  55. anchors
  56. {
  57. right: parent.right
  58. rightMargin: UM.Theme.getSize("default_margin").width
  59. }
  60. onClicked: toolbox.viewCategory = "installed"
  61. }
  62. ToolboxShadow
  63. {
  64. anchors.top: bar.bottom
  65. }
  66. }