CloudContent.qml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 "Ultimaker Cloud" page of the welcome on-boarding process.
  9. //
  10. Item
  11. {
  12. UM.I18nCatalog { id: catalog; name: "cura" }
  13. property bool isLoggedIn: Cura.API.account.isLoggedIn
  14. onIsLoggedInChanged:
  15. {
  16. if(isLoggedIn)
  17. {
  18. // If the user created an account or logged in by pressing any button on this page, all the actions that
  19. // need / can be done by this page are completed, so we can just go to the next (if any).
  20. base.showNextPage()
  21. }
  22. }
  23. Label
  24. {
  25. id: titleLabel
  26. anchors.top: parent.top
  27. anchors.horizontalCenter: parent.horizontalCenter
  28. horizontalAlignment: Text.AlignHCenter
  29. text: catalog.i18nc("@label", "Ultimaker Cloud")
  30. color: UM.Theme.getColor("primary_button")
  31. font: UM.Theme.getFont("large_bold")
  32. renderType: Text.NativeRendering
  33. }
  34. // Area where the cloud contents can be put. Pictures, texts and such.
  35. Item
  36. {
  37. id: cloudContentsArea
  38. anchors
  39. {
  40. top: titleLabel.bottom
  41. bottom: finishButton.top
  42. left: parent.left
  43. right: parent.right
  44. topMargin: UM.Theme.getSize("default_margin").height
  45. }
  46. // Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in
  47. // the cloud contents area.
  48. Column
  49. {
  50. anchors.centerIn: parent
  51. width: parent.width
  52. height: childrenRect.height
  53. spacing: 20 * screenScaleFactor
  54. Image // Cloud image
  55. {
  56. id: cloudImage
  57. anchors.horizontalCenter: parent.horizontalCenter
  58. source: UM.Theme.getImage("first_run_ultimaker_cloud")
  59. }
  60. Label // A title-ish text
  61. {
  62. id: highlightTextLabel
  63. anchors.horizontalCenter: parent.horizontalCenter
  64. horizontalAlignment: Text.AlignHCenter
  65. text: catalog.i18nc("@text", "The next generation 3D printing workflow")
  66. textFormat: Text.RichText
  67. color: UM.Theme.getColor("primary")
  68. font: UM.Theme.getFont("medium")
  69. renderType: Text.NativeRendering
  70. }
  71. Label // A number of text items
  72. {
  73. id: textLabel
  74. anchors.horizontalCenter: parent.horizontalCenter
  75. text:
  76. {
  77. // There are 3 text items, each of which is translated separately as a single piece of text.
  78. var full_text = ""
  79. var t = ""
  80. t = catalog.i18nc("@text", "- Send print jobs to Ultimaker printers outside your local network")
  81. full_text += "<p>" + t + "</p>"
  82. t = catalog.i18nc("@text", "- Store your Ultimaker Cura settings in the cloud for use anywhere")
  83. full_text += "<p>" + t + "</p>"
  84. t = catalog.i18nc("@text", "- Get exclusive access to material profiles from leading brands")
  85. full_text += "<p>" + t + "</p>"
  86. return full_text
  87. }
  88. textFormat: Text.RichText
  89. font: UM.Theme.getFont("medium")
  90. renderType: Text.NativeRendering
  91. }
  92. }
  93. }
  94. // Bottom buttons go here
  95. Cura.PrimaryButton
  96. {
  97. id: finishButton
  98. anchors.right: parent.right
  99. anchors.bottom: parent.bottom
  100. text: catalog.i18nc("@button", "Finish")
  101. onClicked: base.showNextPage()
  102. }
  103. Cura.SecondaryButton
  104. {
  105. id: createAccountButton
  106. anchors.left: parent.left
  107. anchors.verticalCenter: finishButton.verticalCenter
  108. text: catalog.i18nc("@button", "Create an account")
  109. onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
  110. }
  111. Label
  112. {
  113. id: signInButton
  114. anchors.left: createAccountButton.right
  115. anchors.verticalCenter: finishButton.verticalCenter
  116. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  117. text: catalog.i18nc("@button", "Sign in")
  118. color: UM.Theme.getColor("secondary_button_text")
  119. font: UM.Theme.getFont("medium")
  120. renderType: Text.NativeRendering
  121. MouseArea
  122. {
  123. anchors.fill: parent
  124. hoverEnabled: true
  125. onClicked: Cura.API.account.login()
  126. onEntered: parent.font.underline = true
  127. onExited: parent.font.underline = false
  128. }
  129. }
  130. }