MachineSelectorList.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 2.3
  5. import UM 1.2 as UM
  6. import Cura 1.0 as Cura
  7. ListView
  8. {
  9. id: listView
  10. model: Cura.GlobalStacksModel {}
  11. section.property: "hasRemoteConnection"
  12. property real contentHeight: childrenRect.height
  13. section.delegate: Label
  14. {
  15. text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers")
  16. width: parent.width
  17. height: UM.Theme.getSize("action_button").height
  18. leftPadding: UM.Theme.getSize("default_margin").width
  19. renderType: Text.NativeRendering
  20. font: UM.Theme.getFont("medium")
  21. color: UM.Theme.getColor("text_medium")
  22. verticalAlignment: Text.AlignVCenter
  23. }
  24. delegate: MachineSelectorButton
  25. {
  26. text: model.name
  27. width: listView.width
  28. outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
  29. checked:
  30. {
  31. // If the machine has a remote connection
  32. var result = Cura.MachineManager.activeMachineId == model.id
  33. if (Cura.MachineManager.activeMachineHasRemoteConnection)
  34. {
  35. result |= Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
  36. }
  37. return result
  38. }
  39. }
  40. }