AddUltimakerPrinter.qml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 QtQuick.Layouts 1.3
  6. import UM 1.5 as UM
  7. import Cura 1.1 as Cura
  8. Control
  9. {
  10. UM.I18nCatalog { id: catalog; name: "cura" }
  11. property var goToThirdPartyPrinter
  12. signal cloudPrintersDetected(bool newCloudPrintersDetected)
  13. Component.onCompleted: CuraApplication.getDiscoveredCloudPrintersModel().cloudPrintersDetectedChanged.connect(cloudPrintersDetected)
  14. onCloudPrintersDetected: function(newCloudPrintersDetected)
  15. {
  16. if(newCloudPrintersDetected)
  17. {
  18. base.goToPage("add_cloud_printers")
  19. }
  20. }
  21. contentItem: ColumnLayout
  22. {
  23. Layout.fillWidth: true
  24. UM.Label
  25. {
  26. Layout.fillWidth: true
  27. text: catalog.i18nc("@label", "New UltiMaker printers can be connected to Digital Factory and monitored remotely.")
  28. wrapMode: Text.WordWrap
  29. }
  30. RowLayout
  31. {
  32. Layout.alignment: Qt.AlignHCenter
  33. Layout.fillWidth: true
  34. Item
  35. {
  36. Layout.fillWidth: true
  37. Layout.minimumWidth: childrenRect.width
  38. Layout.preferredHeight: childrenRect.height
  39. Image
  40. {
  41. anchors.right: parent.right
  42. source: UM.Theme.getImage("add_printer")
  43. Layout.preferredWidth: 200 * screenScaleFactor
  44. Layout.preferredHeight: 200 * screenScaleFactor
  45. }
  46. }
  47. ColumnLayout
  48. {
  49. Layout.fillHeight: true
  50. Layout.fillWidth: true
  51. Layout.alignment: Qt.AlignVCenter
  52. spacing: UM.Theme.getSize("default_margin").height
  53. UM.Label
  54. {
  55. Layout.fillWidth: true
  56. Layout.alignment: Qt.AlignTop
  57. wrapMode: Text.WordWrap
  58. font: UM.Theme.getFont("default_bold")
  59. text: catalog.i18nc("@label", "If you are trying to add a new UltiMaker printer to Cura")
  60. }
  61. ColumnLayout
  62. {
  63. spacing: 0
  64. Layout.fillWidth: true
  65. Repeater {
  66. model: [
  67. catalog.i18nc("@info", "Sign in into UltiMaker Digital Factory"),
  68. catalog.i18nc("@info", "Follow the procedure to add a new printer"),
  69. catalog.i18nc("@info", "Your new printer will automatically appear in Cura"),
  70. ]
  71. UM.Label
  72. {
  73. Layout.alignment: Qt.AlignTop
  74. Layout.fillWidth: true
  75. wrapMode: Text.WordWrap
  76. text: `${index + 1}. ${modelData}`
  77. }
  78. }
  79. }
  80. Cura.TertiaryButton
  81. {
  82. id: learnMoreButton
  83. Layout.fillWidth: true
  84. Layout.alignment: Qt.AlignTop
  85. leftPadding: 0
  86. text: catalog.i18nc("@button", "Learn more")
  87. iconSource: UM.Theme.getIcon("LinkExternal")
  88. isIconOnRightSide: true
  89. textFont: UM.Theme.getFont("small")
  90. onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=onboarding-add-printer")
  91. }
  92. }
  93. }
  94. Control
  95. {
  96. Layout.alignment: Qt.AlignBottom
  97. Layout.fillWidth: true
  98. contentItem: RowLayout
  99. {
  100. Cura.SecondaryButton
  101. {
  102. id: addLocalPrinterButton
  103. Layout.alignment: Qt.AlignLeft
  104. text: catalog.i18nc("@button", "Add local printer")
  105. onClicked: goToThirdPartyPrinter()
  106. }
  107. Cura.PrimaryButton
  108. {
  109. id: signInButton
  110. Layout.alignment: Qt.AlignRight
  111. text: catalog.i18nc("@button", "Sign in to Digital Factory")
  112. onClicked: function()
  113. {
  114. Qt.openUrlExternally("https://digitalfactory.ultimaker.com/app/printers?add_printer=true&utm_source=cura&utm_medium=software&utm_campaign=onboarding-add-printer")
  115. text = catalog.i18nc("@button", "Waiting for new printers")
  116. busy = true;
  117. enabled = false;
  118. Cura.API.account.login();
  119. }
  120. }
  121. }
  122. }
  123. }
  124. }