mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 21:13:58 -06:00
parent
4bffa6d90f
commit
a1c252d3a2
73 changed files with 3047 additions and 1216 deletions
|
@ -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")
|
||||
height: background.height
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue