mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 06:23:59 -06:00
Merge branch 'master' into CURA-8640_PyQt6
# Conflicts: # cura/CuraApplication.py # resources/qml/Preferences/Materials/MaterialsSyncDialog.qml # resources/qml/Preferences/Materials/MaterialsView.qml
This commit is contained in:
commit
3f8907d02a
582 changed files with 8061 additions and 9724 deletions
|
@ -1,42 +1,21 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Copyright (c) 2022 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.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
import UM 1.5 as UM
|
||||
import Cura 1.5 as Cura
|
||||
|
||||
Button
|
||||
Cura.CategoryButton
|
||||
{
|
||||
id: base
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
// To avoid overlapping with the scrollBars
|
||||
anchors.rightMargin: 2 * UM.Theme.getSize("thin_margin").width
|
||||
hoverEnabled: true
|
||||
|
||||
height: UM.Theme.getSize("section_icon_column").height
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
id: backgroundRectangle
|
||||
height: UM.Theme.getSize("section").height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color:
|
||||
{
|
||||
if (!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled")
|
||||
}
|
||||
else if (base.hovered)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover")
|
||||
}
|
||||
return UM.Theme.getColor("setting_category")
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
}
|
||||
categoryIcon: UM.Theme.getIcon(definition.icon)
|
||||
expanded: definition.expanded
|
||||
labelText: definition.label
|
||||
|
||||
signal showTooltip(string text)
|
||||
signal hideTooltip()
|
||||
|
@ -46,73 +25,6 @@ Button
|
|||
signal setActiveFocusToNextSetting(bool forward)
|
||||
|
||||
property var focusItem: base
|
||||
property bool expanded: definition.expanded
|
||||
|
||||
|
||||
property color text_color:
|
||||
{
|
||||
if (!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled_text")
|
||||
} else if (base.hovered || base.pressed || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_text")
|
||||
}
|
||||
|
||||
return UM.Theme.getColor("setting_category_text")
|
||||
|
||||
}
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
anchors.fill: parent
|
||||
|
||||
Label
|
||||
{
|
||||
id: settingNameLabel
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
leftMargin: 2 * UM.Theme.getSize("default_margin").width + UM.Theme.getSize("section_icon").width
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: definition.label
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("medium_bold")
|
||||
color: base.text_color
|
||||
fontSizeMode: Text.HorizontalFit
|
||||
minimumPointSize: 8
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: category_arrow
|
||||
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.height: width
|
||||
color: UM.Theme.getColor("setting_control_button")
|
||||
source: definition.expanded ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleLeft")
|
||||
}
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: icon
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("thin_margin").width
|
||||
color: base.text_color
|
||||
source: UM.Theme.getIcon(definition.icon)
|
||||
width: UM.Theme.getSize("section_icon").width
|
||||
height: UM.Theme.getSize("section_icon").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: width
|
||||
}
|
||||
|
||||
onClicked:
|
||||
{
|
||||
|
@ -151,7 +63,7 @@ Button
|
|||
{
|
||||
right: inheritButton.visible ? inheritButton.left : parent.right
|
||||
// Use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons
|
||||
rightMargin: inheritButton.visible ? Math.round(UM.Theme.getSize("default_margin").width / 2) : category_arrow.width + Math.round(UM.Theme.getSize("default_margin").width * 1.9)
|
||||
rightMargin: inheritButton.visible ? Math.round(UM.Theme.getSize("default_margin").width / 2) : arrow.width + Math.round(UM.Theme.getSize("default_margin").width * 1.9)
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
|
@ -168,7 +80,7 @@ Button
|
|||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: category_arrow.width + UM.Theme.getSize("default_margin").width * 2
|
||||
anchors.rightMargin: arrow.width + UM.Theme.getSize("default_margin").width * 2
|
||||
|
||||
visible:
|
||||
{
|
||||
|
|
|
@ -98,7 +98,7 @@ SettingItem
|
|||
{
|
||||
if(!enabled)
|
||||
{
|
||||
return UM.Theme.getColor("checkbox_border")
|
||||
return UM.Theme.getColor("checkbox_border_disabled")
|
||||
}
|
||||
switch (propertyProvider.properties.validationState)
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ SettingItem
|
|||
{
|
||||
return UM.Theme.getColor("checkbox_border_hover")
|
||||
}
|
||||
return UM.Theme.getColor("setting_control_border")
|
||||
return UM.Theme.getColor("checkbox_border")
|
||||
}
|
||||
|
||||
color: {
|
||||
|
@ -138,7 +138,7 @@ SettingItem
|
|||
// Validation is OK.
|
||||
if (control.containsMouse || control.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_highlight")
|
||||
return UM.Theme.getColor("checkbox_hover")
|
||||
}
|
||||
return UM.Theme.getColor("checkbox")
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ SettingItem
|
|||
height: UM.Theme.getSize("checkbox_mark").height
|
||||
width: UM.Theme.getSize("checkbox_mark").width
|
||||
sourceSize.height: width
|
||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
|
||||
color: !enabled ? UM.Theme.getColor("checkbox_mark_disabled") : UM.Theme.getColor("checkbox_mark");
|
||||
source: UM.Theme.getIcon("Check", "low")
|
||||
opacity: control.checked ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 100; } }
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
import UM 1.5 as UM
|
||||
import Cura 1.5 as Cura
|
||||
|
||||
SettingItem
|
||||
{
|
||||
id: base
|
||||
property var focusItem: control
|
||||
|
||||
contents: ComboBox
|
||||
contents: Cura.ComboBox
|
||||
{
|
||||
id: control
|
||||
anchors.fill: parent
|
||||
|
@ -113,7 +113,7 @@ SettingItem
|
|||
color: UM.Theme.getColor("setting_control_button");
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
background: UM.UnderlineBackground
|
||||
{
|
||||
color:
|
||||
{
|
||||
|
@ -127,9 +127,7 @@ SettingItem
|
|||
}
|
||||
return UM.Theme.getColor("setting_control")
|
||||
}
|
||||
radius: UM.Theme.getSize("setting_control_radius").width
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
liningColor:
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
|
@ -137,13 +135,13 @@ SettingItem
|
|||
}
|
||||
if (control.hovered || control.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_border_highlight")
|
||||
return UM.Theme.getColor("border_main")
|
||||
}
|
||||
return UM.Theme.getColor("setting_control_border")
|
||||
return UM.Theme.getColor("border_field_light")
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Label
|
||||
contentItem: UM.Label
|
||||
{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
|
@ -153,13 +151,8 @@ SettingItem
|
|||
|
||||
text: control.currentText
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("default")
|
||||
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||
|
||||
elide: Text.ElideLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
id: swatch
|
||||
|
@ -183,12 +176,12 @@ SettingItem
|
|||
|
||||
contentItem: ListView
|
||||
{
|
||||
clip: true
|
||||
implicitHeight: contentHeight
|
||||
|
||||
ScrollBar.vertical: UM.ScrollBar {}
|
||||
clip: true
|
||||
model: control.popup.visible ? control.delegateModel : null
|
||||
currentIndex: control.highlightedIndex
|
||||
|
||||
ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
|
@ -204,27 +197,15 @@ SettingItem
|
|||
height: control.height
|
||||
highlighted: control.highlightedIndex == index
|
||||
|
||||
contentItem: Label
|
||||
contentItem: UM.Label
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||
|
||||
text: model.name
|
||||
renderType: Text.NativeRendering
|
||||
color:
|
||||
{
|
||||
if (model.enabled)
|
||||
{
|
||||
UM.Theme.getColor("setting_control_text")
|
||||
} else
|
||||
{
|
||||
UM.Theme.getColor("action_button_disabled_text");
|
||||
}
|
||||
}
|
||||
font: UM.Theme.getFont("default")
|
||||
color: model.enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("action_button_disabled_text")
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width
|
||||
|
||||
background: Rectangle
|
||||
|
@ -244,7 +225,6 @@ SettingItem
|
|||
background: Rectangle
|
||||
{
|
||||
color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent"
|
||||
border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,12 +13,9 @@ import "."
|
|||
Item
|
||||
{
|
||||
id: base
|
||||
|
||||
height: UM.Theme.getSize("section").height
|
||||
height: enabled ? UM.Theme.getSize("section").height + UM.Theme.getSize("narrow_margin").height : 0
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
// To avoid overlapping with the scrollBars
|
||||
anchors.rightMargin: 2 * UM.Theme.getSize("thin_margin").width
|
||||
|
||||
property alias contents: controlContainer.children
|
||||
property alias hovered: mouse.containsMouse
|
||||
|
@ -137,7 +134,7 @@ Item
|
|||
id: label
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: doDepthIndentation ? Math.round(UM.Theme.getSize("thin_margin").width + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0
|
||||
anchors.leftMargin: doDepthIndentation ? Math.round(UM.Theme.getSize("thin_margin").width + ((definition.depth - 1) * UM.Theme.getSize("default_margin").width)) : 0
|
||||
anchors.right: settingControls.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Copyright (c) 2022 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.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
import UM 1.5 as UM
|
||||
import Cura 1.5 as Cura
|
||||
|
||||
SettingItem
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ SettingItem
|
|||
// this extra property to keep the ExtrudersModel and use this in the rest of the code.
|
||||
property var extrudersWithOptionalModel: CuraApplication.getExtrudersModelWithOptional()
|
||||
|
||||
contents: ComboBox
|
||||
contents: Cura.ComboBox
|
||||
{
|
||||
id: control
|
||||
anchors.fill: parent
|
||||
|
@ -111,26 +111,24 @@ SettingItem
|
|||
sourceSize.width: width + 5 * screenScaleFactor
|
||||
sourceSize.height: width + 5 * screenScaleFactor
|
||||
|
||||
color: UM.Theme.getColor("setting_control_button");
|
||||
color: UM.Theme.getColor("setting_control_button")
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
background: UM.UnderlineBackground
|
||||
{
|
||||
color:
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_disabled");
|
||||
return UM.Theme.getColor("setting_control_disabled")
|
||||
}
|
||||
if (control.hovered || control.activeFocus)
|
||||
if (control.hovered || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_highlight");
|
||||
return UM.Theme.getColor("setting_control_highlight")
|
||||
}
|
||||
return UM.Theme.getColor("setting_control");
|
||||
return UM.Theme.getColor("setting_control")
|
||||
}
|
||||
radius: UM.Theme.getSize("setting_control_radius").width
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
liningColor:
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
|
@ -138,13 +136,13 @@ SettingItem
|
|||
}
|
||||
if (control.hovered || control.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_border_highlight")
|
||||
return UM.Theme.getColor("border_main")
|
||||
}
|
||||
return UM.Theme.getColor("setting_control_border")
|
||||
return UM.Theme.getColor("border_field_light")
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Label
|
||||
contentItem: UM.Label
|
||||
{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
|
@ -154,12 +152,9 @@ SettingItem
|
|||
|
||||
text: control.currentText
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("default")
|
||||
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
|
@ -175,19 +170,21 @@ SettingItem
|
|||
}
|
||||
}
|
||||
|
||||
popup: Popup {
|
||||
popup: Popup
|
||||
{
|
||||
y: control.height - UM.Theme.getSize("default_lining").height
|
||||
width: control.width
|
||||
implicitHeight: contentItem.implicitHeight + 2 * UM.Theme.getSize("default_lining").width
|
||||
padding: UM.Theme.getSize("default_lining").width
|
||||
|
||||
contentItem: ListView {
|
||||
clip: true
|
||||
contentItem: ListView
|
||||
{
|
||||
implicitHeight: contentHeight
|
||||
|
||||
ScrollBar.vertical: UM.ScrollBar {}
|
||||
clip: true
|
||||
model: control.popup.visible ? control.delegateModel : null
|
||||
currentIndex: control.highlightedIndex
|
||||
|
||||
ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
|
@ -202,7 +199,7 @@ SettingItem
|
|||
height: control.height
|
||||
highlighted: control.highlightedIndex == index
|
||||
|
||||
contentItem: Label
|
||||
contentItem: UM.Label
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||
|
@ -210,18 +207,15 @@ SettingItem
|
|||
|
||||
text: model.name
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
color:
|
||||
{
|
||||
if (model.enabled) {
|
||||
UM.Theme.getColor("setting_control_text")
|
||||
} else {
|
||||
UM.Theme.getColor("action_button_disabled_text");
|
||||
UM.Theme.getColor("action_button_disabled_text")
|
||||
}
|
||||
}
|
||||
font: UM.Theme.getFont("default")
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width
|
||||
|
||||
background: Rectangle
|
||||
|
@ -241,7 +235,6 @@ SettingItem
|
|||
background: Rectangle
|
||||
{
|
||||
color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent"
|
||||
border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
import UM 1.1 as UM
|
||||
import UM 1.5 as UM
|
||||
|
||||
SettingItem
|
||||
{
|
||||
|
@ -26,19 +26,17 @@ SettingItem
|
|||
}
|
||||
}
|
||||
|
||||
contents: Rectangle
|
||||
contents: UM.UnderlineBackground
|
||||
{
|
||||
id: control
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
radius: UM.Theme.getSize("setting_control_radius").width
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
liningColor:
|
||||
{
|
||||
if(!enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_disabled_border")
|
||||
return UM.Theme.getColor("text_field_border_disabled")
|
||||
}
|
||||
switch(propertyProvider.properties.validationState)
|
||||
{
|
||||
|
@ -54,15 +52,15 @@ SettingItem
|
|||
//Validation is OK.
|
||||
if(hovered || input.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_border_highlight")
|
||||
return UM.Theme.getColor("text_field_border_hovered")
|
||||
}
|
||||
return UM.Theme.getColor("setting_control_border")
|
||||
return UM.Theme.getColor("text_field_border")
|
||||
}
|
||||
|
||||
color: {
|
||||
if(!enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_disabled")
|
||||
return UM.Theme.getColor("text_field")
|
||||
}
|
||||
switch(propertyProvider.properties.validationState)
|
||||
{
|
||||
|
@ -78,19 +76,11 @@ SettingItem
|
|||
return UM.Theme.getColor("setting_validation_ok")
|
||||
|
||||
default:
|
||||
return UM.Theme.getColor("setting_control")
|
||||
return UM.Theme.getColor("text_field")
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.margins: Math.round(UM.Theme.getSize("default_lining").width)
|
||||
color: UM.Theme.getColor("setting_control_highlight")
|
||||
opacity: !control.hovered ? 0 : propertyProvider.properties.validationState == "ValidatorState.Valid" ? 1.0 : 0.35
|
||||
}
|
||||
|
||||
Label
|
||||
UM.Label
|
||||
{
|
||||
anchors
|
||||
{
|
||||
|
@ -105,9 +95,7 @@ SettingItem
|
|||
//However the setting value is aligned, align the unit opposite. That way it stays readable with right-to-left languages.
|
||||
horizontalAlignment: (input.effectiveHorizontalAlignment == Text.AlignLeft) ? Text.AlignRight : Text.AlignLeft
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
color: UM.Theme.getColor("setting_unit")
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
|
||||
TextInput
|
||||
|
@ -155,8 +143,9 @@ SettingItem
|
|||
}
|
||||
|
||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
||||
selectedTextColor: UM.Theme.getColor("setting_control_text")
|
||||
font: UM.Theme.getFont("default")
|
||||
|
||||
selectionColor: UM.Theme.getColor("text_selection")
|
||||
selectByMouse: true
|
||||
|
||||
maximumLength: (definition.type == "str" || definition.type == "[int]") ? -1 : 10
|
||||
|
|
|
@ -4,17 +4,13 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
import UM 1.2 as UM
|
||||
import UM 1.5 as UM
|
||||
|
||||
SettingItem
|
||||
{
|
||||
contents: Label
|
||||
contents: UM.Label
|
||||
{
|
||||
anchors.fill: parent
|
||||
text: propertyProvider.properties.value + " " + unit
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
// Copyright (c) 2021 Ultimaker B.V.
|
||||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Controls 2.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import UM 1.5 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
import "../Menus"
|
||||
|
@ -16,7 +14,6 @@ Item
|
|||
id: settingsView
|
||||
|
||||
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
|
||||
property Action configureSettings
|
||||
property bool findingSettings
|
||||
|
||||
Item
|
||||
|
@ -28,7 +25,6 @@ Item
|
|||
top: parent.top
|
||||
left: parent.left
|
||||
right: settingVisibilityMenu.left
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
height: UM.Theme.getSize("print_setup_big_item").height
|
||||
|
||||
|
@ -41,18 +37,35 @@ Item
|
|||
repeat: false
|
||||
}
|
||||
|
||||
Cura.SearchBar
|
||||
Cura.TextField
|
||||
{
|
||||
id: filter
|
||||
height: parent.height
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
placeholderText: catalog.i18nc("@label:textbox", "Search settings") // Overwrite
|
||||
leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2
|
||||
placeholderText: catalog.i18nc("@label:textbox", "Search settings")
|
||||
font.italic: true
|
||||
|
||||
property var expandedCategories
|
||||
property bool lastFindingSettings: false
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: searchIcon
|
||||
|
||||
anchors
|
||||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
source: UM.Theme.getIcon("search")
|
||||
height: UM.Theme.getSize("small_button_icon").height
|
||||
width: height
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
|
||||
onTextChanged: settingsSearchTimer.restart()
|
||||
|
||||
onEditingFinished:
|
||||
|
@ -117,8 +130,6 @@ Item
|
|||
SettingVisibilityPresetsMenu
|
||||
{
|
||||
id: settingVisibilityPresetsMenu
|
||||
x: settingVisibilityMenu.x
|
||||
y: settingVisibilityMenu.y
|
||||
onCollapseAllCategories:
|
||||
{
|
||||
settingsSearchTimer.stop()
|
||||
|
@ -128,60 +139,45 @@ Item
|
|||
}
|
||||
}
|
||||
|
||||
ToolButton
|
||||
UM.BurgerButton
|
||||
{
|
||||
id: settingVisibilityMenu
|
||||
|
||||
anchors
|
||||
{
|
||||
top: filterContainer.top
|
||||
bottom: filterContainer.bottom
|
||||
verticalCenter: filterContainer.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("wide_margin").width
|
||||
}
|
||||
width: UM.Theme.getSize("medium_button_icon").width
|
||||
height: UM.Theme.getSize("medium_button_icon").height
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Item
|
||||
{
|
||||
UM.RecolorImage
|
||||
{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: UM.Theme.getSize("medium_button_icon").width
|
||||
height: UM.Theme.getSize("medium_button_icon").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: control.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
|
||||
source: UM.Theme.getIcon("Hamburger")
|
||||
}
|
||||
}
|
||||
label: Label {}
|
||||
}
|
||||
|
||||
onClicked:
|
||||
{
|
||||
settingVisibilityPresetsMenu.popup(
|
||||
settingVisibilityMenu,
|
||||
popupContainer,
|
||||
-settingVisibilityPresetsMenu.width + UM.Theme.getSize("default_margin").width,
|
||||
settingVisibilityMenu.height
|
||||
)
|
||||
}
|
||||
}
|
||||
Item
|
||||
{
|
||||
// Work around to prevent the buttom from being rescaled if a popup is attached
|
||||
id: popupContainer
|
||||
anchors.bottom: settingVisibilityMenu.bottom
|
||||
anchors.right: settingVisibilityMenu.right
|
||||
}
|
||||
|
||||
// Mouse area that gathers the scroll events to not propagate it to the main view.
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: scrollView
|
||||
anchors.fill: contents
|
||||
acceptedButtons: Qt.AllButtons
|
||||
onWheel: wheel.accepted = true
|
||||
}
|
||||
|
||||
ScrollView
|
||||
ListView
|
||||
{
|
||||
id: scrollView
|
||||
id: contents
|
||||
maximumFlickVelocity: 1000
|
||||
anchors
|
||||
{
|
||||
top: filterContainer.bottom
|
||||
|
@ -190,340 +186,340 @@ Item
|
|||
right: parent.right
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
style: UM.Theme.styles.scrollview
|
||||
flickableItem.flickableDirection: Flickable.VerticalFlick
|
||||
__wheelAreaScrollSpeed: 75 // Scroll three lines in one scroll event
|
||||
|
||||
ListView
|
||||
clip: true
|
||||
cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item.
|
||||
ScrollBar.vertical: UM.ScrollBar
|
||||
{
|
||||
id: contents
|
||||
cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item.
|
||||
|
||||
model: UM.SettingDefinitionsModel
|
||||
{
|
||||
id: definitionsModel
|
||||
containerId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.id: ""
|
||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
|
||||
exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "cutting_mesh", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settings are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false.
|
||||
expanded: CuraApplication.expandedCategories
|
||||
onExpandedChanged:
|
||||
{
|
||||
if (!findingSettings)
|
||||
{
|
||||
// Do not change expandedCategories preference while filtering settings
|
||||
// because all categories are expanded while filtering
|
||||
CuraApplication.setExpandedCategories(expanded)
|
||||
}
|
||||
id: scrollBar
|
||||
onPositionChanged: {
|
||||
// This removes focus from items when scrolling.
|
||||
// This fixes comboboxes staying open and scrolling container
|
||||
if (!activeFocus) {
|
||||
forceActiveFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model: UM.SettingDefinitionsModel
|
||||
{
|
||||
id: definitionsModel
|
||||
containerId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.id: ""
|
||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
|
||||
exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "cutting_mesh", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settings are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false.
|
||||
expanded: CuraApplication.expandedCategories
|
||||
onExpandedChanged:
|
||||
{
|
||||
if (!findingSettings)
|
||||
{
|
||||
// Do not change expandedCategories preference while filtering settings
|
||||
// because all categories are expanded while filtering
|
||||
CuraApplication.setExpandedCategories(expanded)
|
||||
}
|
||||
}
|
||||
onVisibilityChanged: Cura.SettingInheritanceManager.scheduleUpdate()
|
||||
}
|
||||
|
||||
property int indexWithFocus: -1
|
||||
property string activeMachineId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : ""
|
||||
delegate: Loader
|
||||
{
|
||||
id: delegate
|
||||
|
||||
width: contents.width - (scrollBar.width + UM.Theme.getSize("narrow_margin").width)
|
||||
Behavior on height { NumberAnimation { duration: 100 } }
|
||||
opacity: enabled ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||
enabled: provider.properties.enabled === "True"
|
||||
|
||||
property var definition: model
|
||||
property var settingDefinitionsModel: definitionsModel
|
||||
property var propertyProvider: provider
|
||||
property var globalPropertyProvider: inheritStackProvider
|
||||
property bool externalResetHandler: false
|
||||
|
||||
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
|
||||
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
|
||||
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
||||
asynchronous: model.type !== "enum" && model.type !== "extruder" && model.type !== "optional_extruder"
|
||||
active: model.type !== undefined
|
||||
|
||||
source:
|
||||
{
|
||||
switch(model.type)
|
||||
{
|
||||
case "int":
|
||||
return "SettingTextField.qml"
|
||||
case "[int]":
|
||||
return "SettingTextField.qml"
|
||||
case "float":
|
||||
return "SettingTextField.qml"
|
||||
case "enum":
|
||||
return "SettingComboBox.qml"
|
||||
case "extruder":
|
||||
return "SettingExtruder.qml"
|
||||
case "bool":
|
||||
return "SettingCheckBox.qml"
|
||||
case "str":
|
||||
return "SettingTextField.qml"
|
||||
case "category":
|
||||
return "SettingCategory.qml"
|
||||
case "optional_extruder":
|
||||
return "SettingOptionalExtruder.qml"
|
||||
default:
|
||||
return "SettingUnknown.qml"
|
||||
}
|
||||
onVisibilityChanged: Cura.SettingInheritanceManager.scheduleUpdate()
|
||||
}
|
||||
|
||||
property int indexWithFocus: -1
|
||||
property double delegateHeight: UM.Theme.getSize("section").height + 2 * UM.Theme.getSize("default_lining").height
|
||||
property string activeMachineId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : ""
|
||||
delegate: Loader
|
||||
// Binding to ensure that the right containerstack ID is set for the provider.
|
||||
// This ensures that if a setting has a limit_to_extruder id (for instance; Support speed points to the
|
||||
// extruder that actually prints the support, as that is the setting we need to use to calculate the value)
|
||||
Binding
|
||||
{
|
||||
id: delegate
|
||||
|
||||
width: scrollView.width
|
||||
height: enabled ? contents.delegateHeight: 0
|
||||
Behavior on height { NumberAnimation { duration: 100 } }
|
||||
opacity: enabled ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||
enabled: provider.properties.enabled === "True"
|
||||
|
||||
property var definition: model
|
||||
property var settingDefinitionsModel: definitionsModel
|
||||
property var propertyProvider: provider
|
||||
property var globalPropertyProvider: inheritStackProvider
|
||||
property bool externalResetHandler: false
|
||||
|
||||
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
|
||||
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
|
||||
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
||||
asynchronous: model.type !== "enum" && model.type !== "extruder" && model.type !== "optional_extruder"
|
||||
active: model.type !== undefined
|
||||
|
||||
source:
|
||||
target: provider
|
||||
property: "containerStackId"
|
||||
when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0);
|
||||
value:
|
||||
{
|
||||
switch(model.type)
|
||||
{
|
||||
case "int":
|
||||
return "SettingTextField.qml"
|
||||
case "[int]":
|
||||
return "SettingTextField.qml"
|
||||
case "float":
|
||||
return "SettingTextField.qml"
|
||||
case "enum":
|
||||
return "SettingComboBox.qml"
|
||||
case "extruder":
|
||||
return "SettingExtruder.qml"
|
||||
case "bool":
|
||||
return "SettingCheckBox.qml"
|
||||
case "str":
|
||||
return "SettingTextField.qml"
|
||||
case "category":
|
||||
return "SettingCategory.qml"
|
||||
case "optional_extruder":
|
||||
return "SettingOptionalExtruder.qml"
|
||||
default:
|
||||
return "SettingUnknown.qml"
|
||||
}
|
||||
}
|
||||
// Associate this binding with Cura.MachineManager.activeMachine.id in the beginning so this
|
||||
// binding will be triggered when activeMachineId is changed too.
|
||||
// Otherwise, if this value only depends on the extruderIds, it won't get updated when the
|
||||
// machine gets changed.
|
||||
|
||||
// Binding to ensure that the right containerstack ID is set for the provider.
|
||||
// This ensures that if a setting has a limit_to_extruder id (for instance; Support speed points to the
|
||||
// extruder that actually prints the support, as that is the setting we need to use to calculate the value)
|
||||
Binding
|
||||
{
|
||||
target: provider
|
||||
property: "containerStackId"
|
||||
when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0);
|
||||
value:
|
||||
if (!model.settable_per_extruder)
|
||||
{
|
||||
// Associate this binding with Cura.MachineManager.activeMachine.id in the beginning so this
|
||||
// binding will be triggered when activeMachineId is changed too.
|
||||
// Otherwise, if this value only depends on the extruderIds, it won't get updated when the
|
||||
// machine gets changed.
|
||||
|
||||
if (!model.settable_per_extruder)
|
||||
{
|
||||
//Not settable per extruder or there only is global, so we must pick global.
|
||||
return contents.activeMachineId
|
||||
}
|
||||
if (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0)
|
||||
{
|
||||
//We have limit_to_extruder, so pick that stack.
|
||||
return Cura.ExtruderManager.extruderIds[inheritStackProvider.properties.limit_to_extruder];
|
||||
}
|
||||
if (Cura.ExtruderManager.activeExtruderStackId)
|
||||
{
|
||||
//We're on an extruder tab. Pick the current extruder.
|
||||
return Cura.ExtruderManager.activeExtruderStackId;
|
||||
}
|
||||
//No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab.
|
||||
//Not settable per extruder or there only is global, so we must pick global.
|
||||
return contents.activeMachineId
|
||||
}
|
||||
}
|
||||
|
||||
// Specialty provider that only watches global_inherits (we can't filter on what property changed we get events
|
||||
// so we bypass that to make a dedicated provider).
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: inheritStackProvider
|
||||
containerStackId: contents.activeMachineId
|
||||
key: model.key
|
||||
watchedProperties: [ "limit_to_extruder" ]
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: provider
|
||||
|
||||
containerStackId: contents.activeMachineId
|
||||
key: model.key
|
||||
watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder", "resolve" ]
|
||||
storeIndex: 0
|
||||
removeUnusedValue: model.resolve === undefined
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: item
|
||||
function onContextMenuRequested()
|
||||
if (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0)
|
||||
{
|
||||
contextMenu.key = model.key;
|
||||
contextMenu.settingVisible = model.visible;
|
||||
contextMenu.provider = provider
|
||||
contextMenu.popup();
|
||||
//We have limit_to_extruder, so pick that stack.
|
||||
return Cura.ExtruderManager.extruderIds[inheritStackProvider.properties.limit_to_extruder]
|
||||
}
|
||||
function onShowTooltip(text) { base.showTooltip(delegate, Qt.point(-settingsView.x - UM.Theme.getSize("default_margin").width, 0), text) }
|
||||
function onHideTooltip() { base.hideTooltip() }
|
||||
function onShowAllHiddenInheritedSettings(category_id)
|
||||
if (Cura.ExtruderManager.activeExtruderStackId)
|
||||
{
|
||||
var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(category_id)
|
||||
for(var i = 0; i < children_with_override.length; i++)
|
||||
{
|
||||
definitionsModel.setVisible(children_with_override[i], true)
|
||||
}
|
||||
Cura.SettingInheritanceManager.manualRemoveOverride(category_id)
|
||||
}
|
||||
function onFocusReceived()
|
||||
{
|
||||
contents.indexWithFocus = index;
|
||||
animateContentY.from = contents.contentY;
|
||||
contents.positionViewAtIndex(index, ListView.Contain);
|
||||
animateContentY.to = contents.contentY;
|
||||
animateContentY.running = true;
|
||||
}
|
||||
function onSetActiveFocusToNextSetting(forward)
|
||||
{
|
||||
if (forward == undefined || forward)
|
||||
{
|
||||
contents.currentIndex = contents.indexWithFocus + 1;
|
||||
while(contents.currentItem && contents.currentItem.height <= 0)
|
||||
{
|
||||
contents.currentIndex++;
|
||||
}
|
||||
if (contents.currentItem)
|
||||
{
|
||||
contents.currentItem.item.focusItem.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contents.currentIndex = contents.indexWithFocus - 1;
|
||||
while(contents.currentItem && contents.currentItem.height <= 0)
|
||||
{
|
||||
contents.currentIndex--;
|
||||
}
|
||||
if (contents.currentItem)
|
||||
{
|
||||
contents.currentItem.item.focusItem.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
//We're on an extruder tab. Pick the current extruder.
|
||||
return Cura.ExtruderManager.activeExtruderStackId
|
||||
}
|
||||
//No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab.
|
||||
return contents.activeMachineId
|
||||
}
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: animateContentY
|
||||
target: contents
|
||||
property: "contentY"
|
||||
duration: 50
|
||||
}
|
||||
|
||||
add: Transition {
|
||||
SequentialAnimation {
|
||||
NumberAnimation { properties: "height"; from: 0; duration: 100 }
|
||||
NumberAnimation { properties: "opacity"; from: 0; duration: 100 }
|
||||
}
|
||||
}
|
||||
remove: Transition {
|
||||
SequentialAnimation {
|
||||
NumberAnimation { properties: "opacity"; to: 0; duration: 100 }
|
||||
NumberAnimation { properties: "height"; to: 0; duration: 100 }
|
||||
}
|
||||
}
|
||||
addDisplaced: Transition {
|
||||
NumberAnimation { properties: "x,y"; duration: 100 }
|
||||
}
|
||||
removeDisplaced: Transition {
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 100; }
|
||||
NumberAnimation { properties: "x,y"; duration: 100 }
|
||||
}
|
||||
}
|
||||
|
||||
Menu
|
||||
// Specialty provider that only watches global_inherits (we can't filter on what property changed we get events
|
||||
// so we bypass that to make a dedicated provider).
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: contextMenu
|
||||
|
||||
property string key
|
||||
property var provider
|
||||
property bool settingVisible
|
||||
|
||||
MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text: catalog.i18nc("@action:menu", "Copy value to all extruders")
|
||||
visible: machineExtruderCount.properties.value > 1
|
||||
enabled: contextMenu.provider !== undefined && contextMenu.provider.properties.settable_per_extruder !== "False"
|
||||
onTriggered: Cura.MachineManager.copyValueToExtruders(contextMenu.key)
|
||||
}
|
||||
|
||||
MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text: catalog.i18nc("@action:menu", "Copy all changed values to all extruders")
|
||||
visible: machineExtruderCount.properties.value > 1
|
||||
enabled: contextMenu.provider !== undefined
|
||||
onTriggered: Cura.MachineManager.copyAllValuesToExtruders()
|
||||
}
|
||||
|
||||
MenuSeparator
|
||||
{
|
||||
visible: machineExtruderCount.properties.value > 1
|
||||
}
|
||||
|
||||
Instantiator
|
||||
{
|
||||
id: customMenuItems
|
||||
model: Cura.SidebarCustomMenuItemsModel { }
|
||||
MenuItem
|
||||
{
|
||||
text: model.name
|
||||
iconName: model.icon_name
|
||||
onTriggered:
|
||||
{
|
||||
customMenuItems.model.callMenuItemMethod(name, model.actions, {"key": contextMenu.key})
|
||||
}
|
||||
}
|
||||
onObjectAdded: contextMenu.insertItem(index, object)
|
||||
onObjectRemoved: contextMenu.removeItem(object)
|
||||
}
|
||||
|
||||
MenuSeparator
|
||||
{
|
||||
visible: customMenuItems.count > 0
|
||||
}
|
||||
|
||||
MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
visible: !findingSettings
|
||||
text: catalog.i18nc("@action:menu", "Hide this setting");
|
||||
onTriggered:
|
||||
{
|
||||
definitionsModel.hide(contextMenu.key)
|
||||
}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text:
|
||||
{
|
||||
if (contextMenu.settingVisible)
|
||||
{
|
||||
return catalog.i18nc("@action:menu", "Don't show this setting");
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@action:menu", "Keep this setting visible");
|
||||
}
|
||||
}
|
||||
visible: findingSettings
|
||||
onTriggered:
|
||||
{
|
||||
if (contextMenu.settingVisible)
|
||||
{
|
||||
definitionsModel.hide(contextMenu.key);
|
||||
}
|
||||
else
|
||||
{
|
||||
definitionsModel.show(contextMenu.key);
|
||||
}
|
||||
}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text: catalog.i18nc("@action:menu", "Configure setting visibility...");
|
||||
|
||||
onTriggered: Cura.Actions.configureSettingVisibility.trigger(contextMenu);
|
||||
}
|
||||
id: inheritStackProvider
|
||||
containerStackId: contents.activeMachineId
|
||||
key: model.key
|
||||
watchedProperties: [ "limit_to_extruder" ]
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
id: provider
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : ""
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
containerStackId: contents.activeMachineId
|
||||
key: model.key
|
||||
watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder", "resolve" ]
|
||||
storeIndex: 0
|
||||
removeUnusedValue: model.resolve === undefined
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: item
|
||||
function onContextMenuRequested()
|
||||
{
|
||||
contextMenu.key = model.key
|
||||
contextMenu.settingVisible = model.visible
|
||||
contextMenu.provider = provider
|
||||
contextMenu.popup() //iconName: model.icon_name
|
||||
}
|
||||
function onShowTooltip(text) { base.showTooltip(delegate, Qt.point(-settingsView.x - UM.Theme.getSize("default_margin").width, 0), text) }
|
||||
function onHideTooltip() { base.hideTooltip() }
|
||||
function onShowAllHiddenInheritedSettings()
|
||||
{
|
||||
var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(category_id)
|
||||
for(var i = 0; i < children_with_override.length; i++)
|
||||
{
|
||||
definitionsModel.setVisible(children_with_override[i], true)
|
||||
}
|
||||
Cura.SettingInheritanceManager.manualRemoveOverride(category_id)
|
||||
}
|
||||
function onFocusReceived()
|
||||
{
|
||||
contents.indexWithFocus = index
|
||||
animateContentY.from = contents.contentY
|
||||
contents.positionViewAtIndex(index, ListView.Contain)
|
||||
animateContentY.to = contents.contentY
|
||||
animateContentY.running = true
|
||||
}
|
||||
function onSetActiveFocusToNextSetting(forward)
|
||||
{
|
||||
if (forward == undefined || forward)
|
||||
{
|
||||
contents.currentIndex = contents.indexWithFocus + 1
|
||||
while(contents.currentItem && contents.currentItem.height <= 0)
|
||||
{
|
||||
contents.currentIndex++
|
||||
}
|
||||
if (contents.currentItem)
|
||||
{
|
||||
contents.currentItem.item.focusItem.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contents.currentIndex = contents.indexWithFocus - 1
|
||||
while(contents.currentItem && contents.currentItem.height <= 0)
|
||||
{
|
||||
contents.currentIndex--
|
||||
}
|
||||
if (contents.currentItem)
|
||||
{
|
||||
contents.currentItem.item.focusItem.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: animateContentY
|
||||
target: contents
|
||||
property: "contentY"
|
||||
duration: 50
|
||||
}
|
||||
|
||||
add: Transition {
|
||||
SequentialAnimation {
|
||||
NumberAnimation { properties: "height"; from: 0; duration: 100 }
|
||||
NumberAnimation { properties: "opacity"; from: 0; duration: 100 }
|
||||
}
|
||||
}
|
||||
remove: Transition {
|
||||
SequentialAnimation {
|
||||
NumberAnimation { properties: "opacity"; to: 0; duration: 100 }
|
||||
NumberAnimation { properties: "height"; to: 0; duration: 100 }
|
||||
}
|
||||
}
|
||||
addDisplaced: Transition {
|
||||
NumberAnimation { properties: "x,y"; duration: 100 }
|
||||
}
|
||||
removeDisplaced: Transition {
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 100; }
|
||||
NumberAnimation { properties: "x,y"; duration: 100 }
|
||||
}
|
||||
}
|
||||
|
||||
Cura.Menu
|
||||
{
|
||||
id: contextMenu
|
||||
|
||||
property string key
|
||||
property var provider
|
||||
property bool settingVisible
|
||||
|
||||
Cura.MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text: catalog.i18nc("@action:menu", "Copy value to all extruders")
|
||||
visible: machineExtruderCount.properties.value > 1
|
||||
enabled: contextMenu.provider !== undefined && contextMenu.provider.properties.settable_per_extruder !== "False"
|
||||
onTriggered: Cura.MachineManager.copyValueToExtruders(contextMenu.key)
|
||||
}
|
||||
|
||||
Cura.MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text: catalog.i18nc("@action:menu", "Copy all changed values to all extruders")
|
||||
visible: machineExtruderCount.properties.value > 1
|
||||
enabled: contextMenu.provider !== undefined
|
||||
onTriggered: Cura.MachineManager.copyAllValuesToExtruders()
|
||||
}
|
||||
|
||||
Cura.MenuSeparator
|
||||
{
|
||||
visible: machineExtruderCount.properties.value > 1
|
||||
}
|
||||
|
||||
Instantiator
|
||||
{
|
||||
id: customMenuItems
|
||||
model: Cura.SidebarCustomMenuItemsModel { }
|
||||
Cura.MenuItem
|
||||
{
|
||||
text: model.name
|
||||
onTriggered:
|
||||
{
|
||||
customMenuItems.model.callMenuItemMethod(name, model.actions, {"key": contextMenu.key})
|
||||
}
|
||||
}
|
||||
onObjectAdded: contextMenu.insertItem(index, object)
|
||||
onObjectRemoved: contextMenu.removeItem(object)
|
||||
}
|
||||
|
||||
Cura.MenuSeparator
|
||||
{
|
||||
visible: customMenuItems.count > 0
|
||||
}
|
||||
|
||||
Cura.MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
visible: !findingSettings
|
||||
text: catalog.i18nc("@action:menu", "Hide this setting")
|
||||
onTriggered:
|
||||
{
|
||||
definitionsModel.hide(contextMenu.key)
|
||||
}
|
||||
}
|
||||
Cura.MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text:
|
||||
{
|
||||
if (contextMenu.settingVisible)
|
||||
{
|
||||
return catalog.i18nc("@action:menu", "Don't show this setting")
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@action:menu", "Keep this setting visible")
|
||||
}
|
||||
}
|
||||
visible: findingSettings
|
||||
onTriggered:
|
||||
{
|
||||
if (contextMenu.settingVisible)
|
||||
{
|
||||
definitionsModel.hide(contextMenu.key)
|
||||
}
|
||||
else
|
||||
{
|
||||
definitionsModel.show(contextMenu.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
Cura.MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text: catalog.i18nc("@action:menu", "Configure setting visibility...")
|
||||
|
||||
onTriggered: Cura.Actions.configureSettingVisibility.trigger(contextMenu)
|
||||
}
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : ""
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue