CloudContent.qml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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", "Sign in to the Ultimaker platform")
  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.horizontalCenter: parent.horizontalCenter
  57. width: parent.width
  58. height: childrenRect.height
  59. spacing: 20 * screenScaleFactor
  60. // Cloud image
  61. Image
  62. {
  63. id: cloudImage
  64. anchors.horizontalCenter: parent.horizontalCenter
  65. source: UM.Theme.getImage("first_run_ultimaker_cloud")
  66. scale: 0.666
  67. }
  68. // Motivational icons
  69. Row
  70. {
  71. id: motivationRow
  72. width: parent.width
  73. Column
  74. {
  75. id: marketplaceColumn
  76. width: Math.round(parent.width / 3)
  77. spacing: UM.Theme.getSize("default_margin").height
  78. Image
  79. {
  80. id: marketplaceImage
  81. anchors.horizontalCenter: parent.horizontalCenter
  82. source: UM.Theme.getIcon("plugin_48px")
  83. }
  84. Label
  85. {
  86. id: marketplaceTextLabel
  87. anchors.horizontalCenter: parent.horizontalCenter
  88. text: catalog.i18nc("@text", "Add material settings and\nplugins from the Marketplace")
  89. horizontalAlignment: Text.AlignHCenter
  90. color: UM.Theme.getColor("text")
  91. font: UM.Theme.getFont("tiny")
  92. renderType: Text.NativeRendering
  93. }
  94. }
  95. Column
  96. {
  97. id: syncColumn
  98. width: Math.round(parent.width / 3)
  99. spacing: UM.Theme.getSize("default_margin").height
  100. Image
  101. {
  102. id: syncImage
  103. anchors.horizontalCenter: parent.horizontalCenter
  104. source: UM.Theme.getIcon("spool_48px")
  105. }
  106. Label
  107. {
  108. id: syncTextLabel
  109. anchors.horizontalCenter: parent.horizontalCenter
  110. text: catalog.i18nc("@text", "Backup and sync your\nmaterial settings and plugins")
  111. horizontalAlignment: Text.AlignHCenter
  112. color: UM.Theme.getColor("text")
  113. font: UM.Theme.getFont("tiny")
  114. renderType: Text.NativeRendering
  115. }
  116. }
  117. Column
  118. {
  119. id: communityColumn
  120. width: Math.round(parent.width / 3)
  121. spacing: UM.Theme.getSize("default_margin").height
  122. Image
  123. {
  124. id: communityImage
  125. anchors.horizontalCenter: communityColumn.horizontalCenter
  126. source: UM.Theme.getIcon("group_48px")
  127. }
  128. Label
  129. {
  130. id: communityTextLabel
  131. anchors.horizontalCenter: communityColumn.horizontalCenter
  132. text: catalog.i18nc("@text", "Share ideas and get help\nfrom 48,000+ users in the\nUltimaker Community")
  133. horizontalAlignment: Text.AlignHCenter
  134. color: UM.Theme.getColor("text")
  135. font: UM.Theme.getFont("tiny")
  136. renderType: Text.NativeRendering
  137. }
  138. }
  139. }
  140. // Sign in Button
  141. Cura.PrimaryButton
  142. {
  143. id: signInButton
  144. anchors.margins: UM.Theme.getSize("default_margin").width
  145. anchors.horizontalCenter: parent.horizontalCenter
  146. text: catalog.i18nc("@button", "Sign in")
  147. onClicked: Cura.API.account.login()
  148. // Content Item is used in order to align the text inside the button. Without it, when resizing the
  149. // button, the text will be aligned on the left
  150. contentItem: Text {
  151. text: signInButton.text
  152. font: UM.Theme.getFont("medium")
  153. color: UM.Theme.getColor("primary_text")
  154. horizontalAlignment: Text.AlignHCenter
  155. verticalAlignment: Text.AlignVCenter
  156. }
  157. }
  158. // Create an account link
  159. Label
  160. {
  161. id: createAccountLabel
  162. width: parent.width
  163. anchors.horizontalCenter: parent.horizontalCenter
  164. horizontalAlignment: Text.AlignHCenter
  165. text:
  166. {
  167. var t1 = catalog.i18nc("@text", "Create a free Ultimaker acount")
  168. var t = "<a href='https://notusedref'>" + t1 + "</a>"
  169. return t
  170. }
  171. textFormat: Text.RichText
  172. wrapMode: Text.WordWrap
  173. font: UM.Theme.getFont("medium")
  174. color: UM.Theme.getColor("text")
  175. linkColor: UM.Theme.getColor("text_link")
  176. onLinkActivated: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
  177. renderType: Text.NativeRendering
  178. }
  179. }
  180. }
  181. // The "Skip" button exists on the bottom right
  182. Label
  183. {
  184. id: skipButton
  185. anchors.right: parent.right
  186. anchors.bottom: parent.bottom
  187. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  188. text: catalog.i18nc("@button", "Skip")
  189. color: UM.Theme.getColor("secondary_button_text")
  190. font: UM.Theme.getFont("medium")
  191. renderType: Text.NativeRendering
  192. MouseArea
  193. {
  194. anchors.fill: parent
  195. hoverEnabled: true
  196. onClicked: base.showNextPage()
  197. onEntered: parent.font.underline = true
  198. onExited: parent.font.underline = false
  199. }
  200. }
  201. }