Marketplace.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // Copyright (c) 2021 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.15
  4. import QtQuick.Controls 2.15
  5. import QtQuick.Layouts 1.15
  6. import QtQuick.Window 2.2
  7. import UM 1.2 as UM
  8. import Cura 1.6 as Cura
  9. Window
  10. {
  11. id: marketplaceDialog
  12. property variant catalog: UM.I18nCatalog { name: "cura" }
  13. minimumWidth: UM.Theme.getSize("modal_window_minimum").width
  14. minimumHeight: UM.Theme.getSize("modal_window_minimum").height
  15. width: minimumWidth
  16. height: minimumHeight
  17. // Set and unset the content. No need to keep things in memory if it's not visible.
  18. onVisibleChanged: content.source = visible ? "Plugins.qml" : ""
  19. Connections
  20. {
  21. target: Cura.API.account
  22. function onLoginStateChanged()
  23. {
  24. close();
  25. }
  26. }
  27. title: "Marketplace" //Seen by Ultimaker as a brand name, so this doesn't get translated.
  28. modality: Qt.NonModal
  29. // Background color
  30. Rectangle
  31. {
  32. anchors.fill: parent
  33. color: UM.Theme.getColor("main_background")
  34. ColumnLayout
  35. {
  36. anchors.fill: parent
  37. spacing: UM.Theme.getSize("default_margin").height
  38. // Page title.
  39. Item
  40. {
  41. Layout.preferredWidth: parent.width
  42. Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
  43. Label
  44. {
  45. id: pageTitle
  46. anchors
  47. {
  48. left: parent.left
  49. leftMargin: UM.Theme.getSize("default_margin").width
  50. right: parent.right
  51. rightMargin: UM.Theme.getSize("default_margin").width
  52. bottom: parent.bottom
  53. }
  54. font: UM.Theme.getFont("large")
  55. color: UM.Theme.getColor("text")
  56. text: ""
  57. }
  58. }
  59. Item
  60. {
  61. Layout.preferredWidth: parent.width
  62. Layout.preferredHeight: childrenRect.height
  63. ManagePackagesButton
  64. {
  65. id: managePackagesButton
  66. anchors.right: parent.right
  67. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  68. onClicked:
  69. {
  70. content.source = "ManagedPackages.qml"
  71. }
  72. }
  73. // Page selection.
  74. TabBar
  75. {
  76. id: pageSelectionTabBar
  77. anchors.right: managePackagesButton.left
  78. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  79. spacing: 0
  80. PackageTypeTab
  81. {
  82. width: implicitWidth
  83. text: catalog.i18nc("@button", "Plug-ins")
  84. onClicked: content.source = "Plugins.qml"
  85. }
  86. PackageTypeTab
  87. {
  88. width: implicitWidth
  89. text: catalog.i18nc("@button", "Materials")
  90. onClicked: content.source = "Materials.qml"
  91. }
  92. }
  93. }
  94. // Page contents.
  95. Rectangle
  96. {
  97. Layout.preferredWidth: parent.width
  98. Layout.fillHeight: true
  99. color: UM.Theme.getColor("detail_background")
  100. // Page contents.
  101. Loader
  102. {
  103. id: content
  104. anchors.fill: parent
  105. anchors.margins: UM.Theme.getSize("default_margin").width
  106. source: "Plugins.qml"
  107. Connections
  108. {
  109. target: content
  110. function onLoaded()
  111. {
  112. pageTitle.text = content.item.pageTitle
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }
  119. }