From 871f0a130edd32d2dff694e2e19f770230ed2d64 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 5 Mar 2018 11:44:26 +0100 Subject: [PATCH] CURA-4870 Frontend formatting to show the configurations --- .../ConfigurationMenu/ConfigurationItem.qml | 63 ++++++++++++++----- .../ConfigurationListView.qml | 7 +-- .../PrintCoreConfiguration.qml | 57 +++++++++++++++-- .../Menus/ConfigurationMenu/SyncButton.qml | 2 +- 4 files changed, 101 insertions(+), 28 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 7d9c87edf4..3d511e3250 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -16,48 +16,77 @@ Rectangle height: childrenRect.height border.width: UM.Theme.getSize("default_lining").width - border.color: "black" + border.color: UM.Theme.getColor("sidebar_lining_thin") Column { id: contentColumn + width: parent.width padding: UM.Theme.getSize("default_margin").width - spacing: UM.Theme.getSize("default_margin").height - - Label - { - text: configuration.printerType - } + spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) Row { id: extruderRow - width: parent.width + width: parent.width - 2 * 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 } + Component.onCompleted: {print("ELEMENTOS:", repeater.model.count)} } } -// Rectangle -// { -// id: buildplateInformation -// -// Label -// { -// text: configuration.buildplateConfiguration -// } -// } + //Buildplate row separator + Rectangle { + id: separator + + visible: buildplateInformation.visible + width: parent.width - 2 * parent.padding + height: visible ? Math.round(UM.Theme.getSize("sidebar_lining_thin").height / 2) : 0 + color: UM.Theme.getColor("sidebar_lining_thin") + } + + Item + { + id: buildplateInformation + width: parent.width - 2 * parent.padding + height: childrenRect.height + visible: configuration.buildplateConfiguration != "" + + UM.RecolorImage { + id: buildplateIcon + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + sourceSize.height: height + source: UM.Theme.getIcon("extruder_button") + + color: "black" + } + + Label + { + id: buildplateLabel + anchors.left: buildplateIcon.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2) + text: configuration.buildplateConfiguration + } + } } MouseArea diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index fa82f43871..f962dbaa9f 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -14,7 +14,7 @@ Column property var outputDevice: Cura.MachineManager.printerOutputDevices[0] height: childrenRect.height + 2 * padding padding: UM.Theme.getSize("default_margin").width - spacing: UM.Theme.getSize("default_margin").height + spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) Label { text: catalog.i18nc("@label:header configurations", "Available configurations") @@ -25,7 +25,7 @@ Column ScrollView { id: container width: parent.width - 2 * parent.padding - height: childrenRect.height + height: 500 //childrenRect.height style: UM.Theme.styles.scrollview @@ -52,16 +52,13 @@ Column model: outputDevice.uniqueConfigurations delegate: ConfigurationItem { - height: parent.height width: parent.width configuration: modelData onConfigurationSelected: { print("SELECCIONANDO CONFIGURACION", JSON.stringify(configuration)) } - Component.onCompleted: {print("$$$$$$$$$$$$$$$$$$ Configuracion", JSON.stringify(configuration))} } - Component.onCompleted: {print("$$$$$$$$$$$$$$$$$$ Elementos del modelo", JSON.stringify(outputDevice.uniqueConfigurations))} } } } diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index 670d618849..8155842349 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -7,29 +7,76 @@ import QtQuick.Controls 2.0 import UM 1.2 as UM -Item +Column { id: extruderInfo property var printCoreConfiguration + spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) height: childrenRect.height + Item + { + id: extruder + width: parent.width + height: childrenRect.height + + Label + { + id: extruderLabel + text: catalog.i18nc("@label:extruder label", "Extruder") + elide: Text.ElideRight + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + font: UM.Theme.getFont("small") + } + + // Rounded item to show the extruder number + Item + { + id: extruderIconItem + anchors.verticalCenter: parent.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 + + sourceSize.width: parent.width + sourceSize.height: parent.height + source: UM.Theme.getIcon("extruder_button") + + color: extruderNumberText.color + } + + Label + { + id: extruderNumberText + anchors.centerIn: parent + text: printCoreConfiguration.position + 1 + font: UM.Theme.getFont("small") + } + } + } + Label { id: materialLabel text: printCoreConfiguration.material elide: Text.ElideRight width: parent.width - font: UM.Theme.getFont("very_small") + font: UM.Theme.getFont("small") } Label { - id: printCoreLabel + id: printCoreTypeLabel text: printCoreConfiguration.hotendID - anchors.top: materialLabel.bottom elide: Text.ElideRight width: parent.width font: UM.Theme.getFont("very_small") - opacity: 0.5 } } diff --git a/resources/qml/Menus/ConfigurationMenu/SyncButton.qml b/resources/qml/Menus/ConfigurationMenu/SyncButton.qml index 79c75bb55d..f9e93b2d22 100644 --- a/resources/qml/Menus/ConfigurationMenu/SyncButton.qml +++ b/resources/qml/Menus/ConfigurationMenu/SyncButton.qml @@ -43,7 +43,7 @@ Button width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width - sourceSize.height: width + sourceSize.height: height color: UM.Theme.getColor("text_emphasis") source: UM.Theme.getIcon("arrow_bottom") }