ToolboxHeader.qml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // PluginBrowser 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. // TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
  9. import UM 1.1 as UM
  10. Rectangle {
  11. width: parent.width
  12. color: "transparent"
  13. height: childrenRect.height
  14. Row
  15. {
  16. spacing: 12
  17. height: childrenRect.height
  18. width: childrenRect.width
  19. anchors.left: parent.left
  20. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  21. Button
  22. {
  23. text: "Plugins"
  24. style: ButtonStyle
  25. {
  26. background: Rectangle
  27. {
  28. color: "transparent"
  29. implicitWidth: 96
  30. implicitHeight: 48
  31. Rectangle
  32. {
  33. visible: manager.currentView == "plugins"
  34. color: UM.Theme.getColor("primary")
  35. anchors.bottom: parent.bottom
  36. width: parent.width
  37. height: 3
  38. }
  39. }
  40. label: Text
  41. {
  42. text: control.text
  43. color: UM.Theme.getColor("text")
  44. font.pixelSize: 15
  45. verticalAlignment: Text.AlignVCenter
  46. horizontalAlignment: Text.AlignHCenter
  47. }
  48. }
  49. onClicked:
  50. {
  51. manager.filterPackagesByType("plugin")
  52. manager.currentView = "plugins"
  53. manager.detailView = ""
  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: manager.currentView == "materials"
  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. manager.filterPackagesByType("material")
  87. manager.currentView = "materials"
  88. manager.detailView = ""
  89. }
  90. }
  91. }
  92. Button
  93. {
  94. text: "Installed"
  95. anchors.right: parent.right
  96. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  97. style: ButtonStyle
  98. {
  99. background: Rectangle
  100. {
  101. color: "transparent"
  102. implicitWidth: 96
  103. implicitHeight: 48
  104. Rectangle {
  105. visible: manager.currentView == "installed"
  106. color: UM.Theme.getColor("primary")
  107. anchors.bottom: parent.bottom
  108. width: parent.width
  109. height: 3
  110. }
  111. }
  112. label: Text
  113. {
  114. text: control.text
  115. color: UM.Theme.getColor("text")
  116. font.pixelSize: 15
  117. verticalAlignment: Text.AlignVCenter
  118. horizontalAlignment: Text.AlignHCenter
  119. }
  120. }
  121. onClicked: manager.currentView = "installed"
  122. }
  123. }