ChoosePrinterDialog.qml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 2.9
  5. import QtQuick.Layouts 2.10
  6. import UM 1.5 as UM
  7. import Cura 1.0 as Cura
  8. UM.Dialog
  9. {
  10. property var manager
  11. id: base
  12. title: catalog.i18nc("@title:window", "Select Printer")
  13. backgroundColor: UM.Theme.getColor("background_2")
  14. width: minimumWidth
  15. minimumWidth: 550 * screenScaleFactor
  16. height: minimumHeight
  17. minimumHeight: 550 * screenScaleFactor
  18. modality: Qt.ApplicationModal
  19. ScrollView
  20. {
  21. // Workaround for Windowing bugs in Qt:
  22. width: 550 * screenScaleFactor - 3 * UM.Theme.getSize("default_margin").width
  23. height: 550 * screenScaleFactor - 3 * UM.Theme.getSize("default_margin").height
  24. UM.I18nCatalog
  25. {
  26. id: catalog
  27. name: "cura"
  28. }
  29. anchors.fill: parent
  30. Column
  31. {
  32. anchors.fill: parent
  33. spacing: UM.Theme.getSize("default_margin").height
  34. Item
  35. {
  36. width: parent.width
  37. height: childrenRect.height
  38. UM.Label
  39. {
  40. anchors.left: parent.left
  41. text: catalog.i18nc("@title:label", "Compatible Printers")
  42. font: UM.Theme.getFont("large")
  43. }
  44. UM.SimpleButton
  45. {
  46. anchors.right: parent.right
  47. width: UM.Theme.getSize("small_button").width
  48. height: UM.Theme.getSize("small_button").height
  49. iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight")
  50. color: UM.Theme.getColor("text_link")
  51. hoverColor: UM.Theme.getColor("text_scene_hover")
  52. onClicked: manager.refresh()
  53. }
  54. }
  55. Repeater
  56. {
  57. id: contents
  58. model: Cura.CompatibleMachineModel {}
  59. delegate: Cura.PrintSelectorCard
  60. {
  61. name: model.name
  62. unique_id: model.unique_id
  63. extruders: model.extruders
  64. manager: base.manager
  65. }
  66. }
  67. UM.Label
  68. {
  69. visible: contents.count < 1
  70. text: catalog.i18nc("@description", "No compatible printers, that are currently online, where found.")
  71. }
  72. }
  73. }
  74. }