Merge branch 'ui_rework_4_0' into CURA-5941_restyle_setting_dropdown

This commit is contained in:
Diego Prado Gesto 2018-12-06 16:35:07 +01:00
commit 3b8b70bddf
22 changed files with 2283 additions and 120 deletions

View file

@ -19,6 +19,7 @@ Item
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
height: contentHeight
renderType: Text.NativeRendering
anchors
{

View file

@ -14,7 +14,7 @@ Button
property var configuration: null
hoverEnabled: true
height: childrenRect.height
height: background.height
background: Rectangle
{

View file

@ -28,7 +28,24 @@ Column
{
id: container
width: parent.width
height: Math.min(configurationList.contentHeight, 350 * screenScaleFactor)
readonly property int maximumHeight: 350 * screenScaleFactor
height: Math.round(Math.min(configurationList.height, maximumHeight))
contentHeight: configurationList.height
clip: true
ScrollBar.vertical.policy: (configurationList.height > maximumHeight) ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff //The AsNeeded policy also hides it when the cursor is away, and we don't want that.
ScrollBar.vertical.background: Rectangle
{
implicitWidth: UM.Theme.getSize("scrollbar").width
radius: width / 2
color: UM.Theme.getColor("scrollbar_background")
}
ScrollBar.vertical.contentItem: Rectangle
{
implicitWidth: UM.Theme.getSize("scrollbar").width
radius: width / 2
color: UM.Theme.getColor(parent.pressed ? "scrollbar_handle_down" : parent.hovered ? "scrollbar_handle_hover" : "scrollbar_handle")
}
ButtonGroup
{
@ -39,8 +56,9 @@ Column
{
id: configurationList
spacing: Math.round(UM.Theme.getSize("default_margin").height / 2)
width: container.width
width: container.width - ((height > container.maximumHeight) ? container.ScrollBar.vertical.background.width : 0) //Make room for scroll bar if there is any.
contentHeight: childrenRect.height
height: childrenRect.height
section.property: "modelData.printerType"
section.criteria: ViewSection.FullString

View file

@ -44,6 +44,7 @@ Cura.ExpandablePopup
orientation: ListView.Horizontal
anchors.fill: parent
model: extrudersModel
visible: base.enabled
delegate: Item
{
@ -69,6 +70,7 @@ Cura.ExpandablePopup
elide: Text.ElideRight
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text_inactive")
renderType: Text.NativeRendering
anchors
{
@ -86,6 +88,7 @@ Cura.ExpandablePopup
elide: Text.ElideRight
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
renderType: Text.NativeRendering
anchors
{
@ -100,6 +103,23 @@ Cura.ExpandablePopup
}
}
//Disable the menu if there are no materials, variants or build plates to change.
function updateEnabled()
{
var active_definition_id = Cura.MachineManager.activeMachine.definition.id;
var has_materials = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_materials");
var has_variants = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_variants");
var has_buildplates = Cura.ContainerManager.getContainerMetaDataEntry(active_definition_id, "has_variant_buildplates");
base.enabled = has_materials || has_variants || has_buildplates; //Only let it drop down if there is any configuration that you could change.
}
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged: base.updateEnabled();
}
Component.onCompleted: updateEnabled();
contentItem: Column
{
id: popupItem
@ -136,8 +156,9 @@ Cura.ExpandablePopup
{
id: separator
visible: buttonBar.visible
x: -contentPadding
width: parent.width
width: base.width
height: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("lining")

View file

@ -26,6 +26,7 @@ Item
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
height: contentHeight
renderType: Text.NativeRendering
anchors
{
@ -150,6 +151,8 @@ Item
color: UM.Theme.getColor("text")
height: parent.height
width: selectors.textWidth
visible: extrudersModel.count > 1
renderType: Text.NativeRendering
}
OldControls.CheckBox
@ -186,6 +189,8 @@ Item
color: UM.Theme.getColor("text")
height: parent.height
width: selectors.textWidth
visible: materialSelection.visible
renderType: Text.NativeRendering
}
OldControls.ToolButton
@ -223,6 +228,8 @@ Item
color: UM.Theme.getColor("text")
height: parent.height
width: selectors.textWidth
visible: variantSelection.visible
renderType: Text.NativeRendering
}
OldControls.ToolButton