mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Merge pull request #12528 from Ultimaker/CURA-8849
[CURA-8849] Improve intent profile selection
This commit is contained in:
commit
dd76369b9a
17 changed files with 780 additions and 169 deletions
|
|
@ -0,0 +1,108 @@
|
|||
import QtQuick 2.10
|
||||
|
||||
import UM 1.6 as UM
|
||||
import Cura 1.6 as Cura
|
||||
|
||||
Rectangle
|
||||
{
|
||||
height: visible ? UM.Theme.getSize("action_button_icon").height : 0
|
||||
visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin")
|
||||
anchors.bottomMargin: UM.Theme.getSize("default_margin")
|
||||
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: warningIcon
|
||||
color: UM.Theme.getColor("um_yellow_5")
|
||||
height: UM.Theme.getSize("action_button_icon").height
|
||||
width: height
|
||||
radius: width
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
UM.ColorImage
|
||||
{
|
||||
height: UM.Theme.getSize("action_button_icon").height
|
||||
width: height
|
||||
source: UM.Theme.getIcon("Warning", "low")
|
||||
}
|
||||
}
|
||||
|
||||
UM.Label
|
||||
{
|
||||
id: warning
|
||||
anchors
|
||||
{
|
||||
left: warningIcon.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
leftMargin: UM.Theme.getSize("thin_margin").width
|
||||
}
|
||||
|
||||
text: ""
|
||||
|
||||
states: [
|
||||
State
|
||||
{
|
||||
name: "settings changed and custom quality"
|
||||
when: Cura.SimpleModeSettingsManager.isProfileCustomized && Cura.MachineManager.hasCustomQuality
|
||||
PropertyChanges
|
||||
{
|
||||
target: warning
|
||||
text: {
|
||||
var profile_name = Cura.MachineManager.activeQualityChangesGroup.name
|
||||
return "<b>%1</b> %2".arg(profile_name).arg(catalog.i18nc("@info", "custom profile is active and you overwrote some settings."))
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
State
|
||||
{
|
||||
name: "custom quality"
|
||||
when: Cura.MachineManager.hasCustomQuality
|
||||
PropertyChanges
|
||||
{
|
||||
target: warning
|
||||
text: {
|
||||
var profile_name = Cura.MachineManager.activeQualityChangesGroup.name
|
||||
return "<b>%1</b> %2".arg(profile_name).arg(catalog.i18nc("@info", "custom profile is overriding some settings."))
|
||||
}
|
||||
}
|
||||
},
|
||||
State
|
||||
{
|
||||
name: "settings changed"
|
||||
when: Cura.SimpleModeSettingsManager.isProfileCustomized
|
||||
PropertyChanges
|
||||
{
|
||||
target: warning
|
||||
text: catalog.i18nc("@info", "Some settings were changed.")
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
UM.SimpleButton
|
||||
{
|
||||
id: resetToDefaultQualityButton
|
||||
height: UM.Theme.getSize("action_button_icon").height
|
||||
width: height
|
||||
iconSource: UM.Theme.getIcon("ArrowReset")
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
color: UM.Theme.getColor("accent_1")
|
||||
|
||||
onClicked:
|
||||
{
|
||||
Cura.MachineManager.resetToUseDefaultQuality()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
//Copyright (c) 2022 Ultimaker B.V.
|
||||
//Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
import UM 1.6 as UM
|
||||
import Cura 1.6 as Cura
|
||||
|
||||
Item
|
||||
{
|
||||
|
|
@ -13,11 +14,11 @@ Item
|
|||
height: childrenRect.height + 2 * padding
|
||||
|
||||
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1
|
||||
property real padding: UM.Theme.getSize("thick_margin").width
|
||||
property real padding: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Column
|
||||
ColumnLayout
|
||||
{
|
||||
spacing: UM.Theme.getSize("wide_margin").height
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
anchors
|
||||
{
|
||||
|
|
@ -30,11 +31,53 @@ Item
|
|||
// TODO
|
||||
property real firstColumnWidth: Math.round(width / 3)
|
||||
|
||||
UM.Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Profiles")
|
||||
font: UM.Theme.getFont("medium")
|
||||
}
|
||||
|
||||
RecommendedQualityProfileSelector
|
||||
{
|
||||
width: parent.width
|
||||
// TODO Create a reusable component with these properties to not define them separately for each component
|
||||
labelColumnWidth: parent.firstColumnWidth
|
||||
visible: recommendedResolutionSelector.visible
|
||||
}
|
||||
|
||||
RecommendedResolutionSelector
|
||||
{
|
||||
id: recommendedResolutionSelector
|
||||
Layout.fillWidth: true
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
UnsupportedProfileIndication
|
||||
{
|
||||
width: parent.width
|
||||
visible: !recommendedResolutionSelector.visible
|
||||
}
|
||||
|
||||
|
||||
ProfileWarningReset
|
||||
{
|
||||
width: parent.width
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
//Line between the sections.
|
||||
Rectangle
|
||||
{
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("default_lining").height
|
||||
Layout.topMargin: UM.Theme.getSize("narrow_margin").height
|
||||
Layout.bottomMargin: UM.Theme.getSize("narrow_margin").height
|
||||
Layout.fillWidth: true
|
||||
color: UM.Theme.getColor("lining")
|
||||
}
|
||||
|
||||
UM.Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Print settings")
|
||||
font: UM.Theme.getFont("medium")
|
||||
}
|
||||
|
||||
RecommendedInfillDensitySelector
|
||||
|
|
@ -42,6 +85,9 @@ Item
|
|||
width: parent.width
|
||||
// TODO Create a reusable component with these properties to not define them separately for each component
|
||||
labelColumnWidth: parent.firstColumnWidth
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
Layout.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
RecommendedSupportSelector
|
||||
|
|
@ -49,6 +95,7 @@ Item
|
|||
width: parent.width
|
||||
// TODO Create a reusable component with these properties to not define them separately for each component
|
||||
labelColumnWidth: parent.firstColumnWidth
|
||||
Layout.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
RecommendedAdhesionSelector
|
||||
|
|
@ -56,6 +103,7 @@ Item
|
|||
width: parent.width
|
||||
// TODO Create a reusable component with these properties to not define them separately for each component
|
||||
labelColumnWidth: parent.firstColumnWidth
|
||||
Layout.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,180 +3,46 @@
|
|||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 2.10
|
||||
|
||||
import UM 1.5 as UM
|
||||
import Cura 1.6 as Cura
|
||||
import Cura 1.7 as Cura
|
||||
import ".."
|
||||
|
||||
Item
|
||||
{
|
||||
id: qualityRow
|
||||
height: childrenRect.height
|
||||
visible: intentSelectionRepeater.count > 1 //Only show selector if there's more options than just "default".
|
||||
|
||||
property real labelColumnWidth: Math.round(width / 3)
|
||||
property real settingsColumnWidth: width - labelColumnWidth
|
||||
|
||||
// Here are the elements that are shown in the left column
|
||||
|
||||
Column
|
||||
RowLayout
|
||||
{
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
ButtonGroup
|
||||
{
|
||||
id: activeProfileButtonGroup
|
||||
exclusive: true
|
||||
onClicked: Cura.IntentManager.selectIntent(button.modelData.intent_category, button.modelData.quality_type)
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
height: childrenRect.height
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
Cura.IconWithText
|
||||
{
|
||||
id: profileLabel
|
||||
source: UM.Theme.getIcon("PrintQuality")
|
||||
text: catalog.i18nc("@label", "Profiles")
|
||||
font: UM.Theme.getFont("medium")
|
||||
width: labelColumnWidth
|
||||
iconSize: UM.Theme.getSize("medium_button_icon").width
|
||||
}
|
||||
UM.SimpleButton
|
||||
{
|
||||
id: resetToDefaultQualityButton
|
||||
|
||||
visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality
|
||||
height: visible ? UM.Theme.getSize("print_setup_icon").height : 0
|
||||
width: height
|
||||
anchors
|
||||
{
|
||||
right: profileLabel.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button")
|
||||
iconSource: UM.Theme.getIcon("ArrowReset")
|
||||
|
||||
onClicked:
|
||||
{
|
||||
// if the current profile is user-created, switch to a built-in quality
|
||||
Cura.MachineManager.resetToUseDefaultQuality()
|
||||
}
|
||||
onEntered:
|
||||
{
|
||||
var tooltipContent = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.")
|
||||
base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), tooltipContent)
|
||||
}
|
||||
onExited: base.hideTooltip()
|
||||
}
|
||||
|
||||
Cura.LabelBar
|
||||
{
|
||||
id: labelbar
|
||||
anchors
|
||||
{
|
||||
left: profileLabel.right
|
||||
right: parent.right
|
||||
verticalCenter: profileLabel.verticalCenter
|
||||
}
|
||||
|
||||
model: Cura.QualityProfilesDropDownMenuModel
|
||||
modelKey: "layer_height"
|
||||
}
|
||||
}
|
||||
|
||||
id: intentRow
|
||||
width: parent.width
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: Cura.IntentCategoryModel {}
|
||||
Item
|
||||
id: intentSelectionRepeater
|
||||
model: Cura.IntentSelectionModel {}
|
||||
|
||||
RecommendedQualityProfileSelectorButton
|
||||
{
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
height: intentCategoryLabel.height
|
||||
profileName: model.name
|
||||
icon: model.icon
|
||||
|
||||
UM.Label
|
||||
{
|
||||
id: intentCategoryLabel
|
||||
text: model.name
|
||||
width: labelColumnWidth - UM.Theme.getSize("section_icon").width
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("section_icon").width + UM.Theme.getSize("narrow_margin").width
|
||||
font: UM.Theme.getFont("medium")
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Cura.RadioCheckbar
|
||||
{
|
||||
anchors
|
||||
selected: Cura.MachineManager.activeIntentCategory == model.intent_category
|
||||
|
||||
onClicked: {
|
||||
var qualityType
|
||||
if (Cura.MachineManager.intentCategoryHasQuality(model.intent_category, Cura.MachineManager.activeQualityType))
|
||||
{
|
||||
left: intentCategoryLabel.right
|
||||
right: parent.right
|
||||
}
|
||||
dataModel: model["qualities"]
|
||||
buttonGroup: activeProfileButtonGroup
|
||||
|
||||
function checkedFunction(modelItem)
|
||||
{
|
||||
if(Cura.MachineManager.hasCustomQuality)
|
||||
{
|
||||
// When user created profile is active, no quality tickbox should be active.
|
||||
return false
|
||||
}
|
||||
|
||||
if(modelItem === null)
|
||||
{
|
||||
return false
|
||||
}
|
||||
return Cura.MachineManager.activeQualityType == modelItem.quality_type && Cura.MachineManager.activeIntentCategory == modelItem.intent_category
|
||||
}
|
||||
|
||||
isCheckedFunction: checkedFunction
|
||||
}
|
||||
|
||||
MouseArea // Intent description tooltip hover area
|
||||
{
|
||||
id: intentDescriptionHoverArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: model.description !== undefined
|
||||
acceptedButtons: Qt.NoButton // react to hover only, don't steal clicks
|
||||
|
||||
Timer
|
||||
{
|
||||
id: intentTooltipTimer
|
||||
interval: 500
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered: base.showTooltip(
|
||||
intentCategoryLabel,
|
||||
Qt.point(-(intentCategoryLabel.x - qualityRow.x) - UM.Theme.getSize("thick_margin").width, 0),
|
||||
model.description
|
||||
)
|
||||
}
|
||||
|
||||
onEntered: intentTooltipTimer.start()
|
||||
onExited:
|
||||
{
|
||||
base.hideTooltip()
|
||||
intentTooltipTimer.stop()
|
||||
qualityType = Cura.MachineManager.activeQualityType
|
||||
} else {
|
||||
qualityType = Cura.MachineManager.getDefaultQualityTypeForIntent(model.intent_category)
|
||||
print(Cura.MachineManager.getDefaultQualityTypeForIntent(model.intent_category))
|
||||
}
|
||||
Cura.IntentManager.selectIntent(model.intent_category, qualityType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 2.10
|
||||
|
||||
import UM 1.5 as UM
|
||||
import Cura 1.7 as Cura
|
||||
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: base
|
||||
height: 60
|
||||
Layout.fillWidth: true
|
||||
color: mouseArea.containsMouse || selected ? UM.Theme.getColor("background_3") : UM.Theme.getColor("background_1")
|
||||
|
||||
property bool selected: false
|
||||
property string profileName: ""
|
||||
property string icon: ""
|
||||
|
||||
signal clicked()
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: base.clicked()
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
width: intentIcon.width
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
bottom: qualityLabel.top
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
topMargin: UM.Theme.getSize("narrow_margin").height
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: intentIcon
|
||||
width: UM.Theme.getSize("recommended_button_icon").width
|
||||
height: UM.Theme.getSize("recommended_button_icon").height
|
||||
UM.ColorImage
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
visible: icon != ""
|
||||
source: UM.Theme.getIcon(icon)
|
||||
color: UM.Theme.getColor("icon")
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: circle
|
||||
anchors.fill: parent
|
||||
radius: width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: icon == ""
|
||||
border.width: UM.Theme.getSize("thick_lining").width
|
||||
border.color: UM.Theme.getColor("text")
|
||||
|
||||
UM.Label
|
||||
{
|
||||
id: initialLabel
|
||||
anchors.centerIn: parent
|
||||
text: profileName.charAt(0).toUpperCase()
|
||||
font: UM.Theme.getFont("small_bold")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
UM.Label
|
||||
{
|
||||
id: qualityLabel
|
||||
text: profileName
|
||||
anchors
|
||||
{
|
||||
bottom: parent.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottomMargin: UM.Theme.getSize("narrow_margin").height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
||||
import UM 1.6 as UM
|
||||
import Cura 1.7 as Cura
|
||||
|
||||
Item
|
||||
{
|
||||
id: recommendedResolutionSelector
|
||||
height: childrenRect.height
|
||||
|
||||
property real labelColumnWidth: Math.round(width / 3)
|
||||
property string _previousResolution: "" //Internal variable to detect changes.
|
||||
Component.onCompleted: _previousResolution = Cura.MachineManager.activeQualityType;
|
||||
|
||||
visible: visibilityPreset.count > 0 //Only show if there are quality types to select from.
|
||||
|
||||
Cura.IconWithText
|
||||
{
|
||||
id: resolutionTitle
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
source: UM.Theme.getIcon("PrintQuality")
|
||||
text: catalog.i18nc("@label", "Resolution")
|
||||
width: labelColumnWidth
|
||||
height: parent.height
|
||||
spacing: UM.Theme.getSize("thick_margin").width
|
||||
iconSize: UM.Theme.getSize("medium_button_icon").width
|
||||
}
|
||||
|
||||
Cura.ComboBox
|
||||
{
|
||||
id: visibilityPreset
|
||||
implicitHeight: UM.Theme.getSize("combobox").height
|
||||
implicitWidth: UM.Theme.getSize("combobox").width
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
textRole: "display_text"
|
||||
textFormat: Text.StyledText
|
||||
|
||||
model: Cura.ActiveIntentQualitiesModel{}
|
||||
|
||||
currentIndex:
|
||||
{
|
||||
var current_quality_type = Cura.MachineManager.activeQualityType
|
||||
|
||||
var index = 0
|
||||
for (var i = 0; i < model.count; i++)
|
||||
{
|
||||
if (model.getItem(i).quality_type == current_quality_type)
|
||||
{
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
return index
|
||||
}
|
||||
|
||||
onActivated:
|
||||
{
|
||||
var selected_item = model.getItem(currentIndex)
|
||||
Cura.IntentManager.selectIntent(selected_item.intent_category, selected_item.quality_type)
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.IntentManager
|
||||
function onIntentCategoryChanged()
|
||||
{
|
||||
if(recommendedResolutionSelector._previousResolution !== Cura.MachineManager.activeQualityType)
|
||||
{
|
||||
visibilityPreset.pulse();
|
||||
}
|
||||
recommendedResolutionSelector._previousResolution = Cura.MachineManager.activeQualityType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
//Copyright (c) 2022 Ultimaker B.V.
|
||||
//Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.15
|
||||
|
||||
import Cura 1.6 as Cura
|
||||
import UM 1.6 as UM
|
||||
|
||||
//Message showing the user that the configuration they have selected has no profiles.
|
||||
Column
|
||||
{
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
Row
|
||||
{
|
||||
width: parent.width
|
||||
|
||||
spacing: UM.Theme.getSize("thin_margin").width
|
||||
|
||||
UM.StatusIcon
|
||||
{
|
||||
width: UM.Theme.getSize("notification_icon").width
|
||||
status: UM.StatusIcon.Status.ERROR
|
||||
}
|
||||
|
||||
UM.Label
|
||||
{
|
||||
width: parent.width
|
||||
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
text: catalog.i18nc("@error", "Configuration not supported")
|
||||
}
|
||||
}
|
||||
|
||||
UM.Label
|
||||
{
|
||||
width: parent.width
|
||||
|
||||
text: catalog.i18nc("@message:text %1 is the name the printer uses for 'nozzle'.", "No profiles are available for the selected material/%1 configuration. Please change your configuration."
|
||||
).arg(Cura.MachineManager.activeDefinitionVariantsName)
|
||||
}
|
||||
|
||||
Cura.TertiaryButton
|
||||
{
|
||||
anchors.right: parent.right
|
||||
|
||||
text: catalog.i18nc("@button:label", "Learn more")
|
||||
textFont: UM.Theme.getFont("default")
|
||||
iconSource: UM.Theme.getIcon("LinkExternal")
|
||||
isIconOnRightSide: true
|
||||
|
||||
onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012909099")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue