CURA-4870 Update the Sync Button accordingly to changes both in the

output device or in the current configuration, in order to check wether
a configuration matches or not.
This commit is contained in:
Diego Prado Gesto 2018-03-06 16:59:51 +01:00
parent 5280d21c26
commit 987794c515
2 changed files with 33 additions and 3 deletions

View file

@ -6,13 +6,30 @@ import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura
Button Button
{ {
text: "No match" id: base
property var outputDevice: Cura.MachineManager.printerOutputDevices[0] != null ? Cura.MachineManager.printerOutputDevices[0] : null
text: catalog.i18nc("@label:sync indicator", "No match")
width: parent.width width: parent.width
height: parent.height height: parent.height
function updateOnSync()
{
for (var index in outputDevice.uniqueConfigurations)
{
var configuration = outputDevice.uniqueConfigurations[index]
if (Cura.MachineManager.matchesConfiguration(configuration))
{
base.text = catalog.i18nc("@label:sync indicator", "Matched")
return
}
}
base.text = catalog.i18nc("@label:sync indicator", "No match")
}
style: ButtonStyle style: ButtonStyle
{ {
background: Rectangle background: Rectangle
@ -68,4 +85,18 @@ Button
{ {
panelVisible = !panelVisible panelVisible = !panelVisible
} }
Connections {
target: outputDevice
onUniqueConfigurationsChanged: {
updateOnSync()
}
}
Connections {
target: Cura.MachineManager
onCurrentConfigurationChanged: {
updateOnSync()
}
}
} }

View file

@ -63,8 +63,7 @@ Column
ToolButton ToolButton
{ {
id: configurationSelection id: printerTypeSelection
text: catalog.i18nc("@label", "Printer type"); text: catalog.i18nc("@label", "Printer type");
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width