AddUltimakerPrinter.qml 4.1 KB

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