ToolboxHeader.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.Dialogs 1.1
  5. import QtQuick.Window 2.2
  6. import QtQuick.Controls 1.4
  7. import QtQuick.Controls.Styles 1.4
  8. import UM 1.1 as UM
  9. Rectangle {
  10. width: parent.width
  11. color: "transparent"
  12. height: childrenRect.height
  13. Row
  14. {
  15. spacing: 12
  16. height: childrenRect.height
  17. width: childrenRect.width
  18. anchors.left: parent.left
  19. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  20. Button
  21. {
  22. text: "Plugins"
  23. style: ButtonStyle
  24. {
  25. background: Rectangle
  26. {
  27. color: "transparent"
  28. implicitWidth: 96
  29. implicitHeight: 48
  30. Rectangle
  31. {
  32. visible: toolbox.viewCategory == "plugin"
  33. color: UM.Theme.getColor("primary")
  34. anchors.bottom: parent.bottom
  35. width: parent.width
  36. height: 3
  37. }
  38. }
  39. label: Text
  40. {
  41. text: control.text
  42. color: UM.Theme.getColor("text")
  43. font.pixelSize: 15
  44. verticalAlignment: Text.AlignVCenter
  45. horizontalAlignment: Text.AlignHCenter
  46. }
  47. }
  48. onClicked:
  49. {
  50. toolbox.filterModelByProp("packages", "type", "plugin")
  51. toolbox.filterModelByProp("authors", "type", "plugin")
  52. toolbox.viewCategory = "plugin"
  53. toolbox.viewPage = "overview"
  54. }
  55. }
  56. Button
  57. {
  58. text: "Materials"
  59. style: ButtonStyle
  60. {
  61. background: Rectangle
  62. {
  63. color: "transparent"
  64. implicitWidth: 96
  65. implicitHeight: 48
  66. Rectangle
  67. {
  68. visible: toolbox.viewCategory == "material"
  69. color: UM.Theme.getColor("primary")
  70. anchors.bottom: parent.bottom
  71. width: parent.width
  72. height: 3
  73. }
  74. }
  75. label: Text
  76. {
  77. text: control.text
  78. color: UM.Theme.getColor("text")
  79. font.pixelSize: 15
  80. verticalAlignment: Text.AlignVCenter
  81. horizontalAlignment: Text.AlignHCenter
  82. }
  83. }
  84. onClicked:
  85. {
  86. toolbox.filterModelByProp("packages", "type", "material")
  87. toolbox.filterModelByProp("authors", "type", "material")
  88. toolbox.viewCategory = "material"
  89. toolbox.viewPage = "overview"
  90. }
  91. }
  92. }
  93. Button
  94. {
  95. text: "Installed"
  96. anchors.right: parent.right
  97. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  98. style: ButtonStyle
  99. {
  100. background: Rectangle
  101. {
  102. color: "transparent"
  103. implicitWidth: 96
  104. implicitHeight: 48
  105. Rectangle {
  106. visible: toolbox.viewCategory == "installed"
  107. color: UM.Theme.getColor("primary")
  108. anchors.bottom: parent.bottom
  109. width: parent.width
  110. height: 3
  111. }
  112. }
  113. label: Text
  114. {
  115. text: control.text
  116. color: UM.Theme.getColor("text")
  117. font.pixelSize: 15
  118. verticalAlignment: Text.AlignVCenter
  119. horizontalAlignment: Text.AlignHCenter
  120. }
  121. }
  122. onClicked: toolbox.viewCategory = "installed"
  123. }
  124. }