mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Merge branch '4.0' into unify_font_types
This commit is contained in:
commit
d97b812ccd
25 changed files with 287 additions and 103 deletions
|
@ -12,7 +12,23 @@ Button
|
|||
id: configurationItem
|
||||
|
||||
property var configuration: null
|
||||
hoverEnabled: true
|
||||
hoverEnabled: isValidMaterial
|
||||
|
||||
property bool isValidMaterial:
|
||||
{
|
||||
var extruderConfigurations = configuration.extruderConfigurations
|
||||
|
||||
for (var index in extruderConfigurations)
|
||||
{
|
||||
var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : ""
|
||||
|
||||
if (name == "" || name == "Unknown")
|
||||
{
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
|
@ -40,17 +56,104 @@ Button
|
|||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("wide_margin").width
|
||||
}
|
||||
|
||||
height: childrenRect.height
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Repeater
|
||||
{
|
||||
id: repeater
|
||||
model: configuration.extruderConfigurations
|
||||
|
||||
delegate: PrintCoreConfiguration
|
||||
{
|
||||
width: Math.round(parent.width / 2)
|
||||
printCoreConfiguration: modelData
|
||||
visible: configurationItem.isValidMaterial
|
||||
}
|
||||
}
|
||||
|
||||
// Unknown material
|
||||
Item
|
||||
{
|
||||
id: unknownMaterial
|
||||
height: unknownMaterialMessage.height + UM.Theme.getSize("thin_margin").width / 2
|
||||
width: parent.width
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: UM.Theme.getSize("thin_margin").width / 2
|
||||
|
||||
visible: !configurationItem.isValidMaterial
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: icon
|
||||
anchors.verticalCenter: unknownMaterialMessage.verticalCenter
|
||||
|
||||
source: UM.Theme.getIcon("warning")
|
||||
color: UM.Theme.getColor("warning")
|
||||
width: UM.Theme.getSize("section_icon").width
|
||||
height: width
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: unknownMaterialMessage
|
||||
text:
|
||||
{
|
||||
var extruderConfigurations = configuration.extruderConfigurations
|
||||
var unknownMaterials = []
|
||||
for (var index in extruderConfigurations)
|
||||
{
|
||||
var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : ""
|
||||
if (name == "" || name == "Unknown")
|
||||
{
|
||||
var materialType = extruderConfigurations[index].material.type
|
||||
if (extruderConfigurations[index].material.type == "")
|
||||
{
|
||||
materialType = "Unknown"
|
||||
}
|
||||
|
||||
var brand = extruderConfigurations[index].material.brand
|
||||
if (brand == "")
|
||||
{
|
||||
brand = "Unknown"
|
||||
}
|
||||
|
||||
name = materialType + " (" + brand + ")"
|
||||
unknownMaterials.push(name)
|
||||
}
|
||||
}
|
||||
|
||||
unknownMaterials = "<b>" + unknownMaterials + "</b>"
|
||||
var draftResult = catalog.i18nc("@label", "This configuration is not available because %1 is not recognized. Please visit %2 to download the correct material profile.");
|
||||
var result = draftResult.arg(unknownMaterials).arg("<a href=' '>" + catalog.i18nc("@label","Marketplace") + "</a> ")
|
||||
|
||||
return result
|
||||
}
|
||||
width: extruderRow.width
|
||||
|
||||
anchors.left: icon.right
|
||||
anchors.right: unknownMaterial.right
|
||||
anchors.leftMargin: UM.Theme.getSize("wide_margin").height
|
||||
anchors.top: unknownMaterial.top
|
||||
|
||||
wrapMode: Text.WordWrap
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
linkColor: UM.Theme.getColor("text_link")
|
||||
|
||||
onLinkActivated:
|
||||
{
|
||||
Cura.Actions.browsePackages.trigger()
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
cursorShape: unknownMaterialMessage.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +187,7 @@ Button
|
|||
rightMargin: UM.Theme.getSize("wide_margin").width
|
||||
}
|
||||
height: childrenRect.height
|
||||
visible: configuration.buildplateConfiguration != ""
|
||||
visible: configuration.buildplateConfiguration != "" && false //Buildplate is disabled as long as we have no printers that properly support buildplate swapping (so we can't test).
|
||||
|
||||
// Show the type of buildplate. The first letter is capitalized
|
||||
Cura.IconWithText
|
||||
|
@ -113,6 +216,9 @@ Button
|
|||
|
||||
onClicked:
|
||||
{
|
||||
Cura.MachineManager.applyRemoteConfiguration(configuration)
|
||||
if(isValidMaterial)
|
||||
{
|
||||
Cura.MachineManager.applyRemoteConfiguration(configuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue