Merge branch '4.0' into unify_font_types

This commit is contained in:
Diego Prado Gesto 2018-12-19 11:56:22 +01:00
commit ef2fb53790
141 changed files with 1872 additions and 3377 deletions

View file

@ -43,12 +43,13 @@ Button
contentItem: Row
{
spacing: UM.Theme.getSize("narrow_margin").width
//Left side icon. Only displayed if !isIconOnRightSide.
UM.RecolorImage
{
id: buttonIconLeft
source: ""
height: buttonText.height
height: UM.Theme.getSize("action_button_icon").height
width: visible ? height : 0
sourceSize.width: width
sourceSize.height: height
@ -76,7 +77,7 @@ Button
{
id: buttonIconRight
source: buttonIconLeft.source
height: buttonText.height
height: UM.Theme.getSize("action_button_icon").height
width: visible ? height : 0
sourceSize.width: width
sourceSize.height: height

View file

@ -12,6 +12,12 @@ Item
{
id: widget
function requestWriteToDevice()
{
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName,
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
}
Cura.PrimaryButton
{
id: saveToButton
@ -32,9 +38,8 @@ Item
onClicked:
{
forceActiveFocus();
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName,
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
forceActiveFocus()
widget.requestWriteToDevice()
}
}
@ -81,6 +86,7 @@ Item
delegate: Cura.ActionButton
{
text: model.description
visible: model.id != UM.OutputDeviceManager.activeDevice // Don't show the active device in the list
color: "transparent"
cornerRadius: 0
hoverColor: UM.Theme.getColor("primary")
@ -88,6 +94,7 @@ Item
onClicked:
{
UM.OutputDeviceManager.setActiveDevice(model.id)
widget.requestWriteToDevice()
popup.close()
}
}

View file

@ -41,7 +41,7 @@ Column
{
left: parent.left
right: printInformationPanel.left
rightMargin: UM.Theme.getSize("thin_margin").height
rightMargin: printInformationPanel.visible ? UM.Theme.getSize("thin_margin").width : 0
}
Cura.IconWithText
@ -119,9 +119,9 @@ Column
}
height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Preview")
tooltip: text
fixedWidthMode: true
onClicked: UM.Controller.setActiveStage("PreviewStage")
visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage"

View file

@ -12,10 +12,10 @@ UM.RecolorImage
id: widget
source: UM.Theme.getIcon("info")
width: UM.Theme.getSize("section_icon").width
width: visible ? UM.Theme.getSize("section_icon").width : 0
height: UM.Theme.getSize("section_icon").height
color: popup.opened ? UM.Theme.getColor("primary") : UM.Theme.getColor("text_medium")
color: UM.Theme.getColor("icon")
MouseArea
{

View file

@ -60,7 +60,7 @@ Column
text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice")
source: UM.Theme.getIcon("warning")
color: UM.Theme.getColor("warning")
iconColor: UM.Theme.getColor("warning")
}
// Progress bar, only visible when the backend is in the process of slice the printjob

View file

@ -123,6 +123,17 @@ UM.MainWindow
}
}
}
// This is a placehoder for adding a pattern in the header
Image
{
id: backgroundPattern
anchors.fill: parent
fillMode: Image.Tile
source: UM.Theme.getImage("header_pattern")
horizontalAlignment: Image.AlignLeft
verticalAlignment: Image.AlignTop
}
}
MainWindowHeader
@ -252,7 +263,7 @@ UM.MainWindow
anchors
{
// Align to the top of the stageMenu since the stageMenu may not exist
top: parent.top
top: stageMenu.source ? stageMenu.verticalCenter : parent.top
left: parent.left
right: parent.right
bottom: parent.bottom
@ -278,16 +289,33 @@ UM.MainWindow
height: UM.Theme.getSize("stage_menu").height
source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : ""
// HACK: This is to ensure that the parent never gets set to null, as this wreaks havoc on the focus.
function onParentDestroyed()
{
printSetupSelector.parent = stageMenu
printSetupSelector.visible = false
}
property Item oldParent: null
// The printSetupSelector is defined here so that the setting list doesn't need to get re-instantiated
// Every time the stage is changed.
property var printSetupSelector: Cura.PrintSetupSelector
{
width: UM.Theme.getSize("print_setup_widget").width
height: UM.Theme.getSize("stage_menu").height
headerCornerSide: RoundedRectangle.Direction.Right
width: UM.Theme.getSize("print_setup_widget").width
height: UM.Theme.getSize("stage_menu").height
headerCornerSide: RoundedRectangle.Direction.Right
onParentChanged:
{
if(stageMenu.oldParent !=null)
{
stageMenu.oldParent.Component.destruction.disconnect(stageMenu.onParentDestroyed)
}
stageMenu.oldParent = parent
visible = parent != stageMenu
parent.Component.destruction.connect(stageMenu.onParentDestroyed)
}
}
}
UM.MessageStack
{
anchors

View file

@ -49,6 +49,7 @@ Item
anchors.centerIn: parent
text: index + 1
font: UM.Theme.getFont("small")
color: UM.Theme.getColor("text")
width: contentWidth
height: contentHeight
visible: extruderEnabled
@ -65,7 +66,7 @@ Item
sourceSize.height: width
source: UM.Theme.getIcon("cross1")
visible: !extruderEnabled
color: "black"
color: UM.Theme.getColor("text")
}
}
}

View file

@ -15,10 +15,10 @@ Item
{
property alias source: icon.source
property alias iconSize: icon.width
property alias iconColor: icon.color
property alias color: label.color
property alias text: label.text
property alias font: label.font
property real margin: UM.Theme.getSize("narrow_margin").width
// These properties can be used in combination with layouts.
@ -37,9 +37,9 @@ Item
{
id: icon
width: UM.Theme.getSize("section_icon").width
height: UM.Theme.getSize("section_icon").height
height: width
color: label.color
color: UM.Theme.getColor("icon")
anchors
{

View file

@ -54,16 +54,23 @@ Item
{
text: model.name.toUpperCase()
checkable: true
checked: model.active
checked: UM.Controller.activeStage !== null && model.id == UM.Controller.activeStage.stageId
anchors.verticalCenter: parent.verticalCenter
exclusiveGroup: mainWindowHeaderMenuGroup
style: UM.Theme.styles.main_window_header_tab
height: UM.Theme.getSize("main_window_header_button").height
onClicked: UM.Controller.setActiveStage(model.id)
iconSource: model.stage.iconSource
property color overlayColor: "transparent"
property string overlayIconSource: ""
// This is a trick to assure the activeStage is correctly changed. It doesn't work propertly if done in the onClicked (see CURA-6028)
MouseArea
{
anchors.fill: parent
onClicked: UM.Controller.setActiveStage(model.id)
}
}
}

View file

@ -16,8 +16,8 @@ Item
{
id: header
text: catalog.i18nc("@header", "Configurations")
font: UM.Theme.getFont("large_bold")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("small_button_text")
height: contentHeight
renderType: Text.NativeRendering

View file

@ -14,110 +14,105 @@ Button
property var configuration: null
hoverEnabled: true
height: background.height
background: Rectangle
{
height: childrenRect.height
color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
border.color: (parent.checked || parent.hovered) ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining")
border.width: parent.checked ? UM.Theme.getSize("thick_lining").width : UM.Theme.getSize("default_lining").width
border.color: parent.checked ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width
radius: UM.Theme.getSize("default_radius").width
}
Column
contentItem: Column
{
id: contentColumn
width: parent.width
padding: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("narrow_margin").height
Row
{
id: contentColumn
width: parent.width
padding: UM.Theme.getSize("wide_margin").width
spacing: UM.Theme.getSize("narrow_margin").height
id: extruderRow
Row
anchors
{
id: extruderRow
anchors
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: childrenRect.height
spacing: UM.Theme.getSize("default_margin").width
Repeater
{
id: repeater
height: childrenRect.height
model: configuration.extruderConfigurations
delegate: PrintCoreConfiguration
{
width: Math.round(parent.width / 2)
printCoreConfiguration: modelData
}
}
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
//Buildplate row separator
Rectangle
spacing: UM.Theme.getSize("default_margin").width
Repeater
{
id: separator
visible: buildplateInformation.visible
anchors
id: repeater
model: configuration.extruderConfigurations
delegate: PrintCoreConfiguration
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: visible ? Math.round(UM.Theme.getSize("default_lining").height / 2) : 0
color: UM.Theme.getColor("lining")
}
Item
{
id: buildplateInformation
anchors
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: childrenRect.height
visible: configuration.buildplateConfiguration != ""
// Show the type of buildplate. The first letter is capitalized
Cura.IconWithText
{
id: buildplateLabel
source: UM.Theme.getIcon("buildplate")
text: configuration.buildplateConfiguration.charAt(0).toUpperCase() + configuration.buildplateConfiguration.substr(1)
anchors.left: parent.left
width: Math.round(parent.width / 2)
printCoreConfiguration: modelData
}
}
}
Connections
//Buildplate row separator
Rectangle
{
target: Cura.MachineManager
onCurrentConfigurationChanged:
id: separator
visible: buildplateInformation.visible
anchors
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
height: visible ? Math.round(UM.Theme.getSize("default_lining").height / 2) : 0
color: UM.Theme.getColor("lining")
}
Component.onCompleted:
Item
{
id: buildplateInformation
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
height: childrenRect.height
visible: configuration.buildplateConfiguration != ""
// Show the type of buildplate. The first letter is capitalized
Cura.IconWithText
{
id: buildplateLabel
source: UM.Theme.getIcon("buildplate")
text: configuration.buildplateConfiguration.charAt(0).toUpperCase() + configuration.buildplateConfiguration.substr(1)
anchors.left: parent.left
}
}
}
Connections
{
target: Cura.MachineManager
onCurrentConfigurationChanged:
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
}
}
Component.onCompleted:
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
}
onClicked:
{
Cura.MachineManager.applyRemoteConfiguration(configuration)
}
}
}

View file

@ -7,16 +7,15 @@ import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Column
Item
{
id: base
property var outputDevice: null
height: childrenRect.height + 2 * padding
spacing: UM.Theme.getSize("narrow_margin").height
height: childrenRect.height
function forceModelUpdate()
{
// FIXME For now the model should be removed and then created again, otherwise changes in the printer don't automatically update the UI
// FIXME For now the model has to be removed and then created again, otherwise changes in the printer don't automatically update the UI
configurationList.model = []
if (outputDevice)
{
@ -24,6 +23,42 @@ Column
}
}
// This component will appear when there is no configurations (e.g. when losing connection)
Item
{
width: parent.width
visible: configurationList.model.length == 0
height: label.height + UM.Theme.getSize("wide_margin").height
anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
UM.RecolorImage
{
id: icon
anchors.left: parent.left
anchors.verticalCenter: label.verticalCenter
source: UM.Theme.getIcon("warning")
color: UM.Theme.getColor("warning")
width: UM.Theme.getSize("section_icon").width
height: width
}
Label
{
id: label
anchors.left: icon.right
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@label", "The configurations are not available because the printer is disconnected.")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
wrapMode: Text.WordWrap
}
}
ScrollView
{
id: container
@ -57,7 +92,6 @@ Column
id: configurationList
spacing: UM.Theme.getSize("narrow_margin").height
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"
@ -100,4 +134,4 @@ Column
forceModelUpdate()
}
}
}
}

View file

@ -17,10 +17,7 @@ Cura.ExpandablePopup
{
id: base
Cura.ExtrudersModel
{
id: extrudersModel
}
property var extrudersModel: CuraApplication.getExtrudersModel()
UM.I18nCatalog
{
@ -34,6 +31,7 @@ Cura.ExpandablePopup
Custom
}
contentPadding: UM.Theme.getSize("default_lining").width
enabled: Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants || Cura.MachineManager.hasVariantBuildplates; //Only let it drop down if there is any configuration that you could change.
headerItem: Item
@ -127,34 +125,41 @@ Cura.ExpandablePopup
contentItem: Column
{
id: popupItem
width: base.width - 2 * UM.Theme.getSize("default_margin").width
height: implicitHeight //Required because ExpandableComponent will try to use this to determine the size of the background of the pop-up.
width: UM.Theme.getSize("configuration_selector").width
height: implicitHeight // Required because ExpandableComponent will try to use this to determine the size of the background of the pop-up.
padding: UM.Theme.getSize("default_margin").height
spacing: UM.Theme.getSize("default_margin").height
property bool is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible.
property bool is_connected: false // If current machine is connected to a printer. Only evaluated upon making popup visible.
property int configuration_method: ConfigurationMenu.ConfigurationMethod.Custom // Type of configuration being used. Only evaluated upon making popup visible.
property int manual_selected_method: -1 // It stores the configuration method selected by the user. By default the selected method is
onVisibleChanged:
{
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate.
}
is_connected = Cura.MachineManager.activeMachineHasRemoteConnection && Cura.MachineManager.printerConnected //Re-evaluate.
property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.Auto : ConfigurationMenu.ConfigurationMethod.Custom //Auto if connected to a printer at start-up, or Custom if not.
// If the printer is not connected, we switch always to the custom mode. If is connected instead, the auto mode
// or the previous state is selected
configuration_method = is_connected ? (manual_selected_method == -1 ? ConfigurationMenu.ConfigurationMethod.Auto : manual_selected_method) : ConfigurationMenu.ConfigurationMethod.Custom
}
Item
{
width: parent.width
width: parent.width - 2 * parent.padding
height:
{
var height = 0;
if(autoConfiguration.visible)
var height = 0
if (autoConfiguration.visible)
{
height += autoConfiguration.height;
height += autoConfiguration.height
}
if(customConfiguration.visible)
if (customConfiguration.visible)
{
height += customConfiguration.height;
height += customConfiguration.height
}
return height;
return height
}
AutoConfiguration
{
id: autoConfiguration
@ -172,9 +177,9 @@ Cura.ExpandablePopup
{
id: separator
visible: buttonBar.visible
x: -contentPadding
x: -parent.padding
width: base.width
width: parent.width
height: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("lining")
@ -186,7 +191,7 @@ Cura.ExpandablePopup
id: buttonBar
visible: popupItem.is_connected //Switching only makes sense if the "auto" part is possible.
width: parent.width
width: parent.width - 2 * parent.padding
height: childrenRect.height
Cura.SecondaryButton
@ -200,7 +205,11 @@ Cura.ExpandablePopup
iconSource: UM.Theme.getIcon("arrow_right")
isIconOnRightSide: true
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Custom
onClicked:
{
popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Custom
popupItem.manual_selected_method = popupItem.configuration_method
}
}
Cura.SecondaryButton
@ -211,8 +220,18 @@ Cura.ExpandablePopup
iconSource: UM.Theme.getIcon("arrow_left")
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Auto
onClicked:
{
popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Auto
popupItem.manual_selected_method = popupItem.configuration_method
}
}
}
}
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged: popupItem.manual_selected_method = -1 // When switching printers, reset the value of the manual selected method
}
}

View file

@ -23,8 +23,8 @@ Item
{
id: header
text: catalog.i18nc("@header", "Custom")
font: UM.Theme.getFont("large_bold")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("small_button_text")
height: contentHeight
renderType: Text.NativeRendering
@ -51,9 +51,7 @@ Item
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
top: header.bottom
topMargin: visible ? UM.Theme.getSize("default_margin").height : 0
}
@ -74,7 +72,7 @@ Item
id: printerTypeSelector
text: Cura.MachineManager.activeMachineDefinitionName
tooltip: Cura.MachineManager.activeMachineDefinitionName
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("default_margin").width
anchors.right: parent.right
style: UM.Theme.styles.print_setup_header_button
@ -224,7 +222,7 @@ Item
Row
{
height: UM.Theme.getSize("print_setup_item").height
height: UM.Theme.getSize("print_setup_big_item").height
visible: Cura.MachineManager.hasMaterials
Label
@ -248,7 +246,7 @@ Item
text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : ""
tooltip: text
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: selectors.controlWidth
style: UM.Theme.styles.print_setup_header_button
@ -262,7 +260,7 @@ Item
Row
{
height: UM.Theme.getSize("print_setup_item").height
height: UM.Theme.getSize("print_setup_big_item").height
visible: Cura.MachineManager.hasVariants
Label
@ -282,7 +280,7 @@ Item
text: Cura.MachineManager.activeVariantName
tooltip: Cura.MachineManager.activeVariantName
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: selectors.controlWidth
style: UM.Theme.styles.print_setup_header_button
activeFocusOnPress: true;

View file

@ -27,7 +27,7 @@ Menu
MenuItem { id: extruderHeader; text: catalog.i18ncp("@label", "Print Selected Model With:", "Print Selected Models With:", UM.Selection.selectionCount); enabled: false; visible: base.shouldShowExtruders }
Instantiator
{
model: Cura.ExtrudersModel { id: extrudersModel }
model: CuraApplication.getExtrudersModel()
MenuItem {
text: "%1: %2 - %3".arg(model.name).arg(model.material).arg(model.variant)
visible: base.shouldShowExtruders

View file

@ -1,212 +0,0 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import UM 1.2 as UM
import Cura 1.0 as Cura
import "Menus"
import "Menus/ConfigurationMenu"
Rectangle
{
id: base
property int currentModeIndex
property bool hideSettings: PrintInformation.preSliced
property bool hideView: Cura.MachineManager.activeMachineName == ""
// Is there an output device for this printer?
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
property bool printerConnected: Cura.MachineManager.printerConnected
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
property variant printDuration: PrintInformation.currentPrintTime
property variant printMaterialLengths: PrintInformation.materialLengths
property variant printMaterialWeights: PrintInformation.materialWeights
property variant printMaterialCosts: PrintInformation.materialCosts
property variant printMaterialNames: PrintInformation.materialNames
color: UM.Theme.getColor("main_background")
UM.I18nCatalog { id: catalog; name: "cura"}
Timer {
id: tooltipDelayTimer
interval: 500
repeat: false
property var item
property string text
onTriggered:
{
base.showTooltip(base, {x: 0, y: item.y}, text);
}
}
function showTooltip(item, position, text)
{
tooltip.text = text;
position = item.mapToItem(base, position.x - UM.Theme.getSize("default_arrow").width, position.y);
tooltip.show(position);
}
function hideTooltip()
{
tooltip.hide();
}
function strPadLeft(string, pad, length) {
return (new Array(length + 1).join(pad) + string).slice(-length);
}
function getPrettyTime(time)
{
var hours = Math.floor(time / 3600)
time -= hours * 3600
var minutes = Math.floor(time / 60);
time -= minutes * 60
var seconds = Math.floor(time);
var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2);
return finalTime;
}
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.AllButtons
onWheel:
{
wheel.accepted = true;
}
}
MachineSelector
{
id: machineSelection
width: base.width - configSelection.width - separator.width
height: UM.Theme.getSize("stage_menu").height
anchors.top: base.top
anchors.left: parent.left
}
Rectangle
{
id: separator
visible: configSelection.visible
width: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0
height: UM.Theme.getSize("stage_menu").height
color: UM.Theme.getColor("thick_lining")
anchors.left: machineSelection.right
}
CustomConfigurationSelector
{
id: configSelection
visible: isNetworkPrinter && printerConnected
width: visible ? Math.round(base.width * 0.15) : 0
height: UM.Theme.getSize("stage_menu").height
anchors.top: base.top
anchors.right: parent.right
}
Loader
{
id: controlItem
anchors.bottom: footerSeparator.top
anchors.top: machineSelection.bottom
anchors.left: base.left
anchors.right: base.right
sourceComponent:
{
if(connectedPrinter != null)
{
if(connectedPrinter.controlItem != null)
{
return connectedPrinter.controlItem
}
}
return null
}
}
Loader
{
anchors.bottom: footerSeparator.top
anchors.top: machineSelection.bottom
anchors.left: base.left
anchors.right: base.right
source:
{
if(controlItem.sourceComponent == null)
{
return "PrintMonitor.qml"
}
else
{
return ""
}
}
}
Rectangle
{
id: footerSeparator
width: parent.width
height: UM.Theme.getSize("wide_lining").height
color: UM.Theme.getColor("wide_lining")
anchors.bottom: monitorButton.top
anchors.bottomMargin: UM.Theme.getSize("thick_margin").height
}
// MonitorButton is actually the bottom footer panel.
MonitorButton
{
id: monitorButton
implicitWidth: base.width
anchors.bottom: parent.bottom
}
PrintSetupTooltip
{
id: tooltip
}
UM.SettingPropertyProvider
{
id: machineExtruderCount
containerStack: Cura.MachineManager.activeMachine
key: "machine_extruder_count"
watchedProperties: [ "value" ]
storeIndex: 0
}
UM.SettingPropertyProvider
{
id: machineHeatedBed
containerStack: Cura.MachineManager.activeMachine
key: "machine_heated_bed"
watchedProperties: [ "value" ]
storeIndex: 0
}
// Make the ConfigurationSelector react when the global container changes, otherwise if Cura is not connected to the printer,
// switching printers make no reaction
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged:
{
base.isNetworkPrinter = Cura.MachineManager.activeMachineNetworkKey != ""
base.printerConnected = Cura.MachineManager.printerOutputDevices.length != 0
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2016 Ultimaker B.V.
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
@ -91,7 +91,7 @@ UM.ManagementPage
Item
{
width: childrenRect.width + 2 * screenScaleFactor
width: Math.round(childrenRect.width + 2 * screenScaleFactor)
height: childrenRect.height
Button
{

View file

@ -1,5 +1,5 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
@ -69,11 +69,7 @@ Rectangle
}
style: ButtonStyle
{
background: Rectangle
{
anchors.fill: parent
color: "transparent"
}
background: Item { }
}
}
}

View file

@ -1,5 +1,5 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
@ -70,7 +70,8 @@ Rectangle
}
onClicked:
{
if (materialSlot.is_favorite) {
if (materialSlot.is_favorite)
{
base.materialManager.removeFavorite(material.root_material_id)
materialSlot.is_favorite = false
return
@ -81,13 +82,10 @@ Rectangle
}
style: ButtonStyle
{
background: Rectangle
{
anchors.fill: parent
color: "transparent"
}
background: Item { }
}
UM.RecolorImage {
UM.RecolorImage
{
anchors
{
verticalCenter: favorite_button.verticalCenter

View file

@ -16,7 +16,7 @@ Item
property QtObject qualityManager: CuraApplication.getQualityManager()
property var resetEnabled: false // Keep PreferencesDialog happy
property var extrudersModel: Cura.ExtrudersModel {}
property var extrudersModel: CuraApplication.getExtrudersModel()
UM.I18nCatalog { id: catalog; name: "cura"; }

View file

@ -12,7 +12,7 @@ import Cura 1.0 as Cura
import "PrinterOutput"
Rectangle
Item
{
id: base
UM.I18nCatalog { id: catalog; name: "cura"}
@ -60,11 +60,7 @@ Rectangle
anchors.fill: parent
Cura.ExtrudersModel
{
id: extrudersModel
simpleNames: true
}
property var extrudersModel: CuraApplication.getExtrudersModel()
OutputDeviceHeader
{

View file

@ -16,10 +16,7 @@ Item
property real padding: UM.Theme.getSize("default_margin").width
property bool multipleExtruders: extrudersModel.count > 1
Cura.ExtrudersModel
{
id: extrudersModel
}
property var extrudersModel: CuraApplication.getExtrudersModel()
// Profile selector row
GlobalProfileSelector
@ -113,9 +110,11 @@ Item
}
z: tabBar.z - 1
// Don't show the border when only one extruder
border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent"
border.width: UM.Theme.getSize("default_lining").width
color: UM.Theme.getColor("main_background")
Cura.SettingView
{
anchors

View file

@ -26,10 +26,7 @@ Cura.ExpandableComponent
headerItem: PrintSetupSelectorHeader {}
Cura.ExtrudersModel
{
id: extrudersModel
}
property var extrudersModel: CuraApplication.getExtrudersModel()
contentItem: PrintSetupSelectorContents {}
}

View file

@ -144,6 +144,7 @@ Item
anchors.horizontalCenter: parent.horizontalCenter
y: UM.Theme.getSize("thin_margin").height
renderType: Text.NativeRendering
color: UM.Theme.getColor("quality_slider_available")
}
}
}

View file

@ -86,7 +86,7 @@ Item
if (Cura.MachineManager.activeQualityType == qualityItem.quality_type)
{
// set to -1 when switching to user created profile so all ticks are clickable
if (Cura.SimpleModeSettingsManager.isProfileUserCreated)
if (Cura.MachineManager.hasCustomQuality)
{
qualityModel.qualitySliderActiveIndex = -1
}
@ -181,7 +181,7 @@ Item
{
id: customisedSettings
visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated
visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality
height: visible ? UM.Theme.getSize("print_setup_icon").height : 0
width: height
anchors
@ -347,7 +347,7 @@ Item
{
anchors.fill: parent
hoverEnabled: true
enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated
enabled: !Cura.MachineManager.hasCustomQuality
onEntered:
{
var tooltipContent = catalog.i18nc("@tooltip", "This quality profile is not available for your current material and nozzle configuration. Please change these to enable this quality profile")
@ -406,7 +406,7 @@ Item
implicitWidth: UM.Theme.getSize("print_setup_slider_handle").width
implicitHeight: implicitWidth
radius: Math.round(implicitWidth / 2)
visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile
visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.MachineManager.hasCustomQuality && qualityModel.existingQualityProfile
}
}
@ -430,7 +430,7 @@ Item
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton
enabled: !Cura.SimpleModeSettingsManager.isProfileUserCreated
enabled: !Cura.MachineManager.hasCustomQuality
}
}
@ -440,7 +440,7 @@ Item
{
anchors.fill: parent
hoverEnabled: true
visible: Cura.SimpleModeSettingsManager.isProfileUserCreated
visible: Cura.MachineManager.hasCustomQuality
onEntered:
{

View file

@ -156,9 +156,10 @@ Item
}
//: Model used to populate the extrudelModel
Cura.ExtrudersModel
property var extruders: CuraApplication.getExtrudersModel()
Connections
{
id: extruders
target: extruders
onModelChanged: populateExtruderModel()
}

View file

@ -27,7 +27,7 @@ Item
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
text: label
font: UM.Theme.getFont("medium_bold")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("setting_category_text")
}
}

View file

@ -11,7 +11,7 @@ Cura.ExpandablePopup
{
id: machineSelector
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
property bool isNetworkPrinter: Cura.MachineManager.activeMachineHasRemoteConnection
property bool isPrinterConnected: Cura.MachineManager.printerConnected
property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
@ -24,49 +24,24 @@ Cura.ExpandablePopup
name: "cura"
}
headerItem: Item
headerItem: Cura.IconWithText
{
implicitHeight: icon.height
UM.RecolorImage
text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
source:
{
id: icon
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
source:
if (isNetworkPrinter)
{
if (isNetworkPrinter)
if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1)
{
if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1)
{
return UM.Theme.getIcon("printer_group")
}
return UM.Theme.getIcon("printer_single")
return UM.Theme.getIcon("printer_group")
}
return ""
return UM.Theme.getIcon("printer_single")
}
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
return ""
}
font: UM.Theme.getFont("medium")
iconColor: UM.Theme.getColor("machine_selector_printer_icon")
iconSize: source != "" ? UM.Theme.getSize("machine_selector_icon").width: 0
UM.RecolorImage
{
@ -123,6 +98,12 @@ Cura.ExpandablePopup
scroll.height = Math.min(height, maximumHeight)
popup.height = scroll.height + buttonRow.height
}
Component.onCompleted:
{
scroll.height = Math.min(height, maximumHeight)
popup.height = scroll.height + buttonRow.height
}
}
}

View file

@ -7,78 +7,40 @@ import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Column
ListView
{
id: machineSelectorList
id: listView
height: childrenRect.height
model: Cura.PrintersModel {}
section.property: "hasRemoteConnection"
Label
section.delegate: Label
{
text: catalog.i18nc("@label", "Connected printers")
visible: networkedPrintersModel.items.length > 0
leftPadding: UM.Theme.getSize("default_margin").width
text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers")
width: parent.width
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
leftPadding: UM.Theme.getSize("default_margin").width
renderType: Text.NativeRendering
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("text_medium")
verticalAlignment: Text.AlignVCenter
}
Repeater
delegate: MachineSelectorButton
{
id: networkedPrinters
text: model.name
width: listView.width
outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
model: UM.ContainerStacksModel
checked:
{
id: networkedPrintersModel
filter:
// If the machine has a remote connection
var result = Cura.MachineManager.activeMachineId == model.id
if (Cura.MachineManager.activeMachineHasRemoteConnection)
{
"type": "machine", "um_network_key": "*", "hidden": "False"
result |= Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
}
}
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
return result
}
}
}

View file

@ -19,6 +19,7 @@ Item
{
anchors.fill: parent
color: UM.Theme.getColor("printer_type_label_background")
radius: UM.Theme.getSize("checkbox_radius").width
}
Label

View file

@ -106,26 +106,7 @@ Button
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
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")
}
return UM.Theme.getColor("setting_category_text")
}
color: UM.Theme.getColor("setting_control_button")
source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
}
}

View file

@ -63,7 +63,7 @@ SettingItem
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text")
color: UM.Theme.getColor("setting_control_button")
}
contentItem: Label

View file

@ -17,11 +17,16 @@ SettingItem
id: control
anchors.fill: parent
model: Cura.ExtrudersModel
property var extrudersModel: CuraApplication.getExtrudersModel()
model: extrudersModel
Connections
{
target: extrudersModel
onModelChanged:
{
control.color = getItem(control.currentIndex).color
control.color = extrudersModel.getItem(control.currentIndex).color
}
}
@ -105,7 +110,7 @@ SettingItem
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text");
color: UM.Theme.getColor("setting_control_button");
}
background: Rectangle

View file

@ -12,15 +12,24 @@ SettingItem
id: base
property var focusItem: control
// Somehow if we directory set control.model to CuraApplication.getExtrudersModelWithOptional()
// and in the Connections.onModelChanged use control.model as a reference, it will complain about
// non-existing properties such as "onModelChanged" and "getItem". I guess if we access the model
// via "control.model", it gives back a generic/abstract model instance. To avoid this, we add
// this extra property to keep the ExtrudersModel and use this in the rest of the code.
property var extrudersWithOptionalModel: CuraApplication.getExtrudersModelWithOptional()
contents: ComboBox
{
id: control
anchors.fill: parent
model: Cura.ExtrudersModel
model: base.extrudersWithOptionalModel
Connections
{
onModelChanged: control.color = getItem(control.currentIndex).color
addOptionalExtruder: true
target: base.extrudersWithOptionalModel
onModelChanged: control.color = base.extrudersWithOptionalModel.getItem(control.currentIndex).color
}
textRole: "name"
@ -102,7 +111,7 @@ SettingItem
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text");
color: UM.Theme.getColor("setting_control_button");
}
background: Rectangle

View file

@ -558,17 +558,6 @@ Item
onTriggered: Cura.Actions.configureSettingVisibility.trigger(contextMenu);
}
MenuSeparator {}
MenuItem
{
text: catalog.i18nc("@action:inmenu", "Collapse All")
onTriggered: definitionsModel.collapseAll()
}
MenuItem
{
text: catalog.i18nc("@action:inmenu", "Expand All")
onTriggered: definitionsModel.expandRecursive()
}
}
UM.SettingPropertyProvider

View file

@ -67,7 +67,7 @@ Item
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")
color: UM.Theme.getColor("icon")
sourceSize: UM.Theme.getSize("button_icon")
}
@ -144,10 +144,7 @@ Item
}
}
Cura.ExtrudersModel
{
id: extrudersModel
}
property var extrudersModel: CuraApplication.getExtrudersModel()
UM.PointingRectangle
{

View file

@ -11,5 +11,5 @@ UM.SimpleButton
height: UM.Theme.getSize("small_button").height
hoverColor: UM.Theme.getColor("small_button_text_hover")
color: UM.Theme.getColor("small_button_text")
iconMargin: 0.5 * UM.Theme.getSize("wide_lining").width
iconMargin: UM.Theme.getSize("thick_lining").width
}

View file

@ -14,24 +14,28 @@ Cura.ExpandablePopup
contentPadding: UM.Theme.getSize("default_lining").width
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
property var viewModel: UM.ViewModel { }
property var activeView:
property var viewModel: UM.ViewModel
{
for (var i = 0; i < viewModel.count; i++)
onDataChanged: updateActiveView()
}
property var activeView: null
function updateActiveView()
{
for (var index in viewModel.items)
{
if (viewModel.items[i].active)
if (viewModel.items[index].active)
{
return viewModel.items[i]
activeView = viewModel.items[index]
return
}
}
return null
activeView = 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)
@ -43,7 +47,7 @@ Cura.ExpandablePopup
Label
{
id: title
text: catalog.i18nc("@button", "View types")
text: catalog.i18nc("@label", "View types")
verticalAlignment: Text.AlignVCenter
height: parent.height
elide: Text.ElideRight
@ -74,8 +78,6 @@ 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: