FirstStartMachineActionsContent.qml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. 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.topMargin: UM.Theme.getSize("welcome_pages_default_margin").height
  36. anchors.horizontalCenter: parent.horizontalCenter
  37. horizontalAlignment: Text.AlignHCenter
  38. text: machineActionsModel.currentItem.title == undefined ? "" : machineActionsModel.currentItem.title
  39. color: UM.Theme.getColor("primary_button")
  40. font: UM.Theme.getFont("large_bold")
  41. renderType: Text.NativeRendering
  42. }
  43. Item
  44. {
  45. anchors.top: titleLabel.bottom
  46. anchors.bottom: nextButton.top
  47. anchors.margins: UM.Theme.getSize("default_margin").width
  48. anchors.left: parent.left
  49. anchors.right: parent.right
  50. data: machineActionsModel.currentItem.content == undefined ? emptyItem : machineActionsModel.currentItem.content
  51. }
  52. // An empty item in case there's no currentItem.content to show
  53. Item
  54. {
  55. id: emptyItem
  56. }
  57. Cura.PrimaryButton
  58. {
  59. id: nextButton
  60. anchors.right: parent.right
  61. anchors.bottom: parent.bottom
  62. anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
  63. text: catalog.i18nc("@button", "Next")
  64. onClicked: machineActionsModel.goToNextAction()
  65. }
  66. }