ChoosePrinterDialog.qml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. property var compatible_machine_model: Cura.CompatibleMachineModel {}
  12. id: base
  13. title: catalog.i18nc("@title:window", "Select Printer")
  14. backgroundColor: UM.Theme.getColor("background_2")
  15. width: minimumWidth
  16. minimumWidth: 550 * screenScaleFactor
  17. height: minimumHeight
  18. minimumHeight: 550 * screenScaleFactor
  19. modality: Qt.ApplicationModal
  20. ScrollView
  21. {
  22. // Workaround for Windowing bugs in Qt:
  23. width: 550 * screenScaleFactor - 3 * UM.Theme.getSize("default_margin").width
  24. height: 550 * screenScaleFactor - 3 * UM.Theme.getSize("default_margin").height
  25. UM.I18nCatalog
  26. {
  27. id: catalog
  28. name: "cura"
  29. }
  30. anchors.fill: parent
  31. Column
  32. {
  33. anchors.fill: parent
  34. spacing: UM.Theme.getSize("default_margin").height
  35. Item
  36. {
  37. width: parent.width
  38. height: childrenRect.height
  39. UM.Label
  40. {
  41. anchors.left: parent.left
  42. text: catalog.i18nc("@title:label", "Compatible Printers")
  43. font: UM.Theme.getFont("large")
  44. anchors.horizontalCenter: parent.horizontalCenter
  45. }
  46. TabButton
  47. {
  48. id: refreshButton
  49. anchors.right: parent.right
  50. width: UM.Theme.getSize("button_icon").width
  51. height: UM.Theme.getSize("button_icon").height
  52. hoverEnabled: true
  53. onClicked:
  54. {
  55. manager.refresh()
  56. base.compatible_machine_model.forceUpdate()
  57. }
  58. background: Rectangle
  59. {
  60. width: UM.Theme.getSize("button_icon").width
  61. height: UM.Theme.getSize("button_icon").height
  62. color: refreshButton.hovered ? UM.Theme.getColor("toolbar_button_hover") : UM.Theme.getColor("toolbar_background")
  63. radius: Math.round(refreshButton.width * 0.5)
  64. }
  65. UM.ColorImage
  66. {
  67. width: UM.Theme.getSize("section_icon").width
  68. height: UM.Theme.getSize("section_icon").height
  69. color: UM.Theme.getColor("text_link")
  70. source: UM.Theme.getIcon("ArrowDoubleCircleRight")
  71. anchors.horizontalCenter: parent.horizontalCenter
  72. anchors.verticalCenter: parent.verticalCenter
  73. }
  74. }
  75. }
  76. Repeater
  77. {
  78. id: contents
  79. model: base.compatible_machine_model
  80. delegate: Cura.PrintSelectorCard
  81. {
  82. name: model.name
  83. unique_id: model.unique_id
  84. extruders: model.extruders
  85. manager: base.manager
  86. }
  87. }
  88. UM.Label
  89. {
  90. visible: contents.count < 1
  91. text: catalog.i18nc("@description", "No compatible printers, that are currently online, where found.")
  92. }
  93. }
  94. }
  95. }