Merge branch 'main' into CURA-9793_extend_recommended_print_settings

This commit is contained in:
jspijker 2022-12-07 10:16:17 +01:00
commit 0bdb04ccf6
5 changed files with 228 additions and 112 deletions

View file

@ -52,8 +52,13 @@ Item
id: intentSelection
onClicked: menu.opened ? menu.close() : menu.open()
anchors.right: profileWarningReset.left
width: UM.Theme.getSize("print_setup_big_item").width - profileWarningReset.width
// Anchoring to the right makes much more sense here, but for some reason this component compresses from the right
// and then expands from the left afterwards. This pushes it left by profileWarningReset.width
// The solution is to anchor from the other direction so this does not happen.
anchors.left: parent.left
// This leftMargin gives us the same spacing as anchoring to the right on profileWarningReset
anchors.leftMargin: parent.width - UM.Theme.getSize("print_setup_big_item").width
width: profileWarningReset.visible ? UM.Theme.getSize("print_setup_big_item").width - profileWarningReset.width - UM.Theme.getSize("default_margin").width : UM.Theme.getSize("print_setup_big_item").width
height: textLabel.contentHeight + 2 * UM.Theme.getSize("narrow_margin").height
hoverEnabled: true
@ -157,6 +162,7 @@ Item
id: profileWarningReset
width: childrenRect.width
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
fullWarning: false
}

View file

@ -233,18 +233,19 @@ Popup
right: parent.right
}
height: textLabel.contentHeight + 2 * UM.Theme.getSize("narrow_margin").height
height: textLabel.contentHeight + UM.Theme.getSize("default_margin").height
contentItem: Item
{
width: parent.width
height: childrenRect.height
height: parent.height
UM.Label
{
id: textLabel
text: manageProfilesButton.text
height: contentHeight
anchors.verticalCenter: parent.verticalCenter
}
UM.Label
{
@ -252,6 +253,7 @@ Popup
text: Cura.Actions.manageProfiles.shortcut
color: UM.Theme.getColor("text_lighter")
height: contentHeight
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
}
@ -266,7 +268,7 @@ Popup
Item
{
width: 2
height: UM.Theme.getSize("default_radius").width
height: UM.Theme.getSize("default_radius").width
}
}
}

View file

@ -13,13 +13,14 @@ Item
property bool fullWarning: true // <- Can you see the warning icon and the text, or is it just the buttons?
height: visible ? UM.Theme.getSize("action_button_icon").height : 0
visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality
width: visible ? childrenRect.width: 0
visible: Cura.MachineManager.hasUserSettings || (fullWarning && Cura.MachineManager.hasCustomQuality)
Rectangle
{
id: warningIcon
visible: fullWarning
color: UM.Theme.getColor("um_yellow_5")
color: UM.Theme.getColor("warning")
height: UM.Theme.getSize("action_button_icon").height
width: visible ? height : 0
radius: width
@ -30,6 +31,7 @@ Item
}
UM.ColorImage
{
id: warningIconImage
height: UM.Theme.getSize("action_button_icon").height
width: height
source: UM.Theme.getIcon("Warning", "low")
@ -45,7 +47,7 @@ Item
{
left: warningIcon.right
verticalCenter: parent.verticalCenter
leftMargin: UM.Theme.getSize("thin_margin").width
leftMargin: visible ? UM.Theme.getSize("thin_margin").width : 0
}
wrapMode: Text.WordWrap
@ -54,7 +56,7 @@ Item
State
{
name: "settings changed and custom quality"
when: Cura.SimpleModeSettingsManager.isProfileCustomized && Cura.MachineManager.hasCustomQuality
when: Cura.MachineManager.hasUserSettings && Cura.MachineManager.hasCustomQuality
PropertyChanges
{
target: warning
@ -63,7 +65,6 @@ Item
return catalog.i18nc("@info, %1 is the name of the custom profile", "<b>%1</b> custom profile is active and you overwrote some settings.").arg(profile_name)
}
}
},
State
{
@ -80,7 +81,21 @@ Item
},
State
{
name: "settings changed"
name: "recommended settings changed"
when: Cura.MachineManager.hasUserSettings
PropertyChanges
{
target: warning
text:
{
var profile_name = Cura.MachineManager.activeQualityOrQualityChangesName;
return catalog.i18nc("@info %1 is the name of a profile", "Recommended settings (for <b>%1</b>) were altered.").arg(profile_name);
}
}
},
State
{
name: "custom settings changed"
when: Cura.SimpleModeSettingsManager.isProfileCustomized
PropertyChanges
{
@ -99,7 +114,7 @@ Item
{
id: resetToDefaultQualityButton
height: UM.Theme.getSize("action_button_icon").height
width: height
width: visible ? height : 0
iconSource: UM.Theme.getIcon("ArrowReset")
anchors
{
@ -107,10 +122,11 @@ Item
verticalCenter: parent.verticalCenter
}
visible: enabled
color: enabled ? UM.Theme.getColor("accent_1") : UM.Theme.getColor("disabled")
hoverColor: UM.Theme.getColor("primary_hover")
enabled: Cura.MachineManager.hasCustomQuality || Cura.SimpleModeSettingsManager.isProfileCustomized
enabled: (fullWarning && Cura.MachineManager.hasCustomQuality) || Cura.MachineManager.hasUserSettings
onClicked: Cura.MachineManager.resetToUseDefaultQuality()
UM.ToolTip
@ -126,7 +142,7 @@ Item
Item
{
id: buttonsSpacer
width: UM.Theme.getSize("action_button_icon").height
width: compareAndSaveButton.visible ? UM.Theme.getSize("default_margin").width : 0
anchors.right: compareAndSaveButton.left
}
@ -134,7 +150,7 @@ Item
{
id: compareAndSaveButton
height: UM.Theme.getSize("action_button_icon").height
width: height
width: visible ? height : 0
iconSource: UM.Theme.getIcon("Save")
anchors
{
@ -142,10 +158,11 @@ Item
verticalCenter: parent.verticalCenter
}
visible: enabled
color: enabled ? UM.Theme.getColor("accent_1") : UM.Theme.getColor("disabled")
hoverColor: UM.Theme.getColor("primary_hover")
enabled: Cura.SimpleModeSettingsManager.isProfileCustomized
enabled: Cura.MachineManager.hasUserSettings
onClicked: CuraApplication.showCompareAndSaveProfileChanges
(
Cura.MachineManager.hasCustomQuality ?