From ca637338270e12c7dd32e20e21dd005eae2066cb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Nov 2018 13:06:12 +0100 Subject: [PATCH] Updated header of the settingbar CURA-5785 --- resources/qml/IconWithText.qml | 60 ++++++++++++++++++ resources/qml/PrintSetupSelector.qml | 94 ++++++++++++++++++++++++---- 2 files changed, 141 insertions(+), 13 deletions(-) create mode 100644 resources/qml/IconWithText.qml diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml new file mode 100644 index 0000000000..0b0feea821 --- /dev/null +++ b/resources/qml/IconWithText.qml @@ -0,0 +1,60 @@ +// 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.Layouts 1.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +// Reusable component that holds an (re-colorable) icon on the left with some text on the right +Item +{ + property alias iconColor: icon.color + property alias source: icon.source + property alias text: label.text + + implicitWidth: icon.width + 100 + implicitHeight: icon.height + + Component.onCompleted: print(label.contentWidth) + + UM.RecolorImage + { + id: icon + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + sourceSize.width: width + sourceSize.height: height + color: "black" + + anchors + { + left: parent.left + verticalCenter: parent.verticalCenter + } + + } + + Label + { + id: label + height: contentHeight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + anchors + { + left: icon.right + right: parent.right + top: parent.top + bottom: parent.bottom + rightMargin: 0 + margins: UM.Theme.getSize("narrow_margin").width + } + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 7a415b1e2e..2daf8adb4b 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -18,12 +18,19 @@ Cura.ExpandableComponent property int currentModeIndex: -1 property bool hideSettings: PrintInformation.preSliced - UM.I18nCatalog { id: catalog; name: "cura"} + property string enabledText: catalog.i18nc("@label", "On") + property string disabledText: catalog.i18nc("@label", "Off") // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. signal showTooltip(Item item, point location, string text) signal hideTooltip() + UM.I18nCatalog + { + id: catalog + name: "cura" + } + Timer { id: tooltipDelayTimer @@ -32,18 +39,82 @@ Cura.ExpandableComponent property var item property string text - onTriggered: + onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text) + } + + onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) + + headerItem: Row + { + anchors.fill: parent + + IconWithText { - base.showTooltip(base, {x: 0, y: item.y}, text); + source: UM.Theme.getIcon("category_layer_height") + text: Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" + width: parent.width / 4 + height: parent.height + + UM.SettingPropertyProvider + { + id: layerHeight + containerStackId: Cura.MachineManager.activeStackId + key: "layer_height" + watchedProperties: ["value"] + } + } + + IconWithText + { + source: UM.Theme.getIcon("category_infill") + text: parseInt(infillDensity.properties.value) + "%" + width: parent.width / 4 + height: parent.height + + UM.SettingPropertyProvider + { + id: infillDensity + containerStackId: Cura.MachineManager.activeStackId + key: "infill_sparse_density" + watchedProperties: ["value"] + } + } + + IconWithText + { + source: UM.Theme.getIcon("category_support") + text: supportEnabled.properties.value == "True" ? enabledText : disabledText + width: parent.width / 4 + height: parent.height + + UM.SettingPropertyProvider + { + id: supportEnabled + containerStack: Cura.MachineManager.activeMachine + key: "support_enable" + watchedProperties: ["value"] + } + } + + IconWithText + { + source: UM.Theme.getIcon("category_adhesion") + text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText + width: parent.width / 4 + height: parent.height + + UM.SettingPropertyProvider + { + id: platformAdhesionType + containerStack: Cura.MachineManager.activeMachine + key: "adhesion_type" + watchedProperties: [ "value"] + } } } - onCurrentModeIndexChanged: - { - UM.Preferences.setValue("cura/active_mode", currentModeIndex); - } - headerItem: Label + /*Label { id: settingsModeLabel text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox", "Print Setup disabled\nG-code files cannot be modified") @@ -51,16 +122,13 @@ Cura.ExpandableComponent anchors { - left: parent.left - top: parent.top - margins: UM.Theme.getSize("thick_margin").width + fill: parent } - width: Math.round(parent.width * 0.45) height: contentHeight font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") - } + }*/ popupItem: Item {