mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Merge branch 'master' into CURA-8979_Materials_Preference_Page
This commit is contained in:
commit
359cb673bc
13 changed files with 283 additions and 198 deletions
23
resources/qml/Preferences/SettingVisibilityCategory.qml
Normal file
23
resources/qml/Preferences/SettingVisibilityCategory.qml
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 2.1
|
||||
|
||||
import UM 1.5 as UM
|
||||
import Cura 1.5 as Cura
|
||||
|
||||
Cura.CategoryButton
|
||||
{
|
||||
id: base
|
||||
|
||||
categoryIcon: definition ? UM.Theme.getIcon(definition.icon) : ""
|
||||
labelText: definition ? definition.label : ""
|
||||
expanded: definition ? definition.expanded : false
|
||||
|
||||
signal showTooltip(string text)
|
||||
signal hideTooltip()
|
||||
signal contextMenuRequested()
|
||||
|
||||
onClicked: expanded ? settingDefinitionsModel.collapseRecursive(definition.key) : settingDefinitionsModel.expandRecursive(definition.key)
|
||||
}
|
99
resources/qml/Preferences/SettingVisibilityItem.qml
Normal file
99
resources/qml/Preferences/SettingVisibilityItem.qml
Normal file
|
@ -0,0 +1,99 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 2.1
|
||||
|
||||
import UM 1.5 as UM
|
||||
|
||||
Item
|
||||
{
|
||||
// Use the depth of the model to move the item, but also leave space for the visibility / enabled exclamation mark.
|
||||
|
||||
// Align checkbox with SettingVisibilityCategory icon with + 5
|
||||
x: definition ? definition.depth * UM.Theme.getSize("narrow_margin").width : UM.Theme.getSize("default_margin").width
|
||||
|
||||
UM.TooltipArea
|
||||
{
|
||||
text: definition ? definition.description : ""
|
||||
|
||||
width: childrenRect.width;
|
||||
height: childrenRect.height;
|
||||
id: checkboxTooltipArea
|
||||
UM.CheckBox
|
||||
{
|
||||
id: check
|
||||
|
||||
text: definition ? definition.label: ""
|
||||
checked: definition ? definition.visible: false
|
||||
enabled: definition ? !definition.prohibited: false
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: definitionsModel.setVisible(definition.key, !check.checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.TooltipArea
|
||||
{
|
||||
width: height
|
||||
height: check.height
|
||||
anchors.left: checkboxTooltipArea.right
|
||||
anchors.leftMargin: 2 * screenScaleFactor
|
||||
|
||||
text:
|
||||
{
|
||||
if(provider.properties.enabled == "True")
|
||||
{
|
||||
return ""
|
||||
}
|
||||
var key = definition ? definition.key : ""
|
||||
var requires = settingDefinitionsModel.getRequires(key, "enabled")
|
||||
if (requires.length == 0)
|
||||
{
|
||||
return catalog.i18nc("@item:tooltip", "This setting has been hidden by the active machine and will not be visible.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var requires_text = ""
|
||||
for (var i in requires)
|
||||
{
|
||||
if (requires_text == "")
|
||||
{
|
||||
requires_text = requires[i].label
|
||||
}
|
||||
else
|
||||
{
|
||||
requires_text += ", " + requires[i].label
|
||||
}
|
||||
}
|
||||
|
||||
return catalog.i18ncp("@item:tooltip %1 is list of setting names", "This setting has been hidden by the value of %1. Change the value of that setting to make this setting visible.", "This setting has been hidden by the values of %1. Change the values of those settings to make this setting visible.", requires.length) .arg(requires_text);
|
||||
}
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
anchors.centerIn: parent
|
||||
width: Math.round(check.height * 0.75) | 0
|
||||
height: width
|
||||
|
||||
source: UM.Theme.getIcon("Information")
|
||||
|
||||
color: UM.Theme.getColor("primary_button_text")
|
||||
}
|
||||
|
||||
visible: provider.properties.enabled == "False"
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: provider
|
||||
|
||||
containerStackId: "global"
|
||||
watchedProperties: [ "enabled" ]
|
||||
key: definition ? definition.key : ""
|
||||
}
|
||||
}
|
|
@ -150,7 +150,7 @@ UM.PreferencesPage
|
|||
}
|
||||
|
||||
clip: true
|
||||
ScrollBar.vertical: UM.ScrollBar {}
|
||||
ScrollBar.vertical: UM.ScrollBar { id: scrollBar }
|
||||
|
||||
model: UM.SettingDefinitionsModel
|
||||
{
|
||||
|
@ -163,11 +163,14 @@ UM.PreferencesPage
|
|||
visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
|
||||
}
|
||||
|
||||
property Component settingVisibilityCategory: Cura.SettingVisibilityCategory {}
|
||||
property Component settingVisibilityItem: Cura.SettingVisibilityItem {}
|
||||
|
||||
delegate: Loader
|
||||
{
|
||||
id: loader
|
||||
|
||||
width: settingsListView.width
|
||||
width: settingsListView.width - scrollBar.width
|
||||
height: model.type != undefined ? UM.Theme.getSize("section").height : 0
|
||||
|
||||
property var definition: model
|
||||
|
@ -177,31 +180,15 @@ UM.PreferencesPage
|
|||
active: model.type != undefined
|
||||
sourceComponent:
|
||||
{
|
||||
switch(model.type)
|
||||
switch (model.type)
|
||||
{
|
||||
case "category":
|
||||
return settingVisibilityCategory
|
||||
return settingsListView.settingVisibilityCategory
|
||||
default:
|
||||
return settingVisibilityItem
|
||||
return settingsListView.settingVisibilityItem
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.I18nCatalog { name: "cura" }
|
||||
|
||||
Component
|
||||
{
|
||||
id: settingVisibilityCategory;
|
||||
|
||||
UM.SettingVisibilityCategory { }
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: settingVisibilityItem;
|
||||
|
||||
UM.SettingVisibilityItem { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue