WizardPanel.qml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: UM.Theme.getSize("progressbar").height
  44. value: base.progressValue
  45. }
  46. Loader
  47. {
  48. id: contentLoader
  49. anchors
  50. {
  51. margins: UM.Theme.getSize("wide_margin").width
  52. bottomMargin: UM.Theme.getSize("default_margin").width
  53. top: progressBar.bottom
  54. bottom: parent.bottom
  55. left: parent.left
  56. right: parent.right
  57. }
  58. source: base.pageUrl
  59. active: base.visible
  60. }
  61. }
  62. }