FirstStartMachineActionsContent.qml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.5 as UM
  6. import Cura 1.1 as Cura
  7. //
  8. // This component contains the content for the "What's new in Ultimaker Cura" page of the welcome on-boarding process.
  9. //
  10. Item
  11. {
  12. UM.I18nCatalog { id: catalog; name: "cura" }
  13. property var machineActionsModel: CuraApplication.getFirstStartMachineActionsModel()
  14. Component.onCompleted:
  15. {
  16. // Reset the action to start from the beginning when it is shown.
  17. machineActionsModel.reset()
  18. }
  19. // Go to the next page when all machine actions have been finished
  20. Connections
  21. {
  22. target: machineActionsModel
  23. function onAllFinished()
  24. {
  25. if (visible)
  26. {
  27. base.showNextPage()
  28. }
  29. }
  30. }
  31. UM.Label
  32. {
  33. id: titleLabel
  34. anchors.top: parent.top
  35. anchors.horizontalCenter: parent.horizontalCenter
  36. horizontalAlignment: Text.AlignHCenter
  37. text: machineActionsModel.currentItem.title == undefined ? "" : machineActionsModel.currentItem.title
  38. color: UM.Theme.getColor("primary_button")
  39. font: UM.Theme.getFont("huge")
  40. }
  41. Item
  42. {
  43. anchors
  44. {
  45. top: titleLabel.bottom
  46. topMargin: UM.Theme.getSize("default_margin").height
  47. bottom: nextButton.top
  48. bottomMargin: UM.Theme.getSize("default_margin").height
  49. left: parent.left
  50. right: parent.right
  51. }
  52. data: machineActionsModel.currentItem.content == undefined ? emptyItem : machineActionsModel.currentItem.content
  53. }
  54. // An empty item in case there's no currentItem.content to show
  55. Item
  56. {
  57. id: emptyItem
  58. }
  59. Cura.PrimaryButton
  60. {
  61. id: nextButton
  62. anchors.right: parent.right
  63. anchors.bottom: parent.bottom
  64. text: catalog.i18nc("@button", "Next")
  65. onClicked: machineActionsModel.goToNextAction()
  66. }
  67. }