AddUltimakerPrinter.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // Copyright (c) 2022 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 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. else
  21. {
  22. goToThirdPartyPrinter()
  23. }
  24. }
  25. contentItem: ColumnLayout
  26. {
  27. UM.Label
  28. {
  29. Layout.fillWidth: true
  30. text: catalog.i18nc("@label", "New Ultimaker printers can be connected to Digital Factory and monitored remotely.")
  31. wrapMode: Text.WordWrap
  32. }
  33. RowLayout
  34. {
  35. Layout.fillWidth: true
  36. Image
  37. {
  38. source: UM.Theme.getImage("add_printer")
  39. Layout.preferredWidth: 200 * screenScaleFactor
  40. Layout.preferredHeight: 200 * screenScaleFactor
  41. }
  42. ColumnLayout
  43. {
  44. Layout.fillHeight: true
  45. Layout.alignment: Qt.AlignVCenter
  46. spacing: UM.Theme.getSize("default_margin").height
  47. UM.Label
  48. {
  49. Layout.fillWidth: true
  50. Layout.alignment: Qt.AlignTop
  51. wrapMode: Text.WordWrap
  52. font: UM.Theme.getFont("default_bold")
  53. text: catalog.i18nc("@label", "If you are trying to add a new Ultimaker printer to Cura")
  54. }
  55. UM.Label
  56. {
  57. Layout.fillWidth: true
  58. Layout.alignment: Qt.AlignTop
  59. wrapMode: Text.WordWrap
  60. text: {
  61. const steps = [
  62. catalog.i18nc("@info", "Sign in into Ultimaker Digilal Factory"),
  63. catalog.i18nc("@info", "Follow the procedure to add a new printer"),
  64. catalog.i18nc("@info", "Your new printer will automatically appear in Cura"),
  65. ];
  66. return steps.join("<br />");
  67. }
  68. }
  69. Cura.TertiaryButton
  70. {
  71. Layout.fillWidth: true
  72. Layout.alignment: Qt.AlignTop
  73. text: catalog.i18nc("@button", "Learn more")
  74. iconSource: UM.Theme.getIcon("LinkExternal")
  75. isIconOnRightSide: true
  76. textFont: UM.Theme.getFont("small")
  77. onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=onboarding-add-printer")
  78. }
  79. }
  80. }
  81. Control
  82. {
  83. Layout.alignment: Qt.AlignBottom
  84. Layout.fillWidth: true
  85. contentItem: RowLayout
  86. {
  87. Cura.SecondaryButton
  88. {
  89. Layout.alignment: Qt.AlignLeft
  90. text: catalog.i18nc("@button", "Add local printer")
  91. onClicked: goToThirdPartyPrinter()
  92. }
  93. Cura.PrimaryButton
  94. {
  95. Layout.alignment: Qt.AlignRight
  96. text: catalog.i18nc("@button", "Sign in to Digital Factory")
  97. onClicked: function()
  98. {
  99. text = catalog.i18nc("@button", "Waiting for new printers")
  100. busy = true;
  101. enabled = false;
  102. Cura.API.account.login();
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }