mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Added rudimentary display of settings again
CURA-1278
This commit is contained in:
parent
bcff683fb0
commit
e9380ba83d
3 changed files with 97 additions and 108 deletions
29
plugins/PerObjectSettingsTool/PerObjectCategory.qml
Normal file
29
plugins/PerObjectSettingsTool/PerObjectCategory.qml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright (c) 2015 Ultimaker B.V.
|
||||||
|
// Uranium is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
import UM 1.1 as UM
|
||||||
|
|
||||||
|
import ".."
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: base;
|
||||||
|
|
||||||
|
style: UM.Theme.styles.sidebar_category;
|
||||||
|
|
||||||
|
signal showTooltip(string text);
|
||||||
|
signal hideTooltip();
|
||||||
|
signal contextMenuRequested()
|
||||||
|
|
||||||
|
text: definition.label
|
||||||
|
iconSource: UM.Theme.getIcon(definition.icon)
|
||||||
|
|
||||||
|
checkable: true
|
||||||
|
checked: definition.expanded
|
||||||
|
|
||||||
|
onClicked: definition.expanded ? settingDefinitionsModel.collapse(definition.key) : settingDefinitionsModel.expandAll(definition.key)
|
||||||
|
}
|
29
plugins/PerObjectSettingsTool/PerObjectItem.qml
Normal file
29
plugins/PerObjectSettingsTool/PerObjectItem.qml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright (c) 2015 Ultimaker B.V.
|
||||||
|
// Uranium is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.1
|
||||||
|
|
||||||
|
import UM 1.2 as UM
|
||||||
|
|
||||||
|
UM.TooltipArea
|
||||||
|
{
|
||||||
|
x: model.depth * UM.Theme.getSize("default_margin").width;
|
||||||
|
text: model.description;
|
||||||
|
|
||||||
|
width: childrenRect.width;
|
||||||
|
height: childrenRect.height;
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: check
|
||||||
|
|
||||||
|
text: definition.label
|
||||||
|
|
||||||
|
//onClicked: delegateItem.settingsModel.setSettingVisible(model.key, checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,10 @@ import QtQuick.Controls 1.2
|
||||||
import QtQuick.Controls.Styles 1.2
|
import QtQuick.Controls.Styles 1.2
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.2
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.2 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
import ".."
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: base;
|
id: base;
|
||||||
|
@ -133,6 +136,7 @@ Item {
|
||||||
id: settingPickDialog
|
id: settingPickDialog
|
||||||
|
|
||||||
title: catalog.i18nc("@title:window", "Pick a Setting to Customize")
|
title: catalog.i18nc("@title:window", "Pick a Setting to Customize")
|
||||||
|
property string labelFilter: ""
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: filter;
|
id: filter;
|
||||||
|
@ -145,123 +149,50 @@ Item {
|
||||||
|
|
||||||
placeholderText: catalog.i18nc("@label:textbox", "Filter...");
|
placeholderText: catalog.i18nc("@label:textbox", "Filter...");
|
||||||
|
|
||||||
onTextChanged: settingCategoriesModel.filter(text);
|
onTextChanged: settingPickDialog.labelFilter = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
ScrollView
|
||||||
id: view;
|
{
|
||||||
anchors {
|
id: scrollView
|
||||||
|
|
||||||
|
anchors
|
||||||
|
{
|
||||||
top: filter.bottom;
|
top: filter.bottom;
|
||||||
left: parent.left;
|
left: parent.left;
|
||||||
right: parent.right;
|
right: parent.right;
|
||||||
bottom: parent.bottom;
|
bottom: parent.bottom;
|
||||||
}
|
}
|
||||||
|
ListView
|
||||||
|
{
|
||||||
|
model: UM.SettingDefinitionsModel
|
||||||
|
{
|
||||||
|
id: definitionsModel;
|
||||||
|
containerId: Cura.MachineManager.activeDefinitionId
|
||||||
|
filter:
|
||||||
|
{
|
||||||
|
"global_only": "False"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delegate:Loader
|
||||||
|
{
|
||||||
|
id: loader
|
||||||
|
|
||||||
Column {
|
width: parent.width
|
||||||
width: view.width - UM.Theme.getSize("default_margin").width * 2;
|
height: model.type != undefined ? UM.Theme.getSize("section").height : 0;
|
||||||
height: childrenRect.height;
|
|
||||||
|
|
||||||
Repeater {
|
property var definition: model
|
||||||
id: settingList;
|
property var settingDefinitionsModel: definitionsModel
|
||||||
|
|
||||||
model: UM.SettingCategoriesModel { id: settingCategoriesModel; }
|
asynchronous: true
|
||||||
|
source:
|
||||||
delegate: Item {
|
{
|
||||||
id: delegateItem;
|
switch(model.type)
|
||||||
|
{
|
||||||
width: parent.width;
|
case "category":
|
||||||
height: childrenRect.height;
|
return "PerObjectCategory.qml"
|
||||||
visible: model.visible && settingsColumn.childrenHeight != 0 //If all children are hidden, the height is 0, and then the category header must also be hidden.
|
default:
|
||||||
|
return "PerObjectItem.qml"
|
||||||
ToolButton {
|
|
||||||
id: categoryHeader;
|
|
||||||
text: model.name;
|
|
||||||
checkable: true;
|
|
||||||
width: parent.width;
|
|
||||||
onCheckedChanged: settingsColumn.state != "" ? settingsColumn.state = "" : settingsColumn.state = "collapsed";
|
|
||||||
|
|
||||||
style: ButtonStyle {
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
width: control.width;
|
|
||||||
height: control.height;
|
|
||||||
color: control.hovered ? palette.highlight : "transparent";
|
|
||||||
}
|
|
||||||
label: Row
|
|
||||||
{
|
|
||||||
spacing: UM.Theme.getSize("default_margin").width;
|
|
||||||
Image
|
|
||||||
{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
|
||||||
source: control.checked ? UM.Theme.getIcon("arrow_right") : UM.Theme.getIcon("arrow_bottom");
|
|
||||||
}
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: control.text;
|
|
||||||
font.bold: true;
|
|
||||||
color: control.hovered ? palette.highlightedText : palette.text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
property variant settingsModel: model.settings;
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: settingsColumn;
|
|
||||||
|
|
||||||
anchors.top: categoryHeader.bottom;
|
|
||||||
|
|
||||||
property real childrenHeight:
|
|
||||||
{
|
|
||||||
var h = 0.0;
|
|
||||||
for(var i in children)
|
|
||||||
{
|
|
||||||
var item = children[i];
|
|
||||||
h += children[i].height;
|
|
||||||
if(item.settingVisible)
|
|
||||||
{
|
|
||||||
if(i > 0)
|
|
||||||
{
|
|
||||||
h += spacing;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
width: childrenRect.width;
|
|
||||||
height: childrenHeight;
|
|
||||||
Repeater {
|
|
||||||
model: delegateItem.settingsModel;
|
|
||||||
|
|
||||||
delegate: ToolButton {
|
|
||||||
id: button;
|
|
||||||
x: model.visible_depth * UM.Theme.getSize("default_margin").width;
|
|
||||||
text: model.name;
|
|
||||||
tooltip: model.description;
|
|
||||||
visible: !model.global_only
|
|
||||||
height: model.global_only ? 0 : undefined
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
var object_id = UM.ActiveTool.properties.getValue("Model").getItem(base.currentIndex).id;
|
|
||||||
UM.ActiveTool.properties.getValue("Model").addSettingOverride(object_id, model.key);
|
|
||||||
settingPickDialog.visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
states: State {
|
|
||||||
name: "filtered"
|
|
||||||
when: model.filtered || !model.visible || !model.enabled
|
|
||||||
PropertyChanges { target: button; height: 0; opacity: 0; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
states: State {
|
|
||||||
name: "collapsed";
|
|
||||||
|
|
||||||
PropertyChanges { target: settingsColumn; opacity: 0; height: 0; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue