Change the behaviour of the output device selector

Now the behavior is the following:
- The active output device is the one that shows up in the button (same as before)
- The list of the output devices don't show the active device
- When clicking in one item of the list, it becomes the active output and automatically it performs the action.

Contributes to CURA-6026.
This commit is contained in:
Diego Prado Gesto 2018-12-13 09:02:14 +01:00
parent a505adbf40
commit e7fe7571aa

View File

@ -12,6 +12,12 @@ Item
{ {
id: widget id: widget
function requestWriteToDevice()
{
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName,
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
}
Cura.PrimaryButton Cura.PrimaryButton
{ {
id: saveToButton id: saveToButton
@ -32,9 +38,8 @@ Item
onClicked: onClicked:
{ {
forceActiveFocus(); forceActiveFocus()
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName, widget.requestWriteToDevice()
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
} }
} }
@ -81,6 +86,7 @@ Item
delegate: Cura.ActionButton delegate: Cura.ActionButton
{ {
text: model.description text: model.description
visible: model.id != UM.OutputDeviceManager.activeDevice // Don't show the active device in the list
color: "transparent" color: "transparent"
cornerRadius: 0 cornerRadius: 0
hoverColor: UM.Theme.getColor("primary") hoverColor: UM.Theme.getColor("primary")
@ -88,6 +94,7 @@ Item
onClicked: onClicked:
{ {
UM.OutputDeviceManager.setActiveDevice(model.id) UM.OutputDeviceManager.setActiveDevice(model.id)
widget.requestWriteToDevice()
popup.close() popup.close()
} }
} }