Fix merge conflicts from ui_rework_40

CURA-5943
This commit is contained in:
Lipu Fei 2018-11-29 15:27:06 +01:00
commit 6db52dde46
130 changed files with 2998 additions and 1740 deletions

View file

@ -11,20 +11,16 @@ Row
{
spacing: UM.Theme.getSize("default_margin").width
Cura.ActionButton
Cura.SecondaryButton
{
width: UM.Theme.getSize("account_button").width
height: UM.Theme.getSize("account_button").height
text: catalog.i18nc("@button", "Create account")
color: UM.Theme.getColor("secondary")
hoverColor: UM.Theme.getColor("secondary")
textColor: UM.Theme.getColor("main_window_header_button_text_active")
textHoverColor: UM.Theme.getColor("main_window_header_button_text_active")
onClicked: Qt.openUrlExternally("https://account.ultimaker.com/app/create")
fixedWidthMode: true
}
Cura.ActionButton
Cura.PrimaryButton
{
width: UM.Theme.getSize("account_button").width
height: UM.Theme.getSize("account_button").height

View file

@ -11,20 +11,16 @@ Row
{
spacing: UM.Theme.getSize("default_margin").width
Cura.ActionButton
Cura.SecondaryButton
{
width: UM.Theme.getSize("account_button").width
height: UM.Theme.getSize("account_button").height
text: catalog.i18nc("@button", "Manage account")
color: UM.Theme.getColor("secondary")
hoverColor: UM.Theme.getColor("secondary")
textColor: UM.Theme.getColor("main_window_header_button_text_active")
textHoverColor: UM.Theme.getColor("main_window_header_button_text_active")
onClicked: Qt.openUrlExternally("https://account.ultimaker.com")
fixedWidthMode: true
}
Cura.ActionButton
Cura.PrimaryButton
{
width: UM.Theme.getSize("account_button").width
height: UM.Theme.getSize("account_button").height

View file

@ -3,27 +3,34 @@
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0 // For the dropshadow
import UM 1.1 as UM
Button
{
id: button
property alias cursorShape: mouseArea.cursorShape
property alias iconSource: buttonIcon.source
property alias textFont: buttonText.font
property alias cornerRadius: backgroundRect.radius
property alias tooltip: tooltip.text
property var color: UM.Theme.getColor("primary")
property var hoverColor: UM.Theme.getColor("primary_hover")
property var disabledColor: color
property var textColor: UM.Theme.getColor("button_text")
property var textHoverColor: UM.Theme.getColor("button_text_hover")
property var textDisabledColor: textColor
property var outlineColor: color
property var outlineHoverColor: hoverColor
property var outlineDisabledColor: outlineColor
property color color: UM.Theme.getColor("primary")
property color hoverColor: UM.Theme.getColor("primary_hover")
property color disabledColor: color
property color textColor: UM.Theme.getColor("button_text")
property color textHoverColor: textColor
property color textDisabledColor: textColor
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.
@ -68,6 +75,19 @@ Button
border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor
}
DropShadow
{
id: shadow
// Don't blur the shadow
radius: 0
anchors.fill: backgroundRect
source: backgroundRect
verticalOffset: 2
visible: false
// Should always be drawn behind the background.
z: backgroundRect.z - 1
}
ToolTip
{
id: tooltip
@ -75,12 +95,4 @@ Button
delay: 500
visible: text != "" && button.hovered
}
MouseArea
{
id: mouseArea
anchors.fill: parent
onPressed: mouse.accepted = false
hoverEnabled: true
}
}

View file

@ -12,7 +12,7 @@ Item
{
id: widget
Cura.ActionButton
Cura.PrimaryButton
{
id: saveToButton
height: parent.height
@ -42,6 +42,9 @@ Item
id: deviceSelectionMenu
height: parent.height
shadowEnabled: true
shadowColor: UM.Theme.getColor("primary_shadow")
anchors
{
top: parent.top
@ -65,7 +68,7 @@ Item
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
contentItem: Column
contentItem: ColumnLayout
{
Repeater
{
@ -77,7 +80,7 @@ Item
color: "transparent"
cornerRadius: 0
hoverColor: UM.Theme.getColor("primary")
Layout.fillWidth: true
onClicked:
{
UM.OutputDeviceManager.setActiveDevice(model.id)
@ -91,10 +94,7 @@ Item
{
opacity: visible ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 100 } }
radius: UM.Theme.getSize("default_radius").width
color: UM.Theme.getColor("action_panel_secondary")
border.color: UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width
}
}
}

View file

@ -18,6 +18,7 @@ Column
id: widget
spacing: UM.Theme.getSize("thin_margin").height
property bool preSlicedData: PrintInformation.preSliced
UM.I18nCatalog
{
@ -48,7 +49,7 @@ Column
id: estimatedTime
width: parent.width
text: PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long)
text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long)
source: UM.Theme.getIcon("clock")
font: UM.Theme.getFont("small")
}
@ -63,6 +64,10 @@ Column
text:
{
if (preSlicedData)
{
return catalog.i18nc("@label", "No cost estimation available")
}
var totalLengths = 0
var totalWeights = 0
if (printMaterialLengths)
@ -86,6 +91,7 @@ Column
PrintInformationWidget
{
id: printInformationPanel
visible: !preSlicedData
anchors
{
@ -101,20 +107,18 @@ Column
spacing: UM.Theme.getSize("default_margin").width
width: parent.width
Cura.ActionButton
Cura.SecondaryButton
{
id: previewStageShortcut
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
height: UM.Theme.getSize("action_panel_button").height
text: catalog.i18nc("@button", "Preview")
color: UM.Theme.getColor("secondary")
hoverColor: UM.Theme.getColor("secondary")
textColor: UM.Theme.getColor("primary")
textHoverColor: UM.Theme.getColor("text")
onClicked: UM.Controller.setActiveStage("PreviewStage")
visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage"
shadowEnabled: true
shadowColor: UM.Theme.getColor("action_button_disabled_shadow")
}
Cura.OutputDevicesActionButton

View file

@ -40,9 +40,21 @@ Column
}
}
Label
{
id: autoSlicingLabel
width: parent.width
visible: prepareButtons.autoSlice && widget.backendState == UM.Backend.Processing
text: catalog.i18nc("@label:PrintjobStatus", "Auto slicing...")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("very_small")
renderType: Text.NativeRendering
}
Cura.IconLabel
{
id: message
id: unableToSliceMessage
width: parent.width
visible: widget.backendState == UM.Backend.Error
@ -81,38 +93,41 @@ Column
}
}
Cura.ActionButton
{
id: prepareButton
width: parent.width
height: UM.Theme.getSize("action_panel_button").height
fixedWidthMode: true
text:
{
if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1)
{
return catalog.i18nc("@button", "Slice")
}
if (autoSlice)
{
return catalog.i18nc("@button", "Auto slicing...")
}
return catalog.i18nc("@button", "Cancel")
}
enabled: !autoSlice && !disabledSlice
Item
{
id: prepareButtons
// Get the current value from the preferences
property bool autoSlice: UM.Preferences.getValue("general/auto_slice")
// Disable the slice process when
property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error].indexOf(widget.backendState) != -1
disabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled") : "transparent"
textDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_text") : UM.Theme.getColor("primary")
outlineDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_border") : "transparent"
width: parent.width
height: UM.Theme.getSize("action_panel_button").height
visible: !autoSlice
Cura.PrimaryButton
{
id: sliceButton
fixedWidthMode: true
anchors.fill: parent
text: catalog.i18nc("@button", "Slice")
enabled: widget.backendState != UM.Backend.Error
visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error
onClicked: sliceOrStopSlicing()
}
onClicked: sliceOrStopSlicing()
Cura.SecondaryButton
{
id: cancelButton
fixedWidthMode: true
anchors.fill: parent
text: catalog.i18nc("@button", "Cancel")
enabled: sliceButton.enabled
visible: !sliceButton.visible
onClicked: sliceOrStopSlicing()
}
}
// React when the user changes the preference of having the auto slice enabled
Connections
{
@ -120,7 +135,7 @@ Column
onPreferenceChanged:
{
var autoSlice = UM.Preferences.getValue("general/auto_slice")
prepareButton.autoSlice = autoSlice
prepareButtons.autoSlice = autoSlice
}
}

View file

@ -0,0 +1,10 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.0
QtObject
{
property real width: 0
property color color: "black"
}

View file

@ -6,6 +6,7 @@ import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import QtGraphicalEffects 1.0
import UM 1.3 as UM
import Cura 1.1 as Cura
@ -153,7 +154,31 @@ UM.MainWindow
}
visible: stageMenu.source != ""
height: Math.round(UM.Theme.getSize("stage_menu").height / 2)
color: UM.Theme.getColor("main_window_header_background")
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")
}
}
}
}
Connections
@ -187,7 +212,7 @@ UM.MainWindow
verticalCenter: parent.verticalCenter
left: parent.left
}
visible: CuraApplication.platformActivity
visible: CuraApplication.platformActivity && !PrintInformation.preSliced
}
ObjectsList

View file

@ -298,7 +298,6 @@ UM.Dialog
id: machineName
text: getMachineName()
width: Math.floor(parent.width * 0.75)
implicitWidth: UM.Theme.getSize("standard_list_input").width
maximumLength: 40
//validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed.
validator: RegExpValidator

View file

@ -2,6 +2,9 @@ import QtQuick 2.7
import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
import QtGraphicalEffects 1.0 // For the dropshadow
// The expandable component has 3 major sub components:
// * The headerItem; Always visible and should hold some info about what happens if the component is expanded
@ -10,6 +13,14 @@ import UM 1.2 as UM
Item
{
id: base
// Enumeration with the different possible alignments of the popup with respect of the headerItem
enum PopupAlignment
{
AlignLeft,
AlignRight
}
// The headerItem holds the QML item that is always displayed.
property alias headerItem: headerItemLoader.sourceComponent
@ -21,6 +32,9 @@ Item
property color headerBackgroundColor: UM.Theme.getColor("action_button")
property color headerHoverColor: UM.Theme.getColor("action_button_hovered")
// Defines the alignment of the popup with respect of the headerItem, by default to the right
property int popupAlignment: ExpandableComponent.PopupAlignment.AlignRight
// How much spacing is needed around the popupItem
property alias popupPadding: popup.padding
@ -46,6 +60,12 @@ Item
// On what side should the header corners be shown? 1 is down, 2 is left, 3 is up and 4 is right.
property alias headerCornerSide: background.cornerSide
property alias headerShadowColor: shadow.color
property alias enableHeaderShadow: shadow.visible
property int shadowOffset: 2
function togglePopup()
{
if(popup.visible)
@ -123,8 +143,8 @@ Item
sourceSize.height: height
visible: source != ""
width: height
height: 0.2 * base.height
color: "black"
height: Math.round(0.2 * base.height)
color: UM.Theme.getColor("text")
}
MouseArea
@ -137,23 +157,40 @@ Item
onExited: background.color = headerBackgroundColor
}
}
DropShadow
{
id: shadow
// Don't blur the shadow
radius: 0
anchors.fill: background
source: background
verticalOffset: base.shadowOffset
visible: true
color: UM.Theme.getColor("action_button_shadow")
// Should always be drawn behind the background.
z: background.z - 1
}
Popup
{
id: popup
// Ensure that the popup is located directly below the headerItem
y: headerItemLoader.height + 2 * background.padding
y: headerItemLoader.height + 2 * background.padding + base.shadowOffset
// Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between
// the button & text.
x: -width + collapseButton.width + headerItemLoader.width + 3 * background.padding
// Make the popup aligned with the rest, using the property popupAlignment to decide whether is right or left.
// In case of right alignment, the 3x padding is due to left, right and padding between the button & text.
x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0
padding: UM.Theme.getSize("default_margin").width
closePolicy: Popup.CloseOnPressOutsideParent
background: Rectangle
background: Cura.RoundedRectangle
{
cornerSide: Cura.RoundedRectangle.Direction.Down
color: popupBackgroundColor
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
radius: UM.Theme.getSize("default_radius").width
}
}
}

View file

@ -7,7 +7,7 @@ import QtQuick.Controls 2.0
import UM 1.2 as UM
import Cura 1.0 as Cura
Button
Cura.ToolbarButton
{
id: base
@ -18,11 +18,9 @@ Button
checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
enabled: UM.Selection.hasSelection && extruder.stack.isEnabled
background: Item {}
contentItem: ExtruderIcon
toolItem: ExtruderIcon
{
width: UM.Theme.getSize("button_icon").width
materialColor: model.color
materialColor: extruder.color
extruderEnabled: extruder.stack.isEnabled
property int index: extruder.index
}
@ -30,6 +28,6 @@ Button
onClicked:
{
forceActiveFocus() //First grab focus, so all the text fields are updated
CuraActions.setExtruderForSelection(extruder.id);
CuraActions.setExtruderForSelection(extruder.id)
}
}

View file

@ -16,6 +16,7 @@ Item
property color materialColor
property alias textColor: extruderNumberText.color
property bool extruderEnabled: true
UM.RecolorImage
{
id: mainIcon
@ -50,8 +51,6 @@ Item
anchors.centerIn: parent
text: index + 1
font: UM.Theme.getFont("extruder_icon")
width: contentWidth
height: contentHeight
visible: extruderEnabled
renderType: Text.NativeRendering
horizontalAlignment: Text.AlignHCenter

View file

@ -16,32 +16,37 @@ Item
property alias source: icon.source
property alias color: label.color
property alias font: label.font
property alias iconSize: icon.width
height: childrenRect.height
implicitHeight: icon.height
UM.RecolorImage
{
id: icon
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
source: UM.Theme.getIcon("dot")
source: ""
width: UM.Theme.getSize("section_icon").width
height: UM.Theme.getSize("section_icon").height
height: width
sourceSize.width: width
sourceSize.height: height
color: label.color
visible: source != ""
}
Label
{
id: label
anchors.left: icon.right
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: "Empty label"
elide: Text.ElideRight
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("very_small")
renderType: Text.NativeRendering

View file

@ -1,140 +0,0 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 2.3
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.2 as UM
import Cura 1.0 as Cura
import "Menus"
Cura.ExpandableComponent
{
id: machineSelector
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
UM.I18nCatalog
{
id: catalog
name: "cura"
}
headerItem: Label
{
text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
verticalAlignment: Text.AlignVCenter
height: parent.height
elide: Text.ElideRight
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
renderType: Text.NativeRendering
}
popupItem: Item
{
id: popup
width: machineSelector.width - 2 * UM.Theme.getSize("default_margin").width
height: 200
ScrollView
{
anchors.fill: parent
contentHeight: column.implicitHeight
contentWidth: column.implicitWidth
clip: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Column
{
id: column
anchors.fill: parent
Label
{
text: catalog.i18nc("@label", "Networked Printers")
visible: networkedPrintersModel.items.length > 0
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
font: UM.Theme.getFont("medium_bold")
color: UM.Theme.getColor("text")
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
}
Repeater
{
id: networkedPrinters
model: UM.ContainerStacksModel
{
id: networkedPrintersModel
filter: {"type": "machine", "um_network_key": "*", "hidden": "False"}
}
delegate: RoundButton
{
text: name
width: parent.width
checkable: true
radius: UM.Theme.getSize("default_radius").width
onClicked:
{
togglePopup()
Cura.MachineManager.setActiveMachine(model.id)
}
Connections
{
target: Cura.MachineManager
onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
}
}
}
Label
{
text: catalog.i18nc("@label", "Virtual Printers")
visible: virtualPrintersModel.items.length > 0
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
font: UM.Theme.getFont("medium_bold")
color: UM.Theme.getColor("text")
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
Repeater
{
id: virtualPrinters
model: UM.ContainerStacksModel
{
id: virtualPrintersModel
filter: {"type": "machine", "um_network_key": null}
}
delegate: RoundButton
{
text: name
width: parent.width
checked: Cura.MachineManager.activeMachineId == model.id
checkable: true
radius: UM.Theme.getSize("default_radius").width
onClicked:
{
togglePopup()
Cura.MachineManager.setActiveMachine(model.id)
}
}
}
}
}
}
}

View file

@ -2,11 +2,13 @@
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.0 as Controls2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.1
import UM 1.4 as UM
import Cura 1.0 as Cura
import QtGraphicalEffects 1.0
import "../Account"
@ -16,7 +18,31 @@ Rectangle
implicitHeight: UM.Theme.getSize("main_window_header").height
implicitWidth: UM.Theme.getSize("main_window_header").width
color: UM.Theme.getColor("main_window_header_background")
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
{
@ -73,25 +99,39 @@ Rectangle
}
// Shortcut button to quick access the Toolbox
Cura.ActionButton
Controls2.Button
{
id: marketplaceButton
text: catalog.i18nc("@action:button", "Marketplace")
height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height)
onClicked: Cura.Actions.browsePackages.trigger()
hoverEnabled: true
background: Rectangle
{
radius: UM.Theme.getSize("action_button_radius").width
color: marketplaceButton.hovered ? UM.Theme.getColor("primary_text") : UM.Theme.getColor("main_window_header_background")
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("primary_text")
}
contentItem: Label
{
id: label
text: marketplaceButton.text
color: marketplaceButton.hovered ? UM.Theme.getColor("main_window_header_background") : UM.Theme.getColor("primary_text")
width: contentWidth
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
anchors
{
right: accountWidget.left
rightMargin: UM.Theme.getSize("default_margin").width
verticalCenter: parent.verticalCenter
}
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@action:button", "Marketplace")
height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height)
color: UM.Theme.getColor("main_window_header_secondary_button_background_active")
hoverColor: UM.Theme.getColor("main_window_header_secondary_button_background_hovered")
outlineColor: UM.Theme.getColor("main_window_header_secondary_button_outline_active")
outlineHoverColor: UM.Theme.getColor("main_window_header_secondary_button_outline_hovered")
textColor: UM.Theme.getColor("main_window_header_secondary_button_text_active")
textHoverColor: UM.Theme.getColor("main_window_header_secondary_button_text_hovered")
onClicked: Cura.Actions.browsePackages.trigger()
}
AccountWidget

View file

@ -21,7 +21,7 @@ Column
{
// FIXME For now the model should be removed and then created again, otherwise changes in the printer don't automatically update the UI
configurationList.model = []
if(outputDevice)
if (outputDevice)
{
configurationList.model = outputDevice.uniqueConfigurations
}

View file

@ -1,27 +0,0 @@
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import UM 1.2 as UM
import Cura 1.0 as Cura
Item
{
property var status: "disconnected"
width: childrenRect.width
height: childrenRect.height
UM.RecolorImage
{
id: statusIcon
width: UM.Theme.getSize("printer_status_icon").width
height: UM.Theme.getSize("printer_status_icon").height
sourceSize.width: width
sourceSize.height: width
color: UM.Theme.getColor("tab_status_" + parent.status)
source: UM.Theme.getIcon(parent.status)
}
}

View file

@ -17,18 +17,21 @@ Menu
MenuItem
{
text: (model.layer_height != "") ? model.name + " - " + model.layer_height + model.layer_height_unit : model.name
text:
{
var full_text = (model.layer_height != "") ? model.name + " - " + model.layer_height + model.layer_height_unit : model.name
full_text += model.is_experimental ? " - Experimental" : ""
return full_text
}
checkable: true
checked: Cura.MachineManager.activeQualityOrQualityChangesName == model.name
exclusiveGroup: group
onTriggered: {
Cura.MachineManager.setQualityGroup(model.quality_group)
}
onTriggered: Cura.MachineManager.setQualityGroup(model.quality_group)
visible: model.available
}
onObjectAdded: menu.insertItem(index, object);
onObjectRemoved: menu.removeItem(object);
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(object)
}
MenuSeparator

View file

@ -0,0 +1,20 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import UM 1.4 as UM
import Cura 1.1 as Cura
Cura.ActionButton
{
shadowEnabled: true
shadowColor: enabled ? UM.Theme.getColor("primary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow")
color: UM.Theme.getColor("primary_button")
textColor: UM.Theme.getColor("primary_button_text")
outlineColor: "transparent"
disabledColor: UM.Theme.getColor("action_button_disabled")
textDisabledColor: UM.Theme.getColor("action_button_disabled_text")
hoverColor: UM.Theme.getColor("primary_button_hover")
}

View file

@ -54,12 +54,12 @@ Cura.ExpandableComponent
IconWithText
{
source: UM.Theme.getIcon("category_layer_height")
text: Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm"
text: Cura.MachineManager.activeStack ? Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" : ""
UM.SettingPropertyProvider
{
id: layerHeight
containerStackId: Cura.MachineManager.activeStackId
containerStack: Cura.MachineManager.activeStack
key: "layer_height"
watchedProperties: ["value"]
}
@ -68,12 +68,12 @@ Cura.ExpandableComponent
IconWithText
{
source: UM.Theme.getIcon("category_infill")
text: parseInt(infillDensity.properties.value) + "%"
text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%"
UM.SettingPropertyProvider
{
id: infillDensity
containerStackId: Cura.MachineManager.activeStackId
containerStack: Cura.MachineManager.activeStack
key: "infill_sparse_density"
watchedProperties: ["value"]
}

View file

@ -0,0 +1,155 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Cura.ExpandableComponent
{
id: machineSelector
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
property bool isPrinterConnected: Cura.MachineManager.printerConnected
property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
popupPadding: UM.Theme.getSize("default_lining").width
popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
UM.I18nCatalog
{
id: catalog
name: "cura"
}
headerItem: Cura.IconLabel
{
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
UM.RecolorImage
{
id: icon
anchors
{
bottom: parent.bottom
left: parent.left
leftMargin: UM.Theme.getSize("thick_margin").width
}
source: UM.Theme.getIcon("printer_connected")
width: UM.Theme.getSize("printer_status_icon").width
height: UM.Theme.getSize("printer_status_icon").height
sourceSize.width: width
sourceSize.height: height
color: UM.Theme.getColor("primary")
visible: isNetworkPrinter && isPrinterConnected
// Make a themable circle in the background so we can change it in other themes
Rectangle
{
id: iconBackground
anchors.centerIn: parent
// Make it a bit bigger so there is an outline
width: parent.width + 2 * UM.Theme.getSize("default_lining").width
height: parent.height + 2 * UM.Theme.getSize("default_lining").height
radius: Math.round(width / 2)
color: UM.Theme.getColor("main_background")
z: parent.z - 1
}
}
}
popupItem: Item
{
id: popup
width: UM.Theme.getSize("machine_selector_widget_content").width
ScrollView
{
id: scroll
width: parent.width
clip: true
leftPadding: UM.Theme.getSize("default_lining").width
rightPadding: UM.Theme.getSize("default_lining").width
MachineSelectorList
{
// Can't use parent.width since the parent is the flickable component and not the ScrollView
width: scroll.width - scroll.leftPadding - scroll.rightPadding
property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height
onHeightChanged:
{
scroll.height = Math.min(height, maximumHeight)
popup.height = scroll.height + buttonRow.height
}
}
}
Rectangle
{
id: separator
anchors.top: scroll.bottom
width: parent.width
height: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("lining")
}
Row
{
id: buttonRow
// The separator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar.
anchors.top: separator.top
anchors.horizontalCenter: parent.horizontalCenter
padding: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
Cura.SecondaryButton
{
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Add printer")
onClicked:
{
togglePopup()
Cura.Actions.addMachine.trigger()
}
}
Cura.SecondaryButton
{
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Manage printers")
onClicked:
{
togglePopup()
Cura.Actions.configureMachines.trigger()
}
}
}
}
}

View file

@ -0,0 +1,103 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.1
import UM 1.1 as UM
import Cura 1.0 as Cura
Button
{
id: machineSelectorButton
width: parent.width
height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("thick_margin").width
rightPadding: UM.Theme.getSize("thick_margin").width
checkable: true
hoverEnabled: true
property var outputDevice: null
property var printerTypesList: []
function updatePrinterTypesList()
{
printerTypesList = (checked && (outputDevice != null)) ? outputDevice.uniquePrinterTypes : []
}
contentItem: Item
{
width: machineSelectorButton.width - machineSelectorButton.leftPadding
height: UM.Theme.getSize("action_button").height
Label
{
id: buttonText
anchors
{
left: parent.left
right: printerTypes.left
verticalCenter: parent.verticalCenter
}
text: machineSelectorButton.text
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("action_button")
visible: text != ""
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
Row
{
id: printerTypes
width: childrenRect.width
anchors
{
right: parent.right
verticalCenter: parent.verticalCenter
}
spacing: UM.Theme.getSize("narrow_margin").width
Repeater
{
model: printerTypesList
delegate: Cura.PrinterTypeLabel
{
text: Cura.MachineManager.getAbbreviatedMachineName(modelData)
}
}
}
}
background: Rectangle
{
id: backgroundRect
color: machineSelectorButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent"
radius: UM.Theme.getSize("action_button_radius").width
border.width: UM.Theme.getSize("default_lining").width
border.color: machineSelectorButton.checked ? UM.Theme.getColor("primary") : "transparent"
}
onClicked:
{
togglePopup()
Cura.MachineManager.setActiveMachine(model.id)
}
Connections
{
target: outputDevice
onUniqueConfigurationsChanged: updatePrinterTypesList()
}
Connections
{
target: Cura.MachineManager
onOutputDevicesChanged: updatePrinterTypesList()
}
Component.onCompleted: updatePrinterTypesList()
}

View file

@ -0,0 +1,84 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Column
{
id: machineSelectorList
Label
{
text: catalog.i18nc("@label", "Network 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
renderType: Text.NativeRendering
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("text_medium")
verticalAlignment: Text.AlignVCenter
}
Repeater
{
id: networkedPrinters
model: UM.ContainerStacksModel
{
id: networkedPrintersModel
filter:
{
"type": "machine", "um_network_key": "*", "hidden": "False"
}
}
delegate: MachineSelectorButton
{
text: model.metadata["connect_group_name"]
checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
Connections
{
target: Cura.MachineManager
onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
}
}
}
Label
{
text: catalog.i18nc("@label", "Preset printers")
visible: virtualPrintersModel.items.length > 0
leftPadding: UM.Theme.getSize("default_margin").width
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
renderType: Text.NativeRendering
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("text_medium")
verticalAlignment: Text.AlignVCenter
}
Repeater
{
id: virtualPrinters
model: UM.ContainerStacksModel
{
id: virtualPrintersModel
filter:
{
"type": "machine", "um_network_key": null
}
}
delegate: MachineSelectorButton
{
text: model.name
checked: Cura.MachineManager.activeMachineId == model.id
}
}
}

View file

@ -0,0 +1,34 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.1
import UM 1.1 as UM
// This component creates a label with the abbreviated name of a printer, with a rectangle surrounding the label.
// It is created in a separated place in order to be reused whenever needed.
Item
{
property alias text: printerTypeLabel.text
width: UM.Theme.getSize("printer_type_label").width
height: UM.Theme.getSize("printer_type_label").height
Rectangle
{
anchors.fill: parent
color: UM.Theme.getColor("printer_type_label_background")
}
Label
{
id: printerTypeLabel
text: "CFFFP" // As an abbreviated name of the Custom FFF Printer
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
renderType: Text.NativeRendering
font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text")
}
}

View file

@ -5,6 +5,7 @@ import UM 1.2 as UM
// The rounded rectangle works mostly like a regular rectangle, but provides the option to have rounded corners on only one side of the rectangle.
Item
{
id: roundedRectangle
// As per the regular rectangle
property color color: "transparent"
@ -15,6 +16,9 @@ Item
// 1 is down, 2 is left, 3 is up and 4 is right.
property int cornerSide: RoundedRectangle.Direction.None
// Simple object to ensure that border.width and border.color work
property BorderGroup border: BorderGroup {}
enum Direction
{
None = 0,
@ -31,6 +35,8 @@ Item
anchors.fill: parent
radius: cornerSide != RoundedRectangle.Direction.None ? parent.radius : 0
color: parent.color
border.width: parent.border.width
border.color: parent.border.color
}
// The item that covers 2 of the corners to make them not rounded.
@ -45,5 +51,22 @@ Item
right: cornerSide == RoundedRectangle.Direction.Left ? parent.right: undefined
bottom: cornerSide == RoundedRectangle.Direction.Up ? parent.bottom: undefined
}
border.width: parent.border.width
border.color: parent.border.color
Rectangle
{
color: roundedRectangle.color
height: cornerSide % 2 ? roundedRectangle.border.width: roundedRectangle.height - 2 * roundedRectangle.border.width
width: cornerSide % 2 ? roundedRectangle.width - 2 * roundedRectangle.border.width: roundedRectangle.border.width
anchors
{
right: cornerSide == RoundedRectangle.Direction.Right ? parent.right : undefined
bottom: cornerSide == RoundedRectangle.Direction.Down ? parent.bottom: undefined
horizontalCenter: cornerSide % 2 ? parent.horizontalCenter: undefined
verticalCenter: cornerSide % 2 ? undefined: parent.verticalCenter
}
}
}
}

View file

@ -1,478 +0,0 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.1 as UM
import Cura 1.0 as Cura
// This widget does so much more than "just" being a save button, so it should be refactored at some point in time.
Item
{
id: base;
UM.I18nCatalog { id: catalog; name: "cura"}
property real progress: UM.Backend.progress
property int backendState: UM.Backend.state
property bool activity: CuraApplication.platformActivity
property alias buttonRowWidth: saveRow.width
property string fileBaseName
property string statusText:
{
if(!activity)
{
return catalog.i18nc("@label:PrintjobStatus", "Please load a 3D model");
}
switch(base.backendState)
{
case 1:
return catalog.i18nc("@label:PrintjobStatus", "Ready to slice");
case 2:
return catalog.i18nc("@label:PrintjobStatus", "Slicing...");
case 3:
return catalog.i18nc("@label:PrintjobStatus %1 is target operation", "Ready to %1").arg(UM.OutputDeviceManager.activeDeviceShortDescription);
case 4:
return catalog.i18nc("@label:PrintjobStatus", "Unable to Slice");
case 5:
return catalog.i18nc("@label:PrintjobStatus", "Slicing unavailable");
default:
return "";
}
}
function sliceOrStopSlicing()
{
try
{
if ([1, 5].indexOf(base.backendState) != -1)
{
CuraApplication.backend.forceSlice();
}
else
{
CuraApplication.backend.stopSlicing();
}
}
catch (e)
{
console.log("Could not start or stop slicing.", e)
}
}
Label
{
id: statusLabel
width: parent.width - 2 * UM.Theme.getSize("thick_margin").width
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("thick_margin").width
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default_bold")
text: statusText;
}
Rectangle
{
id: progressBar
width: parent.width - 2 * UM.Theme.getSize("thick_margin").width
height: UM.Theme.getSize("progressbar").height
anchors.top: statusLabel.bottom
anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4)
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("thick_margin").width
radius: UM.Theme.getSize("progressbar_radius").width
color: UM.Theme.getColor("progressbar_background")
Rectangle
{
width: Math.max(parent.width * base.progress)
height: parent.height
color: UM.Theme.getColor("progressbar_control")
radius: UM.Theme.getSize("progressbar_radius").width
visible: base.backendState == 2
}
}
// Shortcut for "save as/print/..."
Action
{
shortcut: "Ctrl+P"
onTriggered:
{
// only work when the button is enabled
if (saveToButton.enabled)
{
saveToButton.clicked();
}
// prepare button
if (prepareButton.enabled)
{
sliceOrStopSlicing();
}
}
}
Item
{
id: saveRow
width: {
// using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect
var children_width = UM.Theme.getSize("default_margin").width;
for (var index in children)
{
var child = children[index];
if(child.visible)
{
children_width += child.width + child.anchors.rightMargin;
}
}
return Math.min(children_width, base.width - UM.Theme.getSize("thick_margin").width);
}
height: saveToButton.height
anchors.bottom: parent.bottom
anchors.bottomMargin: UM.Theme.getSize("thick_margin").height
anchors.right: parent.right
clip: true
Row
{
id: additionalComponentsRow
anchors.top: parent.top
anchors.right: saveToButton.visible ? saveToButton.left : (prepareButton.visible ? prepareButton.left : parent.right)
anchors.rightMargin: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
}
Component.onCompleted:
{
saveRow.addAdditionalComponents("saveButton")
}
Connections
{
target: CuraApplication
onAdditionalComponentsChanged: saveRow.addAdditionalComponents("saveButton")
}
function addAdditionalComponents (areaId)
{
if(areaId == "saveButton")
{
for (var component in CuraApplication.additionalComponents["saveButton"])
{
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
}
}
Connections
{
target: UM.Preferences
onPreferenceChanged:
{
var autoSlice = UM.Preferences.getValue("general/auto_slice");
prepareButton.autoSlice = autoSlice;
saveToButton.autoSlice = autoSlice;
}
}
// Prepare button, only shows if auto_slice is off
Button
{
id: prepareButton
tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process")
// 1 = not started, 2 = Processing
enabled: ([1, 2].indexOf(base.backendState) != -1) && base.activity
visible: !autoSlice && ([1, 2, 4].indexOf(base.backendState) != -1) && base.activity
property bool autoSlice
height: UM.Theme.getSize("save_button_save_to_button").height
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
// 1 = not started, 4 = error, 5 = disabled
text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel")
onClicked:
{
sliceOrStopSlicing();
}
style: ButtonStyle
{
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
else
{
return UM.Theme.getColor("action_button_border");
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
else
{
return UM.Theme.getColor("action_button");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2)
Label
{
id: actualLabel
anchors.centerIn: parent
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
else
{
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("action_button")
text: control.text;
}
}
label: Item {}
}
}
Button
{
id: saveToButton
tooltip: UM.OutputDeviceManager.activeDeviceDescription;
// 3 = done, 5 = disabled
enabled: base.backendState != "undefined" && (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: base.backendState != "undefined" && autoSlice || ((base.backendState == 3 || base.backendState == 5) && base.activity == true)
property bool autoSlice
height: UM.Theme.getSize("save_button_save_to_button").height
anchors.top: parent.top
anchors.right: deviceSelectionMenu.visible ? deviceSelectionMenu.left : parent.right
anchors.rightMargin: deviceSelectionMenu.visible ? -3 * UM.Theme.getSize("default_lining").width : UM.Theme.getSize("thick_margin").width
text: UM.OutputDeviceManager.activeDeviceShortDescription
onClicked:
{
forceActiveFocus();
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName,
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
}
style: ButtonStyle
{
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("print_button_ready_pressed_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered_border");
}
else
{
return UM.Theme.getColor("print_button_ready_border");
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("print_button_ready_pressed");
}
else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered");
}
else
{
return UM.Theme.getColor("print_button_ready");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2)
Label
{
id: actualLabel
anchors.centerIn: parent
color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text")
font: UM.Theme.getFont("action_button")
text: control.text
}
}
label: Item { }
}
}
Button
{
id: deviceSelectionMenu
tooltip: catalog.i18nc("@info:tooltip","Select the active output device");
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
width: UM.Theme.getSize("save_button_save_to_button").height
height: UM.Theme.getSize("save_button_save_to_button").height
// 3 = Done, 5 = Disabled
enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true
style: ButtonStyle
{
background: Rectangle
{
id: deviceSelectionIcon
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border")
}
else if(control.pressed)
{
return UM.Theme.getColor("print_button_ready_pressed_border")
}
else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered_border")
}
else
{
return UM.Theme.getColor("print_button_ready_border")
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled")
}
else if(control.pressed)
{
return UM.Theme.getColor("print_button_ready_pressed")
}
else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered")
}
else
{
return UM.Theme.getColor("print_button_ready")
}
}
Behavior on color { ColorAnimation { duration: 50; } }
anchors.left: parent.left
anchors.leftMargin: Math.round(UM.Theme.getSize("save_button_text_margin").width / 2);
width: parent.height
height: parent.height
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width
sourceSize.height: height
color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text")
source: UM.Theme.getIcon("arrow_bottom")
}
}
}
menu: Menu
{
id: devicesMenu;
Instantiator
{
model: devicesModel;
MenuItem
{
text: model.description
checkable: true;
checked: model.id == UM.OutputDeviceManager.activeDevice
exclusiveGroup: devicesMenuGroup
onTriggered:
{
UM.OutputDeviceManager.setActiveDevice(model.id);
}
}
onObjectAdded: devicesMenu.insertItem(index, object)
onObjectRemoved: devicesMenu.removeItem(object)
}
ExclusiveGroup { id: devicesMenuGroup }
}
}
UM.OutputDevicesModel { id: devicesModel }
}
}

View file

@ -0,0 +1,20 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import UM 1.4 as UM
import Cura 1.1 as Cura
Cura.ActionButton
{
shadowEnabled: true
shadowColor: enabled ? UM.Theme.getColor("secondary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow")
color: UM.Theme.getColor("secondary_button")
textColor: UM.Theme.getColor("secondary_button_text")
outlineColor: "transparent"
disabledColor: UM.Theme.getColor("action_button_disabled")
textDisabledColor: UM.Theme.getColor("action_button_disabled_text")
hoverColor: UM.Theme.getColor("secondary_button_hover")
}

View file

@ -14,23 +14,32 @@ Button
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("thick_margin").width
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
hoverEnabled: true
background: Rectangle
{
id: backgroundRectangle
implicitHeight: UM.Theme.getSize("section").height
color: {
if (base.color) {
return base.color;
} else if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled");
} else if (base.hovered && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover");
} else if (base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active");
} else if (base.hovered) {
return UM.Theme.getColor("setting_category_hover");
} else {
return UM.Theme.getColor("setting_category");
color:
{
if (base.color)
{
return base.color
} else if (!base.enabled)
{
return UM.Theme.getColor("setting_category_disabled")
} else if (base.hovered && base.checkable && base.checked)
{
return UM.Theme.getColor("setting_category_active_hover")
} else if (base.pressed || (base.checkable && base.checked))
{
return UM.Theme.getColor("setting_category_active")
} else if (base.hovered)
{
return UM.Theme.getColor("setting_category_hover")
} else
{
return UM.Theme.getColor("setting_category")
}
}
Behavior on color { ColorAnimation { duration: 50; } }
@ -40,17 +49,23 @@ Button
height: UM.Theme.getSize("default_lining").height
width: parent.width
anchors.bottom: parent.bottom
color: {
if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled_border");
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover_border");
} else if (base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active_border");
} else if (base.hovered || base.activeFocus) {
return UM.Theme.getColor("setting_category_hover_border");
} else {
return UM.Theme.getColor("setting_category_border");
color:
{
if (!base.enabled)
{
return UM.Theme.getColor("setting_category_disabled_border")
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked)
{
return UM.Theme.getColor("setting_category_active_hover_border")
} else if (base.pressed || (base.checkable && base.checked))
{
return UM.Theme.getColor("setting_category_active_border")
} else if (base.hovered || base.activeFocus)
{
return UM.Theme.getColor("setting_category_hover_border")
} else
{
return UM.Theme.getColor("setting_category_border")
}
}
}
@ -65,18 +80,19 @@ Button
property var focusItem: base
contentItem: Item {
contentItem: Item
{
anchors.fill: parent
anchors.left: parent.left
Label {
Label
{
id: settingNameLabel
anchors
{
left: parent.left
leftMargin: 2 * UM.Theme.getSize("default_margin").width + UM.Theme.getSize("section_icon").width
right: parent.right;
verticalCenter: parent.verticalCenter;
right: parent.right
verticalCenter: parent.verticalCenter
}
text: definition.label
textFormat: Text.PlainText
@ -84,21 +100,27 @@ Button
font: UM.Theme.getFont("setting_category")
color:
{
if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled_text");
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover_text");
} else if (base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active_text");
} else if (base.hovered || base.activeFocus) {
return UM.Theme.getColor("setting_category_hover_text");
} else {
return UM.Theme.getColor("setting_category_text");
if (!base.enabled)
{
return UM.Theme.getColor("setting_category_disabled_text")
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked)
{
return UM.Theme.getColor("setting_category_active_hover_text")
} else if (base.pressed || (base.checkable && base.checked))
{
return UM.Theme.getColor("setting_category_active_text")
} else if (base.hovered || base.activeFocus)
{
return UM.Theme.getColor("setting_category_hover_text")
} else
{
return UM.Theme.getColor("setting_category_text")
}
}
fontSizeMode: Text.HorizontalFit
minimumPointSize: 8
}
UM.RecolorImage
{
id: category_arrow
@ -111,16 +133,21 @@ Button
sourceSize.height: width
color:
{
if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled_text");
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover_text");
} else if (base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active_text");
} else if (base.hovered || base.activeFocus) {
return UM.Theme.getColor("setting_category_hover_text");
} else {
return UM.Theme.getColor("setting_category_text");
if (!base.enabled)
{
return UM.Theme.getColor("setting_category_disabled_text")
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked)
{
return UM.Theme.getColor("setting_category_active_hover_text")
} else if (base.pressed || (base.checkable && base.checked))
{
return UM.Theme.getColor("setting_category_active_text")
} else if (base.hovered || base.activeFocus)
{
return UM.Theme.getColor("setting_category_hover_text")
} else
{
return UM.Theme.getColor("setting_category_text")
}
}
source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
@ -135,21 +162,26 @@ Button
anchors.leftMargin: UM.Theme.getSize("default_margin").width
color:
{
if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled_text");
} else if((base.hovered || base.activeFocus) && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover_text");
} else if(base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active_text");
} else if(base.hovered || base.activeFocus) {
return UM.Theme.getColor("setting_category_hover_text");
} else {
return UM.Theme.getColor("setting_category_text");
if (!base.enabled)
{
return UM.Theme.getColor("setting_category_disabled_text")
} else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
{
return UM.Theme.getColor("setting_category_active_hover_text")
} else if(base.pressed || (base.checkable && base.checked))
{
return UM.Theme.getColor("setting_category_active_text")
} else if(base.hovered || base.activeFocus)
{
return UM.Theme.getColor("setting_category_hover_text")
} else
{
return UM.Theme.getColor("setting_category_text")
}
}
source: UM.Theme.getIcon(definition.icon)
width: UM.Theme.getSize("section_icon").width;
height: UM.Theme.getSize("section_icon").height;
width: UM.Theme.getSize("section_icon").width
height: UM.Theme.getSize("section_icon").height
sourceSize.width: width + 15 * screenScaleFactor
sourceSize.height: width + 15 * screenScaleFactor
}
@ -159,31 +191,26 @@ Button
onClicked:
{
if (definition.expanded) {
settingDefinitionsModel.collapse(definition.key);
if (definition.expanded)
{
settingDefinitionsModel.collapse(definition.key)
} else {
settingDefinitionsModel.expandRecursive(definition.key);
settingDefinitionsModel.expandRecursive(definition.key)
}
//Set focus so that tab navigation continues from this point on.
//NB: This must be set AFTER collapsing/expanding the category so that the scroll position is correct.
forceActiveFocus();
forceActiveFocus()
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
base.focusReceived()
}
}
Keys.onTabPressed:
{
base.setActiveFocusToNextSetting(true)
}
Keys.onBacktabPressed:
{
base.setActiveFocusToNextSetting(false)
}
Keys.onTabPressed: base.setActiveFocusToNextSetting(true)
Keys.onBacktabPressed: base.setActiveFocusToNextSetting(false)
UM.SimpleButton
{
@ -193,9 +220,10 @@ Button
height: Math.round(base.height * 0.6)
width: Math.round(base.height * 0.6)
anchors {
anchors
{
right: inheritButton.visible ? inheritButton.left : parent.right
// use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons
// Use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons
rightMargin: inheritButton.visible ? Math.round(UM.Theme.getSize("default_margin").width / 2) : category_arrow.width + Math.round(UM.Theme.getSize("default_margin").width * 1.9)
verticalCenter: parent.verticalCenter
}
@ -204,9 +232,7 @@ Button
hoverColor: UM.Theme.getColor("setting_control_button_hover")
iconSource: UM.Theme.getIcon("settings")
onClicked: {
Cura.Actions.configureSettingVisibility.trigger(definition)
}
onClicked: Cura.Actions.configureSettingVisibility.trigger(definition)
}
UM.SimpleButton
@ -239,24 +265,18 @@ Button
onClicked:
{
settingDefinitionsModel.expandRecursive(definition.key);
base.checked = true;
base.showAllHiddenInheritedSettings(definition.key);
settingDefinitionsModel.expandRecursive(definition.key)
base.checked = true
base.showAllHiddenInheritedSettings(definition.key)
}
color: UM.Theme.getColor("setting_control_button")
hoverColor: UM.Theme.getColor("setting_control_button_hover")
iconSource: UM.Theme.getIcon("notice")
onEntered:
{
base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible."))
}
onEntered: base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible."))
onExited:
{
base.hideTooltip();
}
onExited: base.hideTooltip()
UM.I18nCatalog { id: catalog; name: "cura" }
}

View file

@ -62,11 +62,18 @@ Item
activeFocusOnPress: true
menu: ProfileMenu { }
function generateActiveQualityText () {
var result = Cura.MachineManager.activeQualityOrQualityChangesName;
function generateActiveQualityText ()
{
var result = Cura.MachineManager.activeQualityOrQualityChangesName
if (Cura.MachineManager.isActiveQualityExperimental)
{
result += " (Experimental)"
}
if (Cura.MachineManager.isActiveQualitySupported) {
if (Cura.MachineManager.activeQualityLayerHeight > 0) {
if (Cura.MachineManager.isActiveQualitySupported)
{
if (Cura.MachineManager.activeQualityLayerHeight > 0)
{
result += " <font color=\"" + UM.Theme.getColor("text_detail") + "\">"
result += " - "
result += Cura.MachineManager.activeQualityLayerHeight + "mm"

View file

@ -2,9 +2,7 @@
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
@ -55,17 +53,24 @@ Item
model: UM.ToolModel { id: toolsModel }
width: childrenRect.width
height: childrenRect.height
Button
delegate: ToolbarButton
{
text: model.name + (model.shortcut ? (" (" + model.shortcut + ")") : "")
iconSource: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon
checkable: true
checked: model.active
enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled
style: UM.Theme.styles.toolbar_button
property bool isFirstElement: toolsModel.getItem(0).id == model.id
property bool isLastElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id
isTopElement: toolsModel.getItem(0).id == model.id
isBottomElement: toolsModel.getItem(toolsModel.rowCount() - 1).id == model.id
toolItem: UM.RecolorImage
{
source: UM.Theme.getIcon(model.icon) != "" ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon
color: UM.Theme.getColor("toolbar_button_text")
sourceSize: UM.Theme.getSize("button_icon")
}
onCheckedChanged:
{
@ -128,11 +133,12 @@ Item
height: childrenRect.height
property var _model: Cura.ExtrudersModel { id: extrudersModel }
model: _model.items.length > 1 ? _model : 0
ExtruderButton
delegate: ExtruderButton
{
extruder: model
height: UM.Theme.getSize("button").width
width: UM.Theme.getSize("button").width
isTopElement: extrudersModel.getItem(0).id == model.id
isBottomElement: extrudersModel.getItem(extrudersModel.rowCount() - 1).id == model.id
}
}
}

View file

@ -0,0 +1,99 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Button
{
id: base
property alias toolItem: contentItemLoader.sourceComponent
// These two properties indicate whether the toolbar button is at the top of the toolbar column or at the bottom.
// If it is somewhere in the middle, then both has to be false. If there is only one element in the column, then
// both properties have to be set to true. This is used to create a rounded corner.
property bool isTopElement: false
property bool isBottomElement: false
hoverEnabled: true
background: Rectangle
{
implicitWidth: UM.Theme.getSize("button").width
implicitHeight: UM.Theme.getSize("button").height
color:
{
if (base.checked && base.hovered)
{
return UM.Theme.getColor("toolbar_button_active_hover")
}
else if (base.checked)
{
return UM.Theme.getColor("toolbar_button_active")
}
else if(base.hovered)
{
return UM.Theme.getColor("toolbar_button_hover")
}
return UM.Theme.getColor("toolbar_background")
}
radius: UM.Theme.getSize("default_radius").width
Rectangle
{
id: topSquare
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
height: parent.radius
color: parent.color
visible: !base.isTopElement
}
Rectangle
{
id: bottomSquare
anchors
{
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: parent.radius
color: parent.color
visible: !base.isBottomElement
}
Rectangle
{
id: leftSquare
anchors
{
left: parent.left
top: parent.top
bottom: parent.bottom
}
width: parent.radius
color: parent.color
}
}
contentItem: Item
{
opacity: parent.enabled ? 1.0 : 0.2
Loader
{
id: contentItemLoader
anchors.centerIn: parent
width: UM.Theme.getSize("button_icon").width
height: UM.Theme.getSize("button_icon").height
}
}
}

View file

@ -0,0 +1,16 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import UM 1.4 as UM
UM.SimpleButton
{
width: UM.Theme.getSize("small_button").width
height: UM.Theme.getSize("small_button").height
hoverBackgroundColor: UM.Theme.getColor("small_button_hover")
hoverColor: UM.Theme.getColor("small_button_text_hover")
color: UM.Theme.getColor("small_button_text")
iconMargin: 0.5 * UM.Theme.getSize("wide_lining").width
}

View file

@ -7,7 +7,7 @@ import QtQuick.Controls.Styles 1.1
import UM 1.4 as UM
// View orientation Item
// A row of buttons that control the view direction
Row
{
id: viewOrientationControl
@ -16,43 +16,33 @@ Row
height: childrenRect.height
width: childrenRect.width
// #1 3d view
Button
ViewOrientationButton
{
iconSource: UM.Theme.getIcon("view_3d")
style: UM.Theme.styles.small_tool_button
onClicked:UM.Controller.rotateView("3d", 0)
onClicked: UM.Controller.rotateView("3d", 0)
}
// #2 Front view
Button
ViewOrientationButton
{
iconSource: UM.Theme.getIcon("view_front")
style: UM.Theme.styles.small_tool_button
onClicked: UM.Controller.rotateView("home", 0)
}
// #3 Top view
Button
ViewOrientationButton
{
iconSource: UM.Theme.getIcon("view_top")
style: UM.Theme.styles.small_tool_button
onClicked: UM.Controller.rotateView("y", 90)
}
// #4 Left view
Button
ViewOrientationButton
{
iconSource: UM.Theme.getIcon("view_left")
style: UM.Theme.styles.small_tool_button
onClicked: UM.Controller.rotateView("x", 90)
}
// #5 Right view
Button
ViewOrientationButton
{
iconSource: UM.Theme.getIcon("view_right")
style: UM.Theme.styles.small_tool_button
onClicked: UM.Controller.rotateView("x", -90)
}
}

View file

@ -0,0 +1,129 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Cura.ExpandableComponent
{
id: viewSelector
popupPadding: UM.Theme.getSize("default_lining").width
popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
property var viewModel: UM.ViewModel { }
property var activeView:
{
for (var i = 0; i < viewModel.rowCount(); i++)
{
if (viewModel.items[i].active)
{
return viewModel.items[i]
}
}
return null
}
Component.onCompleted:
{
// Nothing was active, so just return the first one (the list is sorted by priority, so the most
// important one should be returned)
if (activeView == null)
{
UM.Controller.setActiveView(viewModel.getItem(0).id)
}
}
headerItem: Item
{
Label
{
id: title
text: catalog.i18nc("@button", "View types")
verticalAlignment: Text.AlignVCenter
height: parent.height
elide: Text.ElideRight
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text_medium")
renderType: Text.NativeRendering
}
Label
{
text: viewSelector.activeView ? viewSelector.activeView.name : ""
verticalAlignment: Text.AlignVCenter
anchors
{
left: title.right
leftMargin: UM.Theme.getSize("default_margin").width
}
height: parent.height
elide: Text.ElideRight
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
renderType: Text.NativeRendering
}
}
popupItem: Column
{
id: viewSelectorPopup
width: viewSelector.width - 2 * viewSelector.popupPadding
// For some reason the height/width of the column gets set to 0 if this is not set...
Component.onCompleted:
{
height = implicitHeight
width = viewSelector.width - 2 * viewSelector.popupPadding
}
Repeater
{
id: viewsList
model: viewSelector.viewModel
delegate: Button
{
id: viewsSelectorButton
text: model.name
width: parent.width
height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
checkable: true
checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false
contentItem: Label
{
id: buttonText
text: viewsSelectorButton.text
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("action_button")
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle
{
id: backgroundRect
color: viewsSelectorButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent"
radius: UM.Theme.getSize("action_button_radius").width
border.width: UM.Theme.getSize("default_lining").width
border.color: viewsSelectorButton.checked ? UM.Theme.getColor("primary") : "transparent"
}
onClicked:
{
viewSelector.togglePopup()
UM.Controller.setActiveView(id)
}
}
}
}
}

View file

@ -9,4 +9,8 @@ MaterialMenu 1.0 MaterialMenu.qml
NozzleMenu 1.0 NozzleMenu.qml
ActionPanelWidget 1.0 ActionPanelWidget.qml
IconLabel 1.0 IconLabel.qml
OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml
OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml
ExpandableComponent 1.0 ExpandableComponent.qml
PrinterTypeLabel 1.0 PrinterTypeLabel.qml
ViewsSelector 1.0 ViewsSelector.qml
ToolbarButton 1.0 ToolbarButton.qml