Toolbox.qml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox is released under the terms of the LGPLv3 or higher.
  3. // Main window for the Toolbox
  4. import QtQuick 2.2
  5. import QtQuick.Dialogs 1.1
  6. import QtQuick.Window 2.2
  7. import UM 1.1 as UM
  8. Window
  9. {
  10. id: base
  11. property var selection: null
  12. title: catalog.i18nc("@title", "Marketplace")
  13. modality: Qt.ApplicationModal
  14. flags: Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowCloseButtonHint
  15. width: Math.floor(720 * screenScaleFactor)
  16. height: Math.floor(640 * screenScaleFactor)
  17. minimumWidth: width
  18. maximumWidth: minimumWidth
  19. minimumHeight: height
  20. maximumHeight: minimumHeight
  21. color: UM.Theme.getColor("main_background")
  22. UM.I18nCatalog
  23. {
  24. id: catalog
  25. name: "cura"
  26. }
  27. Item
  28. {
  29. anchors.fill: parent
  30. WelcomePage
  31. {
  32. visible: toolbox.viewPage === "welcome"
  33. }
  34. ToolboxHeader
  35. {
  36. id: header
  37. visible: toolbox.viewPage !== "welcome"
  38. }
  39. Item
  40. {
  41. id: mainView
  42. width: parent.width
  43. z: parent.z - 1
  44. anchors
  45. {
  46. top: header.bottom
  47. bottom: footer.top
  48. }
  49. // TODO: This could be improved using viewFilter instead of viewCategory
  50. ToolboxLoadingPage
  51. {
  52. id: viewLoading
  53. visible: toolbox.viewCategory !== "installed" && toolbox.viewPage === "loading"
  54. }
  55. ToolboxErrorPage
  56. {
  57. id: viewErrored
  58. visible: toolbox.viewCategory !== "installed" && toolbox.viewPage === "errored"
  59. }
  60. ToolboxDownloadsPage
  61. {
  62. id: viewDownloads
  63. visible: toolbox.viewCategory !== "installed" && toolbox.viewPage === "overview"
  64. }
  65. ToolboxDetailPage
  66. {
  67. id: viewDetail
  68. visible: toolbox.viewCategory !== "installed" && toolbox.viewPage === "detail"
  69. }
  70. ToolboxAuthorPage
  71. {
  72. id: viewAuthor
  73. visible: toolbox.viewCategory !== "installed" && toolbox.viewPage === "author"
  74. }
  75. ToolboxInstalledPage
  76. {
  77. id: installedPluginList
  78. visible: toolbox.viewCategory === "installed"
  79. }
  80. }
  81. ToolboxFooter
  82. {
  83. id: footer
  84. visible: toolbox.restartRequired
  85. height: visible ? UM.Theme.getSize("toolbox_footer").height : 0
  86. }
  87. // TODO: Clean this up:
  88. Connections
  89. {
  90. target: toolbox
  91. onShowLicenseDialog:
  92. {
  93. licenseDialog.pluginName = toolbox.getLicenseDialogPluginName();
  94. licenseDialog.licenseContent = toolbox.getLicenseDialogLicenseContent();
  95. licenseDialog.pluginFileLocation = toolbox.getLicenseDialogPluginFileLocation();
  96. licenseDialog.show();
  97. }
  98. }
  99. ToolboxLicenseDialog
  100. {
  101. id: licenseDialog
  102. }
  103. }
  104. }