This commit is contained in:
fieldOfView 2016-07-25 11:30:47 +02:00
commit ac0de58ecb
21 changed files with 417 additions and 10447 deletions

View file

@ -21,11 +21,13 @@ Item {
property var showRevertButton: true
property var showInheritButton: true
property var showLinkedSettingIcon: true
property var doDepthIndentation: true
property var doQualityUserSettingEmphasis: true
// Create properties to put property provider stuff in (bindings break in qt 5.5.1 otherwise)
property var state: propertyProvider.properties.state
property var settablePerExtruder: propertyProvider.properties.settable_per_extruder
property var stackLevels: propertyProvider.stackLevels
property var stackLevel: stackLevels[0]
@ -132,6 +134,26 @@ Item {
verticalCenter: parent.verticalCenter
}
UM.SimpleButton
{
id: linkedSettingIcon;
visible: base.settablePerExtruder != "True" && base.showLinkedSettingIcon
height: parent.height;
width: height;
backgroundColor: UM.Theme.getColor("setting_control");
hoverBackgroundColor: UM.Theme.getColor("setting_control")
color: UM.Theme.getColor("setting_control_button")
hoverColor: UM.Theme.getColor("setting_control_button")
iconSource: UM.Theme.getIcon("link")
onEntered: { hoverTimer.stop(); base.showTooltip(catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders")) }
onExited: base.showTooltip(base.tooltipText);
}
UM.SimpleButton
{
id: revertButton;
@ -232,7 +254,6 @@ Item {
onEntered: { hoverTimer.stop(); base.showTooltip(catalog.i18nc("@label", "This setting is normally calculated, but it currently has an absolute value set.\n\nClick to restore the calculated value.")) }
onExited: base.showTooltip(base.tooltipText);
}
}
Item

View file

@ -34,14 +34,7 @@ ScrollView
expanded: Printer.expandedCategories
onExpandedChanged: Printer.setExpandedCategories(expanded)
filter:
{
if(ExtruderManager.activeExtruderStackId)
{
return { "settable_per_extruder": true }
}
return { }
}
filter: {}
}
delegate: Loader
@ -53,7 +46,15 @@ ScrollView
Behavior on height { NumberAnimation { duration: 100 } }
opacity: provider.properties.enabled == "True" ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 100 } }
enabled: provider.properties.enabled == "True"
enabled:
{
if(!ExtruderManager.activeExtruderStackId && ExtruderManager.extruderCount > 0)
{
// disable all controls on the global tab, except categories
return model.type == "category"
}
return provider.properties.enabled == "True"
}
property var definition: model
property var settingDefinitionsModel: definitionsModel
@ -88,20 +89,59 @@ ScrollView
}
}
// Binding to ensure that the right containerstack ID is set for the provider.
// This ensures that if a setting has a global_inherits_stack id (for instance; Support speed points to the
// extruder that actually prints the support, as that is the setting we need to use to calculate the value)
Binding
{
target: provider
property: "containerStackId"
value:
{
if(inheritStackProvider.properties.global_inherits_stack == -1 || inheritStackProvider.properties.global_inherits_stack == null)
{
if( ExtruderManager.activeExtruderStackId)
{
return ExtruderManager.activeExtruderStackId
}
else
{
return Cura.MachineManager.activeMachineId
}
}
return ExtruderManager.extruderIds[String(inheritStackProvider.properties.global_inherits_stack)]
}
}
// Specialty provider that only watches global_inherits (we cant filter on what property changed we get events
// so we bypass that to make a dedicated provider.
UM.SettingPropertyProvider
{
id: inheritStackProvider
containerStackId: Cura.MachineManager.activeMachineId
key: model.key
watchedProperties: [ "global_inherits_stack"]
}
UM.SettingPropertyProvider
{
id: provider
containerStackId: ExtruderManager.activeExtruderStackId ? ExtruderManager.activeExtruderStackId : Cura.MachineManager.activeMachineId
containerStackId: delegate.stackId
key: model.key ? model.key : ""
watchedProperties: [ "value", "enabled", "state", "validationState" ]
watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder" ]
storeIndex: 0
}
Connections
{
target: item
onContextMenuRequested: { contextMenu.key = model.key; contextMenu.popup() }
onContextMenuRequested:
{
contextMenu.key = model.key;
contextMenu.provider = provider
contextMenu.popup();
}
onShowTooltip: base.showTooltip(delegate, { x: 0, y: delegate.height / 2 }, text)
onHideTooltip: base.hideTooltip()
}
@ -133,9 +173,24 @@ ScrollView
Menu
{
id: contextMenu;
id: contextMenu
property string key;
property string key
property var provider
MenuItem
{
//: Settings context menu action
text: catalog.i18nc("@action:menu", "Copy value to all extruders")
visible: machineExtruderCount.properties.value > 1
enabled: contextMenu.provider.properties.settable_per_extruder != "False"
onTriggered: Cura.MachineManager.copyValueToExtruders(contextMenu.key)
}
MenuSeparator
{
visible: machineExtruderCount.properties.value > 1
}
MenuItem
{
@ -151,5 +206,15 @@ ScrollView
onTriggered: Cura.Actions.configureSettingVisibility.trigger(contextMenu);
}
}
UM.SettingPropertyProvider
{
id: machineExtruderCount
containerStackId: Cura.MachineManager.activeMachineId
key: "machine_extruder_count"
watchedProperties: [ "value" ]
storeIndex: 0
}
}
}