diff options
author | j.delarago <joeydelarago@gmail.com> | 2022-06-14 12:41:38 +0300 |
---|---|---|
committer | j.delarago <joeydelarago@gmail.com> | 2022-06-14 12:41:38 +0300 |
commit | a87695cd8dfb5c257ed63ffd05a972846bcb77ec (patch) | |
tree | ca418c069db6f044df4fc308e52134a61fe1a27a /resources/qml | |
parent | 6f88adab8e031176b27f90ed50abe374112afeef (diff) |
Added new intent selection buttons and resolution drop down to replace the matrix.
We are now selecting intents first and then quality, however the container hierarchy quality -> intents. This is the reason for the new functions inside machine manager.
CURA-8849
Diffstat (limited to 'resources/qml')
4 files changed, 168 insertions, 176 deletions
diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index de8cce6e94..9dce3565a0 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -3,8 +3,8 @@ import QtQuick 2.10 -import UM 1.2 as UM -import Cura 1.0 as Cura +import UM 1.6 as UM +import Cura 1.6 as Cura Item { @@ -13,11 +13,11 @@ Item height: childrenRect.height + 2 * padding property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 - property real padding: UM.Theme.getSize("thick_margin").width + property real padding: UM.Theme.getSize("default_margin").width Column { - spacing: UM.Theme.getSize("wide_margin").height + spacing: UM.Theme.getSize("default_margin").height anchors { @@ -30,11 +30,26 @@ Item // TODO property real firstColumnWidth: Math.round(width / 3) + UM.Label + { + text: catalog.i18nc("@label", "Profiles") + font: UM.Theme.getFont("medium") + } + RecommendedQualityProfileSelector { width: parent.width - // TODO Create a reusable component with these properties to not define them separately for each component - labelColumnWidth: parent.firstColumnWidth + } + + RecommendedResolutionSelector + { + width: parent.width + } + + UM.Label + { + text: catalog.i18nc("@label", "Print settings") + font: UM.Theme.getFont("medium") } RecommendedInfillDensitySelector diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index f96062463d..edce3c59a0 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -3,9 +3,10 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 +import QtQuick.Layouts 2.10 import UM 1.5 as UM -import Cura 1.6 as Cura +import Cura 1.7 as Cura import ".." Item @@ -13,187 +14,35 @@ Item id: qualityRow height: childrenRect.height - property real labelColumnWidth: Math.round(width / 3) - property real settingsColumnWidth: width - labelColumnWidth - - // Here are the elements that are shown in the left column - - Column + RowLayout { - anchors - { - left: parent.left - right: parent.right - } - - spacing: UM.Theme.getSize("default_margin").height - - ButtonGroup - { - id: activeProfileButtonGroup - exclusive: true - onClicked: Cura.IntentManager.selectIntent(button.modelData.intent_category, button.modelData.quality_type) - } - - Item - { - height: childrenRect.height - anchors - { - left: parent.left - right: parent.right - } - Cura.IconWithText - { - id: profileLabel - source: UM.Theme.getIcon("PrintQuality") - text: catalog.i18nc("@label", "Profiles") - font: UM.Theme.getFont("medium") - width: labelColumnWidth - iconSize: UM.Theme.getSize("medium_button_icon").width - } - UM.SimpleButton - { - id: resetToDefaultQualityButton - - visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality - height: visible ? UM.Theme.getSize("print_setup_icon").height : 0 - width: height - anchors - { - right: profileLabel.right - rightMargin: UM.Theme.getSize("default_margin").width - leftMargin: UM.Theme.getSize("default_margin").width - verticalCenter: parent.verticalCenter - } - - color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") - iconSource: UM.Theme.getIcon("ArrowReset") - - onClicked: - { - // if the current profile is user-created, switch to a built-in quality - Cura.MachineManager.resetToUseDefaultQuality() - } - onEntered: - { - var tooltipContent = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), tooltipContent) - } - onExited: base.hideTooltip() - } - - Cura.LabelBar - { - id: labelbar - anchors - { - left: profileLabel.right - right: parent.right - verticalCenter: profileLabel.verticalCenter - } - - model: Cura.QualityProfilesDropDownMenuModel - modelKey: "layer_height" - } - } - + id: intentRow + width: parent.width Repeater { - model: Cura.IntentCategoryModel {} - Item - { - anchors - { - left: parent.left - right: parent.right - } - height: intentCategoryLabel.height - - UM.Label - { - id: intentCategoryLabel - text: model.name - width: labelColumnWidth - UM.Theme.getSize("section_icon").width - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("section_icon").width + UM.Theme.getSize("narrow_margin").width - font: UM.Theme.getFont("medium") - elide: Text.ElideRight - } - - Cura.RadioCheckbar - { - anchors - { - left: intentCategoryLabel.right - right: parent.right - } - dataModel: model["qualities"] - buttonGroup: activeProfileButtonGroup - - function checkedFunction(modelItem) - { - if(Cura.MachineManager.hasCustomQuality) - { - // When user created profile is active, no quality tickbox should be active. - return false - } - - if(modelItem === null) - { - return false - } - return Cura.MachineManager.activeQualityType == modelItem.quality_type && Cura.MachineManager.activeIntentCategory == modelItem.intent_category - } + model: Cura.IntentSelectionModel {} - isCheckedFunction: checkedFunction - } + RecommendedQualityProfileSelectorButton + { + text: model.name + iconSource: UM.Theme.getIcon(model.icon) - MouseArea // Intent description tooltip hover area - { - id: intentDescriptionHoverArea - anchors.fill: parent - hoverEnabled: true - enabled: model.description !== undefined - acceptedButtons: Qt.NoButton // react to hover only, don't steal clicks - Timer - { - id: intentTooltipTimer - interval: 500 - running: false - repeat: false - onTriggered: base.showTooltip( - intentCategoryLabel, - Qt.point(-(intentCategoryLabel.x - qualityRow.x) - UM.Theme.getSize("thick_margin").width, 0), - model.description - ) - } + selected: Cura.MachineManager.activeIntentCategory == model.intent_category - onEntered: intentTooltipTimer.start() - onExited: + onClicked: { + var qualityType + if (Cura.MachineManager.intentCategoryHasQuality(model.intent_category, Cura.MachineManager.activeQualityType)) { - base.hideTooltip() - intentTooltipTimer.stop() + qualityType = Cura.MachineManager.activeQualityType + } else { + qualityType = Cura.MachineManager.getDefaultQualityTypeForIntent(model.intent_category) + print(Cura.MachineManager.getDefaultQualityTypeForIntent(model.intent_category)) } + Cura.IntentManager.selectIntent(model.intent_category, qualityType) } - - NoIntentIcon // This icon has hover priority over intentDescriptionHoverArea, so draw it above it. - { - affected_extruders: Cura.MachineManager.extruderPositionsWithNonActiveIntent - intent_type: model.name - anchors.right: intentCategoryLabel.right - anchors.rightMargin: UM.Theme.getSize("narrow_margin").width - width: intentCategoryLabel.height * 0.75 - anchors.verticalCenter: parent.verticalCenter - height: width - visible: Cura.MachineManager.activeIntentCategory == model.intent_category && affected_extruders.length - } - - } - } } } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml new file mode 100644 index 0000000000..53b77812e2 --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml @@ -0,0 +1,63 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 2.10 + +import UM 1.5 as UM +import Cura 1.7 as Cura + + +Rectangle +{ + id: base + height: 60 + Layout.fillWidth: true + color: mouseArea.containsMouse || selected ? UM.Theme.getColor("um_blue_1") : UM.Theme.getColor("background_1") + + property alias iconSource: intentIcon.source + property alias text: qualityLabel.text + property bool selected: false + + signal clicked() + + MouseArea + { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: base.clicked() + } + + Item + { + width: intentIcon.width + anchors + { + top: parent.top + bottom: qualityLabel.top + horizontalCenter: parent.horizontalCenter + } + + UM.ColorImage + { + id: intentIcon + width: UM.Theme.getSize("recommended_button_icon").width + height: width + anchors.centerIn: parent + color: UM.Theme.getColor("icon") + } + } + + UM.Label + { + id: qualityLabel + anchors + { + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + bottomMargin: UM.Theme.getSize("narrow_margin").height + } + } +}
\ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml new file mode 100644 index 0000000000..0cc29a2d5c --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml @@ -0,0 +1,65 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 + +import UM 1.6 as UM +import Cura 1.7 as Cura + +Item +{ + height: childrenRect.height + + property real labelColumnWidth: Math.round(width / 3) + + Cura.IconWithText + { + id: resolutionTitle + anchors.top: parent.top + anchors.left: parent.left + source: UM.Theme.getIcon("PrintQuality") + text: catalog.i18nc("@label", "Resolution") + width: labelColumnWidth + height: parent.height + spacing: UM.Theme.getSize("thick_margin").width + iconSize: UM.Theme.getSize("medium_button_icon").width + } + + Cura.ComboBox + { + id: visibilityPreset + implicitHeight: UM.Theme.getSize("combobox").height + implicitWidth: UM.Theme.getSize("combobox").width + anchors + { + top: parent.top + right: parent.right + } + + textRole: "display_text" + + model: Cura.ActiveIntentQualitiesModel{} + + currentIndex: + { + var current_quality_type = Cura.MachineManager.activeQualityType + + var index = 0 + for (var i = 0; i < model.count; i++) + { + if (model.getItem(i).quality_type == current_quality_type) + { + index = i + break + } + } + return index + } + + onActivated: + { + var selected_item = model.getItem(currentIndex) + Cura.IntentManager.selectIntent(selected_item.intent_category, selected_item.quality_type) + } + } +}
\ No newline at end of file |