Move the machines from machinelist into their own model

CURA-6011
This commit is contained in:
Jaime van Kessel 2018-12-14 17:10:58 +01:00
parent a18203b286
commit 226d052468
5 changed files with 97 additions and 53 deletions

View file

@ -123,6 +123,12 @@ Cura.ExpandablePopup
scroll.height = Math.min(height, maximumHeight)
popup.height = scroll.height + buttonRow.height
}
Component.onCompleted:
{
scroll.height = Math.min(height, maximumHeight)
popup.height = scroll.height + buttonRow.height
}
}
}

View file

@ -7,46 +7,48 @@ import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Column
ListView
{
id: machineSelectorList
id: listView
height: childrenRect.height
width: 200
model: Cura.PrintersModel {}
section.property: "hasRemoteConnection"
Label
section.delegate: Label
{
text: catalog.i18nc("@label", "Connected printers")
visible: networkedPrintersModel.items.length > 0
text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers")
width: parent.width
leftPadding: UM.Theme.getSize("default_margin").width
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
renderType: Text.NativeRendering
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("text_medium")
verticalAlignment: Text.AlignVCenter
}
delegate: MachineSelectorButton
{
text: model.name
width: listView.width
}
}
/*
Repeater
{
id: networkedPrinters
model: UM.ContainerStacksModel
model: Cura.PrintersModel
{
id: networkedPrintersModel
property var umConnectionTypes: [Cura.PrinterOutputDevice.NetworkConnection,
Cura.PrinterOutputDevice.ClusterConnection,
Cura.PrinterOutputDevice.CloudConnection
]
filter:
{
"type": "machine",
"um_network_key": "*",
"hidden": "False",
"um_connection_type": "[" + umConnectionTypes.join(",") + "]"
}
}
delegate: MachineSelectorButton
{
text: model.metadata["connect_group_name"]
checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
text: model.name //model.metadata["connect_group_name"]
//checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
Connections
@ -55,37 +57,5 @@ Column
onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
}
}
}
}*/
Label
{
text: catalog.i18nc("@label", "Preset printers")
visible: virtualPrintersModel.items.length > 0
leftPadding: UM.Theme.getSize("default_margin").width
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
renderType: Text.NativeRendering
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("text_medium")
verticalAlignment: Text.AlignVCenter
}
Repeater
{
id: virtualPrinters
model: UM.ContainerStacksModel
{
id: virtualPrintersModel
filter:
{
"type": "machine", "um_network_key": null
}
}
delegate: MachineSelectorButton
{
text: model.name
checked: Cura.MachineManager.activeMachineId == model.id
}
}
}