diff --git a/resources/qml/ActionPanelWidget.qml b/resources/qml/ActionPanelWidget.qml index d1fe999731..b4a9b4e4ec 100644 --- a/resources/qml/ActionPanelWidget.qml +++ b/resources/qml/ActionPanelWidget.qml @@ -37,6 +37,7 @@ Rectangle } Behavior on height { NumberAnimation { duration: 100 } } + Behavior on width { NumberAnimation { duration: 100 } } Component { diff --git a/resources/qml/SliceProcessWidget.qml b/resources/qml/SliceProcessWidget.qml index 67005cb133..561e38c372 100644 --- a/resources/qml/SliceProcessWidget.qml +++ b/resources/qml/SliceProcessWidget.qml @@ -12,7 +12,9 @@ Column { id: widget - spacing: UM.Theme.getSize("default_margin").height + width: UM.Theme.getSize("action_panel_button").width + + spacing: UM.Theme.getSize("thin_margin").height UM.I18nCatalog { @@ -23,30 +25,84 @@ Column property real progress: UM.Backend.progress property int backendState: UM.Backend.state - Rectangle + Item + { + id: message + width: parent.width + height: childrenRect.height + visible: widget.backendState == 4 + + UM.RecolorImage + { + id: warningImage + + anchors.left: parent.left + + source: UM.Theme.getIcon("warning") + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + + color: UM.Theme.getColor("warning") + } + + Label + { + id: unableToSliceLabel + anchors.left: warningImage.right + anchors.leftMargin: UM.Theme.getSize("thin_margin").width + text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") + color: UM.Theme.getColor("warning") + font: UM.Theme.getFont("very_small") + } + } + + // Progress bar, only visible when the backend is in the process of slice the printjob + ProgressBar { id: progressBar width: parent.width height: UM.Theme.getSize("progressbar").height + value: progress visible: widget.backendState == 2 - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_background") - Rectangle + background: Rectangle { - width: Math.max(parent.width * base.progress) - height: parent.height + anchors.fill: parent radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_control") + color: UM.Theme.getColor("progressbar_background") + } + + contentItem: Item + { + anchors.fill: parent + Rectangle + { + width: progressBar.visualPosition * parent.width + height: parent.height + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_control") + } } } Cura.ActionButton { id: prepareButton - width: UM.Theme.getSize("action_panel_button").width + width: parent.width height: UM.Theme.getSize("action_panel_button").height - text: widget.backendState == 1 ? catalog.i18nc("@button", "Prepare") : catalog.i18nc("@button", "Cancel") + text: autoSlice ? catalog.i18nc("@button", "Auto slicing...") : (widget.backendState == 1 ? catalog.i18nc("@button", "Slice") : catalog.i18nc("@button", "Cancel")) + enabled: !autoSlice + + // Get the current value from the preferences + property bool autoSlice: UM.Preferences.getValue("general/auto_slice") + + disabledColor: "transparent" + textDisabledColor: UM.Theme.getColor("primary") + outlineDisabledColor: "transparent" + onClicked: { if ([1, 5].indexOf(widget.backendState) != -1) @@ -59,4 +115,15 @@ Column } } } + + // React when the user changes the preference of having the auto slice enabled + Connections + { + target: UM.Preferences + onPreferenceChanged: + { + var autoSlice = UM.Preferences.getValue("general/auto_slice") + prepareButton.autoSlice = autoSlice + } + } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d695ba12cf..1473a75eec 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -116,6 +116,7 @@ "text_scene_hover": [70, 84, 113, 255], "error": [255, 140, 0, 255], + "warning": [255, 190, 35, 255], "button": [31, 36, 39, 255], "button_hover": [68, 72, 75, 255], @@ -210,7 +211,7 @@ "material_compatibility_warning": [0, 0, 0, 255], "progressbar_background": [245, 245, 245, 255], - "progressbar_control": [31, 36, 39, 255], + "progressbar_control": [50, 130, 255, 255], "slider_groove": [245, 245, 245, 255], "slider_groove_border": [127, 127, 127, 255],