CloudContent.qml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. signal cloudPrintersDetected(bool newCloudPrintersDetected)
  14. Component.onCompleted: CuraApplication.getDiscoveredCloudPrintersModel().cloudPrintersDetectedChanged.connect(cloudPrintersDetected)
  15. onCloudPrintersDetected:
  16. {
  17. // When the user signs in successfully, it will be checked whether he/she has cloud printers connected to
  18. // the account. If he/she does, then the welcome wizard will show a summary of the Cloud printers linked to the
  19. // account. If there are no cloud printers, then proceed to the next page (if any)
  20. if(newCloudPrintersDetected)
  21. {
  22. base.goToPage("add_cloud_printers")
  23. }
  24. else
  25. {
  26. base.showNextPage()
  27. }
  28. }
  29. Label
  30. {
  31. id: titleLabel
  32. anchors.top: parent.top
  33. anchors.horizontalCenter: parent.horizontalCenter
  34. horizontalAlignment: Text.AlignHCenter
  35. text: catalog.i18nc("@label", "Ultimaker Account")
  36. color: UM.Theme.getColor("primary_button")
  37. font: UM.Theme.getFont("huge")
  38. renderType: Text.NativeRendering
  39. }
  40. // Area where the cloud contents can be put. Pictures, texts and such.
  41. Item
  42. {
  43. id: cloudContentsArea
  44. anchors
  45. {
  46. top: titleLabel.bottom
  47. bottom: skipButton.top
  48. left: parent.left
  49. right: parent.right
  50. topMargin: UM.Theme.getSize("default_margin").height
  51. }
  52. // Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in
  53. // the cloud contents area.
  54. Column
  55. {
  56. anchors.centerIn: parent
  57. width: parent.width
  58. height: childrenRect.height
  59. spacing: 20 * screenScaleFactor
  60. Image // Cloud image
  61. {
  62. id: cloudImage
  63. anchors.horizontalCenter: parent.horizontalCenter
  64. source: UM.Theme.getImage("first_run_ultimaker_cloud")
  65. }
  66. Label // A title-ish text
  67. {
  68. id: highlightTextLabel
  69. anchors.horizontalCenter: parent.horizontalCenter
  70. horizontalAlignment: Text.AlignHCenter
  71. text: catalog.i18nc("@text", "Your key to connected 3D printing")
  72. textFormat: Text.RichText
  73. color: UM.Theme.getColor("primary")
  74. font: UM.Theme.getFont("medium")
  75. renderType: Text.NativeRendering
  76. }
  77. Label // A number of text items
  78. {
  79. id: textLabel
  80. anchors.horizontalCenter: parent.horizontalCenter
  81. text:
  82. {
  83. // There are 3 text items, each of which is translated separately as a single piece of text.
  84. var full_text = ""
  85. var t = ""
  86. t = catalog.i18nc("@text", "- Customize your experience with more print profiles and plugins")
  87. full_text += "<p>" + t + "</p>"
  88. t = catalog.i18nc("@text", "- Stay flexible by syncing your setup and loading it anywhere")
  89. full_text += "<p>" + t + "</p>"
  90. t = catalog.i18nc("@text", "- Increase efficiency with a remote workflow on Ultimaker printers")
  91. full_text += "<p>" + t + "</p>"
  92. return full_text
  93. }
  94. textFormat: Text.RichText
  95. font: UM.Theme.getFont("medium")
  96. color: UM.Theme.getColor("text")
  97. renderType: Text.NativeRendering
  98. }
  99. // "Sign in" and "Create an account" exist inside the column
  100. Cura.PrimaryButton
  101. {
  102. id: signInButton
  103. height: createAccountButton.height
  104. width: createAccountButton.width
  105. anchors.horizontalCenter: parent.horizontalCenter
  106. text: catalog.i18nc("@button", "Sign in")
  107. onClicked: Cura.API.account.login()
  108. // Content Item is used in order to align the text inside the button. Without it, when resizing the
  109. // button, the text will be aligned on the left
  110. contentItem: Text {
  111. text: signInButton.text
  112. font: UM.Theme.getFont("medium")
  113. color: UM.Theme.getColor("primary_text")
  114. horizontalAlignment: Text.AlignHCenter
  115. verticalAlignment: Text.AlignVCenter
  116. }
  117. }
  118. Cura.SecondaryButton
  119. {
  120. id: createAccountButton
  121. anchors.horizontalCenter: parent.horizontalCenter
  122. text: catalog.i18nc("@button","Create account")
  123. onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
  124. }
  125. }
  126. }
  127. // The "Skip" button exists on the bottom right
  128. Label
  129. {
  130. id: skipButton
  131. anchors.right: parent.right
  132. anchors.bottom: parent.bottom
  133. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  134. text: catalog.i18nc("@button", "Skip")
  135. color: UM.Theme.getColor("secondary_button_text")
  136. font: UM.Theme.getFont("medium")
  137. renderType: Text.NativeRendering
  138. MouseArea
  139. {
  140. anchors.fill: parent
  141. hoverEnabled: true
  142. onClicked: base.showNextPage()
  143. onEntered: parent.font.underline = true
  144. onExited: parent.font.underline = false
  145. }
  146. }
  147. }