WizardPanel.qml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import UM 1.3 as UM
  6. import Cura 1.1 as Cura
  7. //
  8. // This item is a wizard panel that contains a progress bar at the top and a content area that's beneath the progress
  9. // bar.
  10. //
  11. Item
  12. {
  13. id: base
  14. clip: true
  15. property var currentItem: (model == null) ? null : model.getItem(model.currentPageIndex)
  16. property var model: null
  17. // Convenience properties
  18. property var progressValue: model == null ? 0 : model.currentProgress
  19. property string pageUrl: currentItem == null ? "" : currentItem.page_url
  20. property alias progressBarVisible: progressBar.visible
  21. property alias backgroundColor: panelBackground.color
  22. signal showNextPage()
  23. signal showPreviousPage()
  24. signal goToPage(string page_id) // Go to a specific page by the given page_id.
  25. signal endWizard()
  26. // Call the corresponding functions in the model
  27. onShowNextPage: model.goToNextPage()
  28. onShowPreviousPage: model.goToPreviousPage()
  29. onGoToPage: model.goToPage(page_id)
  30. onEndWizard: model.atEnd()
  31. Rectangle // Panel background
  32. {
  33. id: panelBackground
  34. anchors.fill: parent
  35. radius: UM.Theme.getSize("default_radius").width
  36. color: UM.Theme.getColor("main_background")
  37. UM.ProgressBar
  38. {
  39. id: progressBar
  40. anchors.top: parent.top
  41. anchors.left: parent.left
  42. anchors.right: parent.right
  43. height: visible ? UM.Theme.getSize("progressbar").height : 0
  44. value: base.progressValue
  45. }
  46. Loader
  47. {
  48. id: contentLoader
  49. anchors
  50. {
  51. margins: UM.Theme.getSize("wide_margin").width
  52. top: progressBar.bottom
  53. bottom: parent.bottom
  54. left: parent.left
  55. right: parent.right
  56. }
  57. source: base.pageUrl
  58. active: base.visible
  59. }
  60. }
  61. }