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

@ -5,16 +5,20 @@ import QtQuick 2.7
import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0 // For the dropshadow
import UM 1.1 as UM
import Cura 1.0 as Cura
Button
{
id: button
property alias iconSource: buttonIconLeft.source
property bool isIconOnRightSide: false
property alias iconSource: buttonIconLeft.source
property alias textFont: buttonText.font
property alias cornerRadius: backgroundRect.radius
property alias tooltip: tooltip.text
property alias cornerSide: backgroundRect.cornerSide
property color color: UM.Theme.getColor("primary")
property color hoverColor: UM.Theme.getColor("primary_hover")
property color disabledColor: color
@ -24,9 +28,9 @@ Button
property color outlineColor: color
property color outlineHoverColor: hoverColor
property color outlineDisabledColor: outlineColor
hoverEnabled: true
property alias shadowColor: shadow.color
property alias shadowEnabled: shadow.visible
// This property is used to indicate whether the button has a fixed width or the width would depend on the contents
// Be careful when using fixedWidthMode, the translated texts can be too long that they won't fit. In any case,
// we elide the text to the right so the text will be cut off with the three dots at the end.
@ -35,6 +39,7 @@ Button
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
height: UM.Theme.getSize("action_button").height
hoverEnabled: true
contentItem: Row
{
@ -81,9 +86,10 @@ Button
}
}
background: Rectangle
background: Cura.RoundedRectangle
{
id: backgroundRect
cornerSide: Cura.RoundedRectangle.Direction.All
color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor
radius: UM.Theme.getSize("action_button_radius").width
border.width: UM.Theme.getSize("default_lining").width

View file

@ -17,6 +17,7 @@ Item
id: saveToButton
height: parent.height
fixedWidthMode: true
cornerSide: deviceSelectionMenu.visible ? Cura.RoundedRectangle.Direction.Left : Cura.RoundedRectangle.Direction.All
anchors
{
@ -44,6 +45,7 @@ Item
shadowEnabled: true
shadowColor: UM.Theme.getColor("primary_shadow")
cornerSide: Cura.RoundedRectangle.Direction.Right
anchors
{

View file

@ -101,16 +101,24 @@ Column
}
}
Row
Item
{
id: buttonRow
spacing: UM.Theme.getSize("default_margin").width
width: parent.width
anchors.right: parent.right
anchors.left: parent.left
height: UM.Theme.getSize("action_button").height
Cura.SecondaryButton
{
id: previewStageShortcut
anchors
{
left: parent.left
right: outputDevicesButton.left
rightMargin: UM.Theme.getSize("default_margin").width
}
height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
@ -125,6 +133,9 @@ Column
Cura.OutputDevicesActionButton
{
id: outputDevicesButton
anchors.right: parent.right
width: previewStageShortcut.visible ? UM.Theme.getSize("action_button").width : parent.width
height: UM.Theme.getSize("action_button").height
}

View file

@ -88,6 +88,54 @@ UM.MainWindow
window: base
}
Item
{
id: headerBackground
anchors
{
top: applicationMenu.bottom
left: parent.left
right: parent.right
}
height: stageMenu.source != "" ? Math.round(mainWindowHeader.height + stageMenu.height / 2) : mainWindowHeader.height
LinearGradient
{
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(parent.width, 0)
gradient: Gradient
{
GradientStop
{
position: 0.0
color: UM.Theme.getColor("main_window_header_background")
}
GradientStop
{
position: 0.5
color: UM.Theme.getColor("main_window_header_background_gradient")
}
GradientStop
{
position: 1.0
color: UM.Theme.getColor("main_window_header_background")
}
}
}
// This is the new fancy pattern
Image
{
id: backgroundPattern
anchors.fill: parent
fillMode: Image.Tile
source: UM.Theme.getImage("header_pattern")
horizontalAlignment: Image.AlignLeft
verticalAlignment: Image.AlignTop
}
}
MainWindowHeader
{
id: mainWindowHeader
@ -144,44 +192,6 @@ UM.MainWindow
}
}
Rectangle
{
id: stageMenuBackground
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
visible: stageMenu.source != ""
height: visible ? Math.round(UM.Theme.getSize("stage_menu").height / 2) : 0
LinearGradient
{
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(parent.width, 0)
gradient: Gradient
{
GradientStop
{
position: 0.0
color: UM.Theme.getColor("main_window_header_background")
}
GradientStop
{
position: 0.5
color: UM.Theme.getColor("main_window_header_background_gradient")
}
GradientStop
{
position: 1.0
color: UM.Theme.getColor("main_window_header_background")
}
}
}
}
JobSpecs
{
id: jobSpecs
@ -250,7 +260,8 @@ UM.MainWindow
anchors
{
top: stageMenuBackground.bottom
// Align to the top of the stageMenu since the stageMenu may not exist
top: parent.top
left: parent.left
right: parent.right
bottom: parent.bottom

View file

@ -35,9 +35,9 @@ UM.Dialog
{
id: logo
width: (base.minimumWidth * 0.85) | 0
height: (width * (1/4.25)) | 0
height: (width * (UM.Theme.getSize("logo").height / UM.Theme.getSize("logo").width)) | 0
source: UM.Theme.getImage("logo")
source: UM.Theme.getImage("logo_about")
anchors.top: parent.top
anchors.topMargin: ((base.minimumWidth - width) / 2) | 0

View file

@ -32,6 +32,8 @@ Item
property color headerActiveColor: UM.Theme.getColor("secondary")
property color headerHoverColor: UM.Theme.getColor("action_button_hovered")
property alias enabled: mouseArea.enabled
// Defines the alignment of the content with respect of the headerItem, by default to the right
property int contentAlignment: ExpandableComponent.ContentAlignment.AlignRight
@ -105,10 +107,8 @@ Item
verticalCenter: parent.verticalCenter
margins: background.padding
}
sourceSize.width: width
sourceSize.height: height
source: UM.Theme.getIcon("pencil")
visible: source != ""
visible: source != "" && base.enabled
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
color: UM.Theme.getColor("text")

View file

@ -32,6 +32,8 @@ Item
property color headerActiveColor: UM.Theme.getColor("secondary")
property color headerHoverColor: UM.Theme.getColor("action_button_hovered")
property alias enabled: mouseArea.enabled
// Defines the alignment of the content with respect of the headerItem, by default to the right
property int contentAlignment: ExpandablePopup.ContentAlignment.AlignRight
@ -125,10 +127,8 @@ Item
verticalCenter: parent.verticalCenter
margins: background.padding
}
sourceSize.width: width
sourceSize.height: height
source: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
visible: source != ""
visible: source != "" && base.enabled
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
color: UM.Theme.getColor("text")

View file

@ -12,38 +12,13 @@ import QtGraphicalEffects 1.0
import "../Account"
Rectangle
Item
{
id: base
implicitHeight: UM.Theme.getSize("main_window_header").height
implicitWidth: UM.Theme.getSize("main_window_header").width
LinearGradient
{
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(parent.width, 0)
gradient: Gradient
{
GradientStop
{
position: 0.0
color: UM.Theme.getColor("main_window_header_background")
}
GradientStop
{
position: 0.5
color: UM.Theme.getColor("main_window_header_background_gradient")
}
GradientStop
{
position: 1.0
color: UM.Theme.getColor("main_window_header_background")
}
}
}
Image
{
id: logo

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

View file

@ -24,29 +24,52 @@ Cura.ExpandablePopup
name: "cura"
}
headerItem: Cura.IconLabel
headerItem: Item
{
text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
source:
{
if (isNetworkPrinter)
{
if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1)
{
return UM.Theme.getIcon("printer_group")
}
return UM.Theme.getIcon("printer_single")
}
return ""
}
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("text")
iconSize: UM.Theme.getSize("machine_selector_icon").width
implicitHeight: icon.height
UM.RecolorImage
{
id: icon
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
source:
{
if (isNetworkPrinter)
{
if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1)
{
return UM.Theme.getIcon("printer_group")
}
return UM.Theme.getIcon("printer_single")
}
return ""
}
width: UM.Theme.getSize("machine_selector_icon").width
height: width
color: UM.Theme.getColor("machine_selector_printer_icon")
visible: source != ""
}
Label
{
id: label
anchors.left: icon.visible ? icon.right : parent.left
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("thin_margin").width
anchors.verticalCenter: icon.verticalCenter
text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
elide: Text.ElideRight
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
}
UM.RecolorImage
{
anchors
{
bottom: parent.bottom

View file

@ -13,7 +13,7 @@ Column
Label
{
text: catalog.i18nc("@label", "Network connected printers")
text: catalog.i18nc("@label", "Connected printers")
visible: networkedPrintersModel.items.length > 0
leftPadding: UM.Theme.getSize("default_margin").width
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0

View file

@ -73,6 +73,8 @@ Cura.ExpandablePopup
{
id: viewSelectorPopup
width: viewSelector.width - 2 * viewSelector.contentPadding
leftPadding: UM.Theme.getSize("default_lining").width
rightPadding: UM.Theme.getSize("default_lining").width
// For some reason the height/width of the column gets set to 0 if this is not set...
Component.onCompleted:
@ -90,7 +92,7 @@ Cura.ExpandablePopup
{
id: viewsSelectorButton
text: model.name
width: parent.width
width: parent.width - viewSelectorPopup.leftPadding - viewSelectorPopup.rightPadding
height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width