WizardDialog.qml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 QtQuick.Window 2.2
  6. import UM 1.3 as UM
  7. import Cura 1.1 as Cura
  8. //
  9. // This is a dialog for showing a set of processes that's defined in a WelcomePagesModel or some other Qt ListModel with
  10. // a compatible interface.
  11. //
  12. Window
  13. {
  14. UM.I18nCatalog { id: catalog; name: "cura" }
  15. id: dialog
  16. flags: Qt.Dialog
  17. modality: Qt.ApplicationModal
  18. minimumWidth: 580 * screenScaleFactor
  19. minimumHeight: 600 * screenScaleFactor
  20. maximumWidth: minimumWidth
  21. maximumHeight: minimumHeight
  22. color: UM.Theme.getColor("main_background")
  23. property var model: null // Needs to be set by whoever is using this dialog.
  24. property alias progressBarVisible: wizardPanel.progressBarVisible
  25. property alias hasCancelButton: cancelButton.visible
  26. onVisibilityChanged:
  27. {
  28. if (visible)
  29. {
  30. model.resetState()
  31. }
  32. }
  33. WizardPanel
  34. {
  35. id: wizardPanel
  36. anchors.fill: parent
  37. model: dialog.model
  38. }
  39. // Close this dialog when there's no more page to show
  40. Connections
  41. {
  42. target: model
  43. onAllFinished: dialog.hide()
  44. }
  45. Cura.SecondaryButton
  46. {
  47. id: cancelButton
  48. text: catalog.i18nc("@button", "Cancel")
  49. visible: false
  50. anchors.left: parent.left
  51. anchors.bottom: parent.bottom
  52. anchors.margins: UM.Theme.getSize("default_margin").width
  53. enabled: true
  54. onClicked: dialog.visible = false
  55. }
  56. }