WizardPanel.qml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 backgroundColor: panelBackground.color
  21. signal showNextPage()
  22. signal showPreviousPage()
  23. signal goToPage(string page_id) // Go to a specific page by the given page_id.
  24. signal endWizard()
  25. // Call the corresponding functions in the model
  26. onShowNextPage: model.goToNextPage()
  27. onShowPreviousPage: model.goToPreviousPage()
  28. onGoToPage: model.goToPage(page_id)
  29. onEndWizard: model.atEnd()
  30. Rectangle // Panel background
  31. {
  32. id: panelBackground
  33. anchors.fill: parent
  34. radius: UM.Theme.getSize("default_radius").width
  35. color: UM.Theme.getColor("main_background")
  36. UM.ProgressBar
  37. {
  38. id: progressBar
  39. anchors.top: parent.top
  40. anchors.left: parent.left
  41. anchors.right: parent.right
  42. height: UM.Theme.getSize("progressbar").height
  43. value: base.progressValue
  44. }
  45. Loader
  46. {
  47. id: contentLoader
  48. anchors
  49. {
  50. margins: UM.Theme.getSize("wide_margin").width
  51. bottomMargin: UM.Theme.getSize("default_margin").width
  52. top: progressBar.bottom
  53. bottom: parent.bottom
  54. left: parent.left
  55. right: parent.right
  56. }
  57. source: base.pageUrl
  58. }
  59. }
  60. }