FirstStartMachineActionsContent.qml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 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. 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. renderType: Text.NativeRendering
  41. }
  42. Item
  43. {
  44. anchors
  45. {
  46. top: titleLabel.bottom
  47. topMargin: UM.Theme.getSize("default_margin").height
  48. bottom: nextButton.top
  49. bottomMargin: UM.Theme.getSize("default_margin").height
  50. left: parent.left
  51. right: parent.right
  52. }
  53. data: machineActionsModel.currentItem.content == undefined ? emptyItem : machineActionsModel.currentItem.content
  54. }
  55. // An empty item in case there's no currentItem.content to show
  56. Item
  57. {
  58. id: emptyItem
  59. }
  60. Cura.PrimaryButton
  61. {
  62. id: nextButton
  63. anchors.right: parent.right
  64. anchors.bottom: parent.bottom
  65. text: catalog.i18nc("@button", "Next")
  66. onClicked: machineActionsModel.goToNextAction()
  67. }
  68. }