CloudContent.qml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 Account")
  30. color: UM.Theme.getColor("primary_button")
  31. font: UM.Theme.getFont("huge")
  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: nextButton.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", "Your key to connected 3D printing")
  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", "- Customize your experience with more print profiles and plugins")
  81. full_text += "<p>" + t + "</p>"
  82. t = catalog.i18nc("@text", "- Stay flexible by syncing your setup and loading it anywhere")
  83. full_text += "<p>" + t + "</p>"
  84. t = catalog.i18nc("@text", "- Increase efficiency with a remote workflow on Ultimaker printers")
  85. full_text += "<p>" + t + "</p>"
  86. return full_text
  87. }
  88. textFormat: Text.RichText
  89. font: UM.Theme.getFont("medium")
  90. color: UM.Theme.getColor("text")
  91. renderType: Text.NativeRendering
  92. }
  93. // "Sign in" and "Create an account" exist inside the column
  94. Cura.PrimaryButton
  95. {
  96. id: signInButton
  97. height: createAccountButton.height
  98. width: createAccountButton.width
  99. anchors.horizontalCenter: parent.horizontalCenter
  100. text: catalog.i18nc("@button", "Sign in")
  101. onClicked: Cura.API.account.login()
  102. // Content Item is used in order to align the text inside the button. Without it, when resizing the
  103. // button, the text will be aligned on the left
  104. contentItem: Text {
  105. text: signInButton.text
  106. font: UM.Theme.getFont("medium")
  107. color: UM.Theme.getColor("primary_text")
  108. horizontalAlignment: Text.AlignHCenter
  109. verticalAlignment: Text.AlignVCenter
  110. }
  111. }
  112. Cura.SecondaryButton
  113. {
  114. id: createAccountButton
  115. anchors.horizontalCenter: parent.horizontalCenter
  116. text: catalog.i18nc("@button","Create account")
  117. onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
  118. }
  119. }
  120. }
  121. // The "Next" button exists on the bottom right
  122. Label
  123. {
  124. id: nextButton
  125. anchors.right: parent.right
  126. anchors.bottom: parent.bottom
  127. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  128. text: catalog.i18nc("@button", "Skip")
  129. color: UM.Theme.getColor("secondary_button_text")
  130. font: UM.Theme.getFont("medium")
  131. renderType: Text.NativeRendering
  132. MouseArea
  133. {
  134. anchors.fill: parent
  135. hoverEnabled: true
  136. onClicked: base.showNextPage()
  137. onEntered: parent.font.underline = true
  138. onExited: parent.font.underline = false
  139. }
  140. }
  141. }