mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 21:44:01 -06:00
Merge branch 'ui_rework_4_0' into CURA-5941_restyle_setting_dropdown
This commit is contained in:
commit
07d58c3aef
64 changed files with 726 additions and 1081 deletions
38
resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml
Normal file
38
resources/qml/Menus/ConfigurationMenu/AutoConfiguration.qml
Normal file
|
@ -0,0 +1,38 @@
|
|||
// 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.0
|
||||
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Item
|
||||
{
|
||||
width: parent.width
|
||||
height: visible ? childrenRect.height : 0
|
||||
|
||||
Label
|
||||
{
|
||||
id: header
|
||||
text: catalog.i18nc("@header", "Configurations")
|
||||
font: UM.Theme.getFont("large")
|
||||
color: UM.Theme.getColor("text")
|
||||
height: contentHeight
|
||||
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
ConfigurationListView
|
||||
{
|
||||
anchors.top: header.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").width
|
||||
width: parent.width
|
||||
|
||||
outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||
}
|
||||
}
|
|
@ -7,143 +7,129 @@ import QtQuick.Controls 2.0
|
|||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Rectangle
|
||||
Button
|
||||
{
|
||||
id: configurationItem
|
||||
|
||||
property var configuration: null
|
||||
property var selected: false
|
||||
signal activateConfiguration()
|
||||
hoverEnabled: true
|
||||
|
||||
height: childrenRect.height
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: updateBorderColor()
|
||||
color: selected ? UM.Theme.getColor("configuration_item_active") : UM.Theme.getColor("configuration_item")
|
||||
property var textColor: selected ? UM.Theme.getColor("configuration_item_text_active") : UM.Theme.getColor("configuration_item_text")
|
||||
|
||||
function updateBorderColor()
|
||||
background: Rectangle
|
||||
{
|
||||
border.color = selected ? UM.Theme.getColor("configuration_item_border_active") : UM.Theme.getColor("configuration_item_border")
|
||||
}
|
||||
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
|
||||
radius: UM.Theme.getSize("default_radius").width
|
||||
|
||||
Column
|
||||
{
|
||||
id: contentColumn
|
||||
width: parent.width
|
||||
padding: UM.Theme.getSize("default_margin").width
|
||||
spacing: Math.round(UM.Theme.getSize("default_margin").height / 2)
|
||||
|
||||
Row
|
||||
Column
|
||||
{
|
||||
id: extruderRow
|
||||
id: contentColumn
|
||||
width: parent.width
|
||||
padding: UM.Theme.getSize("wide_margin").width
|
||||
spacing: Math.round(UM.Theme.getSize("default_margin").height / 2)
|
||||
|
||||
width: parent.width - 2 * parent.padding
|
||||
height: childrenRect.height
|
||||
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Repeater
|
||||
Row
|
||||
{
|
||||
id: repeater
|
||||
height: childrenRect.height
|
||||
model: configuration.extruderConfigurations
|
||||
delegate: PrintCoreConfiguration
|
||||
id: extruderRow
|
||||
|
||||
anchors
|
||||
{
|
||||
width: Math.round(parent.width / 2)
|
||||
printCoreConfiguration: modelData
|
||||
mainColor: textColor
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Buildplate row separator
|
||||
Rectangle
|
||||
{
|
||||
id: separator
|
||||
|
||||
visible: buildplateInformation.visible
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
leftMargin: parent.padding
|
||||
right: parent.right
|
||||
rightMargin: parent.padding
|
||||
}
|
||||
height: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: buildplateInformation
|
||||
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
leftMargin: parent.padding
|
||||
right: parent.right
|
||||
rightMargin: parent.padding
|
||||
}
|
||||
height: childrenRect.height
|
||||
visible: configuration.buildplateConfiguration != ""
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: buildplateIcon
|
||||
anchors.left: parent.left
|
||||
width: UM.Theme.getSize("main_window_header_button_icon").width
|
||||
height: UM.Theme.getSize("main_window_header_button_icon").height
|
||||
source: UM.Theme.getIcon("buildplate")
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: buildplateLabel
|
||||
anchors.left: buildplateIcon.right
|
||||
anchors.verticalCenter: buildplateIcon.verticalCenter
|
||||
anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2)
|
||||
text: configuration.buildplateConfiguration
|
||||
renderType: Text.NativeRendering
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Buildplate row separator
|
||||
Rectangle
|
||||
Connections
|
||||
{
|
||||
id: separator
|
||||
|
||||
visible: buildplateInformation.visible
|
||||
width: parent.width - 2 * parent.padding
|
||||
height: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0
|
||||
color: textColor
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: buildplateInformation
|
||||
width: parent.width - 2 * parent.padding
|
||||
height: childrenRect.height
|
||||
visible: configuration.buildplateConfiguration != ""
|
||||
|
||||
UM.RecolorImage {
|
||||
id: buildplateIcon
|
||||
anchors.left: parent.left
|
||||
width: UM.Theme.getSize("main_window_header_button_icon").width
|
||||
height: UM.Theme.getSize("main_window_header_button_icon").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
source: UM.Theme.getIcon("buildplate")
|
||||
color: textColor
|
||||
}
|
||||
|
||||
Label
|
||||
target: Cura.MachineManager
|
||||
onCurrentConfigurationChanged:
|
||||
{
|
||||
id: buildplateLabel
|
||||
anchors.left: buildplateIcon.right
|
||||
anchors.verticalCenter: buildplateIcon.verticalCenter
|
||||
anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2)
|
||||
text: configuration.buildplateConfiguration
|
||||
renderType: Text.NativeRendering
|
||||
color: textColor
|
||||
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
onClicked: activateConfiguration()
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onEntered:
|
||||
Component.onCompleted:
|
||||
{
|
||||
parent.border.color = UM.Theme.getColor("configuration_item_border_hover")
|
||||
if (configurationItem.selected == false)
|
||||
{
|
||||
configurationItem.color = UM.Theme.getColor("wide_lining")
|
||||
}
|
||||
}
|
||||
onExited:
|
||||
{
|
||||
updateBorderColor()
|
||||
if (configurationItem.selected == false)
|
||||
{
|
||||
configurationItem.color = UM.Theme.getColor("configuration_item")
|
||||
}
|
||||
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
|
||||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
onClicked:
|
||||
{
|
||||
target: Cura.MachineManager
|
||||
onCurrentConfigurationChanged: {
|
||||
configurationItem.selected = Cura.MachineManager.matchesConfiguration(configuration)
|
||||
updateBorderColor()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
configurationItem.selected = Cura.MachineManager.matchesConfiguration(configuration)
|
||||
updateBorderColor()
|
||||
}
|
||||
|
||||
onVisibleChanged:
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
// I cannot trigger function updateBorderColor() after visibility change
|
||||
color = selected ? UM.Theme.getColor("configuration_item_active") : UM.Theme.getColor("configuration_item")
|
||||
}
|
||||
Cura.MachineManager.applyRemoteConfiguration(configuration)
|
||||
}
|
||||
}
|
|
@ -2,8 +2,7 @@
|
|||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
@ -12,9 +11,7 @@ Column
|
|||
{
|
||||
id: base
|
||||
property var outputDevice: null
|
||||
property var computedHeight: container.height + configurationListHeading.height + 3 * padding
|
||||
height: childrenRect.height + 2 * padding
|
||||
padding: UM.Theme.getSize("default_margin").width
|
||||
spacing: Math.round(UM.Theme.getSize("default_margin").height / 2)
|
||||
|
||||
function forceModelUpdate()
|
||||
|
@ -27,38 +24,16 @@ Column
|
|||
}
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: configurationListHeading
|
||||
text: catalog.i18nc("@label:header configurations", "Available configurations")
|
||||
font: UM.Theme.getFont("large")
|
||||
width: parent.width - 2 * parent.padding
|
||||
color: UM.Theme.getColor("configuration_item_text")
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: sectionHeading
|
||||
Rectangle
|
||||
{
|
||||
height: childrenRect.height + UM.Theme.getSize("default_margin").height
|
||||
Label
|
||||
{
|
||||
text: section
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
color: UM.Theme.getColor("configuration_item_text")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: container
|
||||
width: parent.width - parent.padding
|
||||
width: parent.width
|
||||
height: Math.min(configurationList.contentHeight, 350 * screenScaleFactor)
|
||||
|
||||
style: UM.Theme.styles.scrollview
|
||||
__wheelAreaScrollSpeed: 75 // Scroll three lines in one scroll event
|
||||
ButtonGroup
|
||||
{
|
||||
buttons: configurationList.children
|
||||
}
|
||||
|
||||
ListView
|
||||
{
|
||||
|
@ -69,18 +44,22 @@ Column
|
|||
|
||||
section.property: "modelData.printerType"
|
||||
section.criteria: ViewSection.FullString
|
||||
section.delegate: sectionHeading
|
||||
section.delegate: Item
|
||||
{
|
||||
height: printerTypeLabel.height + UM.Theme.getSize("default_margin").height
|
||||
Cura.PrinterTypeLabel
|
||||
{
|
||||
id: printerTypeLabel
|
||||
text: Cura.MachineManager.getAbbreviatedMachineName(section)
|
||||
}
|
||||
}
|
||||
|
||||
model: (outputDevice != null) ? outputDevice.uniqueConfigurations : []
|
||||
|
||||
delegate: ConfigurationItem
|
||||
{
|
||||
width: parent.width - UM.Theme.getSize("default_margin").width
|
||||
width: parent.width
|
||||
configuration: modelData
|
||||
onActivateConfiguration:
|
||||
{
|
||||
switchPopupState()
|
||||
Cura.MachineManager.applyRemoteConfiguration(configuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
181
resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml
Normal file
181
resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml
Normal file
|
@ -0,0 +1,181 @@
|
|||
// 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.0
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
|
||||
/**
|
||||
* Menu that allows you to select the configuration of the current printer, such
|
||||
* as the nozzle sizes and materials in each extruder.
|
||||
*/
|
||||
Cura.ExpandablePopup
|
||||
{
|
||||
id: base
|
||||
|
||||
Cura.ExtrudersModel
|
||||
{
|
||||
id: extrudersModel
|
||||
}
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
|
||||
enum ConfigurationMethod
|
||||
{
|
||||
AUTO,
|
||||
CUSTOM
|
||||
}
|
||||
|
||||
headerItem: Item
|
||||
{
|
||||
// Horizontal list that shows the extruders
|
||||
ListView
|
||||
{
|
||||
id: extrudersList
|
||||
|
||||
orientation: ListView.Horizontal
|
||||
anchors.fill: parent
|
||||
model: extrudersModel
|
||||
|
||||
delegate: Item
|
||||
{
|
||||
height: parent.height
|
||||
width: Math.round(ListView.view.width / extrudersModel.count)
|
||||
|
||||
// Extruder icon. Shows extruder index and has the same color as the active material.
|
||||
Cura.ExtruderIcon
|
||||
{
|
||||
id: extruderIcon
|
||||
materialColor: model.color
|
||||
extruderEnabled: model.enabled
|
||||
height: parent.height
|
||||
width: height
|
||||
}
|
||||
|
||||
// Label for the brand of the material
|
||||
Label
|
||||
{
|
||||
id: brandNameLabel
|
||||
|
||||
text: model.material_brand
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text_inactive")
|
||||
|
||||
anchors
|
||||
{
|
||||
left: extruderIcon.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
}
|
||||
|
||||
// Label that shows the name of the material
|
||||
Label
|
||||
{
|
||||
text: model.material
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
|
||||
anchors
|
||||
{
|
||||
left: extruderIcon.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
top: brandNameLabel.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
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.
|
||||
onVisibleChanged:
|
||||
{
|
||||
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && 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.
|
||||
|
||||
Item
|
||||
{
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
AutoConfiguration
|
||||
{
|
||||
id: autoConfiguration
|
||||
visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO
|
||||
}
|
||||
|
||||
CustomConfiguration
|
||||
{
|
||||
id: customConfiguration
|
||||
visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: separator
|
||||
visible: buttonBar.visible
|
||||
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("default_lining").height
|
||||
|
||||
color: UM.Theme.getColor("lining")
|
||||
}
|
||||
|
||||
//Allow switching between custom and auto.
|
||||
Item
|
||||
{
|
||||
id: buttonBar
|
||||
visible: popupItem.is_connected //Switching only makes sense if the "auto" part is possible.
|
||||
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
|
||||
Cura.SecondaryButton
|
||||
{
|
||||
id: goToCustom
|
||||
visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO
|
||||
text: catalog.i18nc("@label", "Custom")
|
||||
|
||||
anchors.right: parent.right
|
||||
|
||||
iconSource: UM.Theme.getIcon("arrow_right")
|
||||
isIconOnRightSide: true
|
||||
|
||||
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.CUSTOM
|
||||
}
|
||||
|
||||
Cura.SecondaryButton
|
||||
{
|
||||
id: goToAuto
|
||||
visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM
|
||||
text: catalog.i18nc("@label", "Configurations")
|
||||
|
||||
iconSource: UM.Theme.getIcon("arrow_left")
|
||||
|
||||
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.AUTO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
246
resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml
Normal file
246
resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml
Normal file
|
@ -0,0 +1,246 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Controls 1.1 as OldControls
|
||||
|
||||
import Cura 1.0 as Cura
|
||||
import UM 1.3 as UM
|
||||
|
||||
Item
|
||||
{
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
|
||||
width: parent.width
|
||||
height: visible ? childrenRect.height : 0
|
||||
|
||||
Label
|
||||
{
|
||||
id: header
|
||||
text: catalog.i18nc("@header", "Custom")
|
||||
font: UM.Theme.getFont("large")
|
||||
color: UM.Theme.getColor("text")
|
||||
height: contentHeight
|
||||
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
UM.TabRow
|
||||
{
|
||||
id: tabBar
|
||||
anchors.top: header.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
visible: extrudersModel.count > 1
|
||||
|
||||
Repeater
|
||||
{
|
||||
id: repeater
|
||||
model: extrudersModel
|
||||
delegate: UM.TabRowButton
|
||||
{
|
||||
contentItem: Item
|
||||
{
|
||||
Cura.ExtruderIcon
|
||||
{
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
materialColor: model.color
|
||||
extruderEnabled: model.enabled
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
}
|
||||
}
|
||||
onClicked:
|
||||
{
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(tabBar.currentIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//When active extruder changes for some other reason, switch tabs.
|
||||
//Don't directly link currentIndex to Cura.ExtruderManager.activeExtruderIndex!
|
||||
//This causes a segfault in Qt 5.11. Something with VisualItemModel removing index -1. We have to use setCurrentIndex instead.
|
||||
Connections
|
||||
{
|
||||
target: Cura.ExtruderManager
|
||||
onActiveExtruderChanged:
|
||||
{
|
||||
tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//When the model of the extruders is rebuilt, the list of extruders is briefly emptied and rebuilt.
|
||||
//This causes the currentIndex of the tab to be in an invalid position which resets it to 0.
|
||||
//Therefore we need to change it back to what it was: The active extruder index.
|
||||
Connections
|
||||
{
|
||||
target: repeater.model
|
||||
onModelChanged:
|
||||
{
|
||||
tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
anchors.top: tabBar.bottom
|
||||
|
||||
radius: tabBar.visible ? UM.Theme.getSize("default_radius").width : 0
|
||||
border.width: tabBar.visible ? UM.Theme.getSize("default_lining").width : 0
|
||||
border.color: UM.Theme.getColor("lining")
|
||||
color: UM.Theme.getColor("main_background")
|
||||
|
||||
//Remove rounding and lining at the top.
|
||||
Rectangle
|
||||
{
|
||||
width: parent.width
|
||||
height: parent.radius
|
||||
anchors.top: parent.top
|
||||
color: UM.Theme.getColor("lining")
|
||||
visible: tabBar.visible
|
||||
Rectangle
|
||||
{
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
leftMargin: parent.parent.border.width
|
||||
right: parent.right
|
||||
rightMargin: parent.parent.border.width
|
||||
top: parent.top
|
||||
}
|
||||
height: parent.parent.radius
|
||||
color: parent.parent.color
|
||||
}
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
id: selectors
|
||||
padding: UM.Theme.getSize("default_margin").width
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
property var model: extrudersModel.items[tabBar.currentIndex]
|
||||
|
||||
readonly property real paddedWidth: parent.width - padding * 2
|
||||
property real textWidth: Math.round(paddedWidth * 0.3)
|
||||
property real controlWidth: paddedWidth - textWidth
|
||||
|
||||
Row
|
||||
{
|
||||
height: UM.Theme.getSize("print_setup_item").height
|
||||
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Enabled")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
height: parent.height
|
||||
width: selectors.textWidth
|
||||
visible: extrudersModel.count > 1
|
||||
}
|
||||
|
||||
OldControls.CheckBox
|
||||
{
|
||||
checked: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.isEnabled : false
|
||||
enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder.
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
style: UM.Theme.styles.checkbox
|
||||
visible: extrudersModel.count > 1
|
||||
|
||||
/* Use a MouseArea to process the click on this checkbox.
|
||||
This is necessary because actually clicking the checkbox
|
||||
causes the "checked" property to be overwritten. After
|
||||
it's been overwritten, the original link that made it
|
||||
depend on the active extruder stack is broken. */
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: Cura.MachineManager.setExtruderEnabled(Cura.ExtruderManager.activeExtruderIndex, !parent.checked)
|
||||
enabled: parent.enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
height: UM.Theme.getSize("print_setup_item").height
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Material")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
height: parent.height
|
||||
width: selectors.textWidth
|
||||
visible: materialSelection.visible
|
||||
}
|
||||
|
||||
OldControls.ToolButton
|
||||
{
|
||||
id: materialSelection
|
||||
|
||||
property bool valueError: Cura.MachineManager.activeStack != null ? Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "compatible", "") != "True" : true
|
||||
property bool valueWarning: !Cura.MachineManager.isActiveQualitySupported
|
||||
|
||||
text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : ""
|
||||
tooltip: text
|
||||
visible: Cura.MachineManager.hasMaterials
|
||||
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
width: selectors.controlWidth
|
||||
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
activeFocusOnPress: true
|
||||
menu: Cura.MaterialMenu
|
||||
{
|
||||
extruderIndex: Cura.ExtruderManager.activeExtruderIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
height: UM.Theme.getSize("print_setup_item").height
|
||||
|
||||
Label
|
||||
{
|
||||
text: Cura.MachineManager.activeDefinitionVariantsName
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
height: parent.height
|
||||
width: selectors.textWidth
|
||||
visible: variantSelection.visible
|
||||
}
|
||||
|
||||
OldControls.ToolButton
|
||||
{
|
||||
id: variantSelection
|
||||
text: Cura.MachineManager.activeVariantName
|
||||
tooltip: Cura.MachineManager.activeVariantName;
|
||||
visible: Cura.MachineManager.hasVariants
|
||||
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
width: selectors.controlWidth
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
activeFocusOnPress: true;
|
||||
|
||||
menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,87 +5,50 @@ import QtQuick 2.7
|
|||
import QtQuick.Controls 2.0
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
|
||||
Column
|
||||
Row
|
||||
{
|
||||
id: extruderInfo
|
||||
property var printCoreConfiguration
|
||||
property var mainColor: "black"
|
||||
spacing: Math.round(UM.Theme.getSize("default_margin").height / 2)
|
||||
|
||||
height: childrenRect.height
|
||||
height: information.height
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Item
|
||||
//Extruder icon.
|
||||
Cura.ExtruderIcon
|
||||
{
|
||||
id: extruder
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
materialColor: printCoreConfiguration.material.color
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
extruderEnabled: printCoreConfiguration.material.name !== "" && printCoreConfiguration.hotendID !== ""
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
id: information
|
||||
Label
|
||||
{
|
||||
id: extruderLabel
|
||||
text: catalog.i18nc("@label:extruder label", "Extruder")
|
||||
text: printCoreConfiguration.material.brand ? printCoreConfiguration.material.brand : " " //Use space so that the height is still correct.
|
||||
renderType: Text.NativeRendering
|
||||
elide: Text.ElideRight
|
||||
anchors.left: parent.left
|
||||
font: UM.Theme.getFont("default")
|
||||
color: mainColor
|
||||
color: UM.Theme.getColor("text_inactive")
|
||||
}
|
||||
|
||||
// Rounded item to show the extruder number
|
||||
Item
|
||||
Label
|
||||
{
|
||||
id: extruderIconItem
|
||||
anchors.verticalCenter: extruderLabel.verticalCenter
|
||||
anchors.left: extruderLabel.right
|
||||
anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").width / 2)
|
||||
|
||||
width: UM.Theme.getSize("section_icon").width
|
||||
height: UM.Theme.getSize("section_icon").height
|
||||
|
||||
UM.RecolorImage {
|
||||
id: mainCircle
|
||||
anchors.fill: parent
|
||||
|
||||
anchors.centerIn: parent
|
||||
sourceSize.width: parent.width
|
||||
sourceSize.height: parent.height
|
||||
source: UM.Theme.getIcon("extruder_button")
|
||||
color: mainColor
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: extruderNumberText
|
||||
anchors.centerIn: parent
|
||||
text: printCoreConfiguration.position + 1
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("default")
|
||||
color: mainColor
|
||||
}
|
||||
text: printCoreConfiguration.material.name ? printCoreConfiguration.material.name : " " //Use space so that the height is still correct.
|
||||
renderType: Text.NativeRendering
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: printCoreConfiguration.hotendID ? printCoreConfiguration.hotendID : " " //Use space so that the height is still correct.
|
||||
renderType: Text.NativeRendering
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text_inactive")
|
||||
}
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: materialLabel
|
||||
text: printCoreConfiguration.material == null ? "" : printCoreConfiguration.material.name
|
||||
renderType: Text.NativeRendering
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
color: mainColor
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: printCoreTypeLabel
|
||||
text: printCoreConfiguration.hotendID
|
||||
renderType: Text.NativeRendering
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
font: UM.Theme.getFont("default")
|
||||
color: mainColor
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,242 +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 2.0
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import QtQuick.Controls 1.1 as OldControls
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
|
||||
Cura.ExpandablePopup
|
||||
{
|
||||
id: base
|
||||
|
||||
Cura.ExtrudersModel
|
||||
{
|
||||
id: extrudersModel
|
||||
}
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
|
||||
headerItem: Item
|
||||
{
|
||||
// Horizontal list that shows the extruders
|
||||
ListView
|
||||
{
|
||||
id: extrudersList
|
||||
|
||||
orientation: ListView.Horizontal
|
||||
anchors.fill: parent
|
||||
model: extrudersModel
|
||||
|
||||
delegate: Item
|
||||
{
|
||||
height: parent.height
|
||||
width: Math.round(ListView.view.width / extrudersModel.rowCount())
|
||||
|
||||
// Extruder icon. Shows extruder index and has the same color as the active material.
|
||||
Cura.ExtruderIcon
|
||||
{
|
||||
id: extruderIcon
|
||||
materialColor: model.color
|
||||
extruderEnabled: model.enabled
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
// Label for the brand of the material
|
||||
Label
|
||||
{
|
||||
id: brandNameLabel
|
||||
|
||||
text: model.material_brand
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
|
||||
anchors
|
||||
{
|
||||
left: extruderIcon.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
}
|
||||
|
||||
// Label that shows the name of the material
|
||||
Label
|
||||
{
|
||||
text: model.material
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
|
||||
anchors
|
||||
{
|
||||
left: extruderIcon.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
top: brandNameLabel.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
width: base.width - 2 * UM.Theme.getSize("default_margin").width
|
||||
height: 200
|
||||
|
||||
TabBar
|
||||
{
|
||||
id: tabBar
|
||||
onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex)
|
||||
width: parent.width
|
||||
height: 50
|
||||
Repeater
|
||||
{
|
||||
model: extrudersModel
|
||||
|
||||
delegate: TabButton
|
||||
{
|
||||
width: ListView.view != null ? Math.round(ListView.view.width / extrudersModel.rowCount()): 0
|
||||
height: parent.height
|
||||
contentItem: Item
|
||||
{
|
||||
Cura.ExtruderIcon
|
||||
{
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
materialColor: model.color
|
||||
extruderEnabled: model.enabled
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: tabControl
|
||||
width: parent.width
|
||||
anchors.top: tabBar.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
property var model: extrudersModel.items[tabBar.currentIndex]
|
||||
property real textWidth: Math.round(width * 0.3)
|
||||
property real controlWidth: width - textWidth
|
||||
Column
|
||||
{
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
Row
|
||||
{
|
||||
height: UM.Theme.getSize("print_setup_item").height
|
||||
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Enabled")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
height: parent.height
|
||||
width: tabControl.textWidth
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
|
||||
OldControls.CheckBox
|
||||
{
|
||||
checked: tabControl.model != null ? Cura.MachineManager.getExtruder(tabControl.model.index).isEnabled: false
|
||||
onClicked: Cura.MachineManager.setExtruderEnabled(tabControl.model.index, checked)
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
style: UM.Theme.styles.checkbox
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
height: UM.Theme.getSize("print_setup_item").height
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Material")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
height: parent.height
|
||||
width: tabControl.textWidth
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
|
||||
OldControls.ToolButton
|
||||
{
|
||||
id: materialSelection
|
||||
|
||||
property var activeExtruder: Cura.MachineManager.activeStack
|
||||
property var hasActiveExtruder: activeExtruder != null
|
||||
property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : ""
|
||||
property var valueError: hasActiveExtruder ? Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible", "") != "True" : true
|
||||
property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported
|
||||
|
||||
text: currentRootMaterialName
|
||||
tooltip: currentRootMaterialName
|
||||
visible: Cura.MachineManager.hasMaterials
|
||||
|
||||
enabled: Cura.ExtruderManager.activeExtruderIndex > -1
|
||||
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
width: tabControl.controlWidth
|
||||
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
activeFocusOnPress: true
|
||||
menu: Cura.MaterialMenu
|
||||
{
|
||||
extruderIndex: Cura.ExtruderManager.activeExtruderIndex
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
height: UM.Theme.getSize("print_setup_item").height
|
||||
|
||||
Label
|
||||
{
|
||||
text: Cura.MachineManager.activeDefinitionVariantsName
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
height: parent.height
|
||||
width: tabControl.textWidth
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
|
||||
OldControls.ToolButton
|
||||
{
|
||||
id: variantSelection
|
||||
text: Cura.MachineManager.activeVariantName
|
||||
tooltip: Cura.MachineManager.activeVariantName;
|
||||
visible: Cura.MachineManager.hasVariants
|
||||
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
width: tabControl.controlWidth
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
activeFocusOnPress: true;
|
||||
|
||||
menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,102 +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.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Button
|
||||
{
|
||||
id: base
|
||||
property var outputDevice: null
|
||||
property var matched: updateOnSync()
|
||||
text: matched == true ? catalog.i18nc("@label:extruder label", "Yes") : catalog.i18nc("@label:extruder label", "No")
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
function updateOnSync()
|
||||
{
|
||||
if (outputDevice != undefined)
|
||||
{
|
||||
for (var index in outputDevice.uniqueConfigurations)
|
||||
{
|
||||
var configuration = outputDevice.uniqueConfigurations[index]
|
||||
if (Cura.MachineManager.matchesConfiguration(configuration))
|
||||
{
|
||||
base.matched = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
base.matched = false;
|
||||
}
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
color:
|
||||
{
|
||||
if(control.pressed)
|
||||
{
|
||||
return UM.Theme.getColor("machine_selector_active");
|
||||
}
|
||||
else if(control.hovered)
|
||||
{
|
||||
return UM.Theme.getColor("machine_selector_hover");
|
||||
}
|
||||
else
|
||||
{
|
||||
return UM.Theme.getColor("machine_selector_bar");
|
||||
}
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: downArrow
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
width: UM.Theme.getSize("standard_arrow").width
|
||||
height: UM.Theme.getSize("standard_arrow").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: UM.Theme.getColor("text_emphasis")
|
||||
source: UM.Theme.getIcon("arrow_bottom")
|
||||
}
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: sidebarComboBoxLabel
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
|
||||
width: UM.Theme.getSize("printer_sync_icon").width
|
||||
height: UM.Theme.getSize("printer_sync_icon").height
|
||||
|
||||
color: control.matched ? UM.Theme.getColor("printer_config_matched") : UM.Theme.getColor("printer_config_mismatch")
|
||||
source: UM.Theme.getIcon("tab_status_connected")
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
}
|
||||
}
|
||||
label: Label {}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: outputDevice
|
||||
onUniqueConfigurationsChanged: updateOnSync()
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.MachineManager
|
||||
onCurrentConfigurationChanged: updateOnSync()
|
||||
onOutputDevicesChanged: updateOnSync()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue