CloudContent.qml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. // Copyright (c) 2022 UltiMaker
  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.5 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. // Area where the cloud contents can be put. Pictures, texts and such.
  30. Item
  31. {
  32. id: cloudContentsArea
  33. anchors
  34. {
  35. top: parent.top
  36. bottom: skipButton.top
  37. left: parent.left
  38. right: parent.right
  39. }
  40. // Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in
  41. // the cloud contents area.
  42. Column
  43. {
  44. anchors.horizontalCenter: parent.horizontalCenter
  45. width: parent.width
  46. height: childrenRect.height
  47. spacing: UM.Theme.getSize("thick_margin").height
  48. UM.Label
  49. {
  50. id: titleLabel
  51. anchors.horizontalCenter: parent.horizontalCenter
  52. horizontalAlignment: Text.AlignHCenter
  53. text: catalog.i18nc("@label", "Sign in to the UltiMaker platform")
  54. color: UM.Theme.getColor("primary_button")
  55. font: UM.Theme.getFont("huge")
  56. }
  57. // Filler item
  58. Item
  59. {
  60. height: UM.Theme.getSize("default_margin").height
  61. width: parent.width
  62. }
  63. // Cloud image
  64. Image
  65. {
  66. id: cloudImage
  67. anchors.horizontalCenter: parent.horizontalCenter
  68. source: UM.Theme.getImage("first_run_ultimaker_cloud")
  69. fillMode: Image.PreserveAspectFit
  70. width: UM.Theme.getSize("welcome_wizard_content_image_big").width
  71. sourceSize.width: width
  72. sourceSize.height: height
  73. }
  74. // Filler item
  75. Item
  76. {
  77. height: UM.Theme.getSize("default_margin").height
  78. width: parent.width
  79. }
  80. // Motivational icons
  81. Row
  82. {
  83. id: motivationRow
  84. width: parent.width
  85. Column
  86. {
  87. id: marketplaceColumn
  88. width: Math.round(parent.width / 3)
  89. spacing: UM.Theme.getSize("default_margin").height
  90. Image
  91. {
  92. id: marketplaceImage
  93. anchors.horizontalCenter: parent.horizontalCenter
  94. fillMode: Image.PreserveAspectFit
  95. width: UM.Theme.getSize("welcome_wizard_cloud_content_image").width
  96. source: UM.Theme.getIcon("Plugin", "high")
  97. sourceSize.width: width
  98. sourceSize.height: height
  99. }
  100. UM.Label
  101. {
  102. id: marketplaceTextLabel
  103. anchors.horizontalCenter: parent.horizontalCenter
  104. width: parent.width
  105. text: catalog.i18nc("@text", "Add material settings and plugins from the Marketplace")
  106. horizontalAlignment: Text.AlignHCenter
  107. }
  108. }
  109. Column
  110. {
  111. id: syncColumn
  112. width: Math.round(parent.width / 3)
  113. spacing: UM.Theme.getSize("default_margin").height
  114. Image
  115. {
  116. id: syncImage
  117. anchors.horizontalCenter: parent.horizontalCenter
  118. fillMode: Image.PreserveAspectFit
  119. width: UM.Theme.getSize("welcome_wizard_cloud_content_image").width
  120. source: UM.Theme.getIcon("Spool", "high")
  121. sourceSize.width: width
  122. sourceSize.height: height
  123. }
  124. UM.Label
  125. {
  126. id: syncTextLabel
  127. anchors.horizontalCenter: parent.horizontalCenter
  128. width: parent.width
  129. text: catalog.i18nc("@text", "Backup and sync your material settings and plugins")
  130. horizontalAlignment: Text.AlignHCenter
  131. }
  132. }
  133. Column
  134. {
  135. id: communityColumn
  136. width: Math.round(parent.width / 3)
  137. spacing: UM.Theme.getSize("default_margin").height
  138. Image
  139. {
  140. id: communityImage
  141. anchors.horizontalCenter: communityColumn.horizontalCenter
  142. fillMode: Image.PreserveAspectFit
  143. width: UM.Theme.getSize("welcome_wizard_cloud_content_image").width
  144. source: UM.Theme.getIcon("People", "high")
  145. sourceSize.width: width
  146. sourceSize.height: height
  147. }
  148. UM.Label
  149. {
  150. id: communityTextLabel
  151. anchors.horizontalCenter: communityColumn.horizontalCenter
  152. width: parent.width
  153. text: catalog.i18nc("@text", "Share ideas and get help from 48,000+ users in the UltiMaker Community")
  154. horizontalAlignment: Text.AlignHCenter
  155. }
  156. }
  157. }
  158. }
  159. }
  160. // Skip button
  161. Cura.TertiaryButton
  162. {
  163. id: skipButton
  164. anchors.left: parent.left
  165. anchors.bottom: parent.bottom
  166. text: catalog.i18nc("@button", "Skip")
  167. onClicked: base.showNextPage()
  168. }
  169. // Create an account button
  170. Cura.SecondaryButton
  171. {
  172. id: createAccountButton
  173. anchors.right: signInButton.left
  174. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  175. anchors.bottom: parent.bottom
  176. text: catalog.i18nc("@text", "Create a free UltiMaker Account")
  177. onClicked: Qt.openUrlExternally("https://ultimaker.com/app/ultimaker-cura-account-sign-up?utm_source=cura&utm_medium=software&utm_campaign=onboarding-signup")
  178. }
  179. // Sign in Button
  180. Cura.PrimaryButton
  181. {
  182. id: signInButton
  183. anchors.right: parent.right
  184. anchors.bottom: parent.bottom
  185. text: catalog.i18nc("@button", "Sign in")
  186. onClicked: Cura.API.account.login()
  187. // Content Item is used in order to align the text inside the button. Without it, when resizing the
  188. // button, the text will be aligned on the left
  189. contentItem: Text {
  190. text: signInButton.text
  191. font: UM.Theme.getFont("medium")
  192. color: UM.Theme.getColor("primary_text")
  193. horizontalAlignment: Text.AlignHCenter
  194. verticalAlignment: Text.AlignVCenter
  195. }
  196. }
  197. }