Add the row for the support selection in the recommended mode

Contributes to CURA-5941.
This commit is contained in:
Diego Prado Gesto 2018-12-02 19:01:54 +01:00
parent 1caccfb577
commit 1cea36b08a
4 changed files with 134 additions and 95 deletions

View file

@ -57,13 +57,13 @@ Item
// TODO Create a reusable component with these properties to not define them separately for each component // TODO Create a reusable component with these properties to not define them separately for each component
labelColumnWidth: parent.firstColumnWidth labelColumnWidth: parent.firstColumnWidth
} }
//
// RecommendedSupportSelector RecommendedSupportSelector
// { {
// width: parent.width width: parent.width
// // TODO Create a reusable component with these properties to not define them separately for each component // TODO Create a reusable component with these properties to not define them separately for each component
// property real firstColumnWidth: parent.labelColumnWidth labelColumnWidth: parent.firstColumnWidth
// } }
// //
@ -128,7 +128,6 @@ Item
// } // }
} }
UM.SettingPropertyProvider UM.SettingPropertyProvider
{ {
id: platformAdhesionType id: platformAdhesionType

View file

@ -8,24 +8,45 @@ import QtQuick.Controls.Styles 1.4
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
// //
// Enable support // Enable support
// //
Row Item
{ {
id: enableSupportRow
height: childrenRect.height
property real labelColumnWidth: Math.round(width / 3)
Cura.IconWithText Cura.IconWithText
{ {
id: enableSupportLabel id: enableSupportRowTitle
anchors.top: parent.top
anchors.left: parent.left
visible: enableSupportCheckBox.visible visible: enableSupportCheckBox.visible
source: UM.Theme.getIcon("category_support") source: UM.Theme.getIcon("category_support")
text: catalog.i18nc("@label", "Support") text: catalog.i18nc("@label", "Support")
width: labelColumnWidth width: labelColumnWidth
} }
Item
{
id: enableSupportContainer
height: childrenRect.height
anchors
{
left: enableSupportRowTitle.right
right: parent.right
verticalCenter: enableSupportRowTitle.verticalCenter
}
CheckBox CheckBox
{ {
id: enableSupportCheckBox id: enableSupportCheckBox
anchors.verticalCenter: parent.verticalCenter
property alias _hovered: enableSupportMouseArea.containsMouse property alias _hovered: enableSupportMouseArea.containsMouse
style: UM.Theme.styles.checkbox style: UM.Theme.styles.checkbox
@ -41,20 +62,37 @@ Row
hoverEnabled: true hoverEnabled: true
onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True")
onEntered: base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), onEntered:
{
base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportContainer.x - UM.Theme.getSize("thick_margin").width, 0),
catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")) catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing."))
}
onExited: base.hideTooltip() onExited: base.hideTooltip()
} }
} }
ComboBox ComboBox
{ {
id: supportExtruderCombobox id: supportExtruderCombobox
height: UM.Theme.getSize("print_setup_support_extruder_selector").height
anchors
{
left: enableSupportCheckBox.right
right: parent.right
leftMargin: UM.Theme.getSize("thick_margin").width
rightMargin: UM.Theme.getSize("thick_margin").width
verticalCenter: parent.verticalCenter
}
style: UM.Theme.styles.combobox_color
enabled: base.settingsEnabled
visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1)
textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started
model: extruderModel model: extruderModel
property alias _hovered: supportExtruderMouseArea.containsMouse
property string color_override: "" // for manually setting values property string color_override: "" // for manually setting values
property string color: // is evaluated automatically, but the first time is before extruderModel being filled property string color: // is evaluated automatically, but the first time is before extruderModel being filled
{ {
@ -64,17 +102,6 @@ Row
return (current_extruder.color) ? current_extruder.color : ""; return (current_extruder.color) ? current_extruder.color : "";
} }
textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started
width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width
height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0
Behavior on height { NumberAnimation { duration: 100 } }
style: UM.Theme.styles.combobox_color
enabled: base.settingsEnabled
property alias _hovered: supportExtruderMouseArea.containsMouse
currentIndex: currentIndex:
{ {
if (supportExtruderNr.properties == null) if (supportExtruderNr.properties == null)
@ -103,7 +130,7 @@ Row
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
onEntered: onEntered:
{ {
base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), base.showTooltip(supportExtruderCombobox, Qt.point(-enableSupportContainer.x - supportExtruderCombobox.x - UM.Theme.getSize("thick_margin").width, 0),
catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air."));
} }
onExited: base.hideTooltip() onExited: base.hideTooltip()
@ -119,6 +146,7 @@ Row
} }
} }
} }
}
ListModel ListModel
{ {
@ -160,6 +188,15 @@ Row
storeIndex: 0 storeIndex: 0
} }
UM.SettingPropertyProvider
{
id: machineExtruderCount
containerStack: Cura.MachineManager.activeMachine
key: "machine_extruder_count"
watchedProperties: ["value"]
storeIndex: 0
}
function populateExtruderModel() function populateExtruderModel()
{ {
extruderModel.clear() extruderModel.clear()

View file

@ -413,11 +413,11 @@ QtObject
border.width: Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border"); border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border");
radius: UM.Theme.getSize("setting_control_radius").width
} }
label: Item label: Item
{ {
Label Label
{ {
anchors.left: parent.left anchors.left: parent.left
@ -465,11 +465,11 @@ QtObject
color: !enabled ? UM.Theme.getColor("setting_control_disabled") : control._hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control") color: !enabled ? UM.Theme.getColor("setting_control_disabled") : control._hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control")
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control._hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control._hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
radius: UM.Theme.getSize("setting_control_radius").width
} }
label: Item label: Item
{ {
Label Label
{ {
anchors.left: parent.left anchors.left: parent.left
@ -486,7 +486,7 @@ QtObject
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
Rectangle UM.RecolorImage
{ {
id: swatch id: swatch
height: Math.round(UM.Theme.getSize("setting_control").height / 2) height: Math.round(UM.Theme.getSize("setting_control").height / 2)
@ -494,9 +494,9 @@ QtObject
anchors.right: downArrow.left anchors.right: downArrow.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4) anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4)
radius: Math.round(width / 2) sourceSize.width: width
border.width: UM.Theme.getSize("default_lining").width sourceSize.height: height
border.color: UM.Theme.getColor("lining") source: UM.Theme.getIcon("extruder_button")
color: (control.color_override !== "") ? control.color_override : control.color color: (control.color_override !== "") ? control.color_override : control.color
} }
@ -575,7 +575,7 @@ QtObject
color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox"); color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox");
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0 radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width
border.width: Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border"); border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border");
@ -628,6 +628,7 @@ QtObject
border.width: Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border"); border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border");
radius: UM.Theme.getSize("setting_control_radius").width
color: Theme.getColor("setting_validation_ok"); color: Theme.getColor("setting_validation_ok");

View file

@ -206,11 +206,11 @@
"setting_control": [255, 255, 255, 255], "setting_control": [255, 255, 255, 255],
"setting_control_selected": [31, 36, 39, 255], "setting_control_selected": [31, 36, 39, 255],
"setting_control_highlight": [255, 255, 255, 255], "setting_control_highlight": [255, 255, 255, 255],
"setting_control_border": [127, 127, 127, 255], "setting_control_border": [199, 199, 199, 255],
"setting_control_border_highlight": [50, 130, 255, 255], "setting_control_border_highlight": [50, 130, 255, 255],
"setting_control_text": [27, 27, 27, 255], "setting_control_text": [35, 35, 35, 255],
"setting_control_depth_line": [127, 127, 127, 255], "setting_control_depth_line": [199, 199, 199, 255],
"setting_control_button": [127, 127, 127, 255], "setting_control_button": [199, 199, 199, 255],
"setting_control_button_hover": [70, 84, 113, 255], "setting_control_button_hover": [70, 84, 113, 255],
"setting_control_disabled": [245, 245, 245, 255], "setting_control_disabled": [245, 245, 245, 255],
"setting_control_disabled_text": [127, 127, 127, 255], "setting_control_disabled_text": [127, 127, 127, 255],
@ -377,6 +377,7 @@
"print_setup_slider_groove": [0.16, 0.16], "print_setup_slider_groove": [0.16, 0.16],
"print_setup_slider_handle": [1.0, 1.0], "print_setup_slider_handle": [1.0, 1.0],
"print_setup_slider_tickmarks": [0.32, 0.32], "print_setup_slider_tickmarks": [0.32, 0.32],
"print_setup_support_extruder_selector": [18.2, 2.5],
"configuration_selector_mode_tabs": [0.0, 3.0], "configuration_selector_mode_tabs": [0.0, 3.0],
@ -415,6 +416,7 @@
"setting": [25.0, 1.8], "setting": [25.0, 1.8],
"setting_control": [10.0, 2.0], "setting_control": [10.0, 2.0],
"setting_control_radius": [0.15, 0.15],
"setting_control_depth_margin": [1.4, 0.0], "setting_control_depth_margin": [1.4, 0.0],
"setting_preferences_button_margin": [4, 0.0], "setting_preferences_button_margin": [4, 0.0],
"setting_control_margin": [0.0, 0.0], "setting_control_margin": [0.0, 0.0],