Multiple task view

This commit is contained in:
Sam Gateau 2019-03-12 16:40:28 -07:00
parent 530b871eef
commit f2fc9c0102
5 changed files with 83 additions and 30 deletions

View file

@ -10,7 +10,12 @@
//
"use strict";
// traverse task tree
// traverse task tree recursively
//
// @param root: the root job config from where to traverse
// @param functor: the functor function() which is applied on every subjobs of root traversed
// if return true, then 'task_tree' is called recursively on that subjob
// @param depth: the depth of the recurse loop since the initial call.
function task_traverse(root, functor, depth) {
if (root.isTask()) {
depth++;
@ -22,6 +27,9 @@ function task_traverse(root, functor, depth) {
}
}
}
// same function as 'task_traverse' with the depth being 0
// and visisting the root job first.
function task_traverseTree(root, functor) {
if (functor(root, 0, 0)) {
task_traverse(root, functor, 0)

View file

@ -1,5 +1,5 @@
//
// jet/TaskListView.qml
// jet/TaskPropView.qml
//
// Created by Sam Gateau, 2018/05/09
// Copyright 2018 High Fidelity, Inc.
@ -27,13 +27,37 @@ Prop.PropGroup {
property var jobPath: ""
property alias label: root.label
Component.onCompleted: {
function populatePropItems() {
var propsModel = []
var props = Jet.job_propKeys(rootConfig.getConfig(jobPath));
console.log(JSON.stringify(props));
for (var p in props) {
root.propItems.push({"object": rootConfig.getConfig(jobPath), "property":props[p] })
propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p] })
}
root.updatePropItems();
root.updatePropItems(propsModel);
Jet.task_traverse(rootConfig.getConfig(jobPath),
function(job, depth, index) {
var component = Qt.createComponent("./TaskPropView.qml");
component.createObject(root.propItemsPanel, {
"label": job.objectName,
"rootConfig": root.rootConfig,
"jobPath": root.jobPath + '.' + job.objectName
})
/* var component = Qt.createComponent("../../prop/PropItem.qml");
component.createObject(root.propItemsPanel, {
"label": root.jobPath + '.' + job.objectName + ' num=' + index,
})*/
// propsModel.push({"type": "printLabel", "label": root.jobPath + '.' + job.objectName + ' num=' + index })
return (depth < 1);
}, 0)
}
Component.onCompleted: {
populatePropItems()
}

View file

@ -13,20 +13,12 @@ import QtQuick 2.7
Item {
Global { id: global }
id: root
// Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item:
// [ ..., PropItemInfo, ...]
// PropItemInfo {
// type: "PropXXXX", object: JSobject, property: "propName"
// }
//
property var propItems: []
property var label: "group"
property alias isUnfold: headerRect.icon
property alias propItemsPanel: propItemsContainer
Item {
id: header
height: global.slimHeight
@ -89,7 +81,7 @@ Item {
anchors.bottom: root.bottom
Column {
id: column
id: propItemsContainer
// anchors.top: header.bottom
anchors.left: parent.left
anchors.right: parent.right
@ -99,13 +91,22 @@ Item {
}
}
height: header.height + isUnfold * column.height
height: header.height + isUnfold * propItemsContainer.height
anchors.leftMargin: global.horizontalMargin
anchors.rightMargin: global.horizontalMargin
anchors.left: parent.left
anchors.right: parent.right
function updatePropItems() {
for (var i = 0; i < root.propItems.length; i++) {
var proItem = root.propItems[i];
// Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item:
// [ ..., PropItemInfo, ...]
// PropItemInfo {
// type: "PropXXXX", object: JSobject, property: "propName"
// }
//
function updatePropItems(propItemsModel) {
for (var i = 0; i < propItemsModel.length; i++) {
var proItem = propItemsModel[i];
// valid object
if (proItem['object'] !== undefined && proItem['object'] !== null ) {
// valid property
@ -118,7 +119,7 @@ Item {
case 'boolean':
case 'PropBool': {
var component = Qt.createComponent("PropBool.qml");
component.createObject(column, {
component.createObject(propItemsContainer, {
"label": proItem.property,
"object": proItem.object,
"property": proItem.property
@ -127,7 +128,7 @@ Item {
case 'number':
case 'PropScalar': {
var component = Qt.createComponent("PropScalar.qml");
component.createObject(column, {
component.createObject(propItemsContainer, {
"label": proItem.property,
"object": proItem.object,
"property": proItem.property,
@ -138,7 +139,7 @@ Item {
} break;
case 'PropEnum': {
var component = Qt.createComponent("PropEnum.qml");
component.createObject(column, {
component.createObject(propItemsContainer, {
"label": proItem.property,
"object": proItem.object,
"property": proItem.property,
@ -147,22 +148,32 @@ Item {
} break;
case 'object': {
var component = Qt.createComponent("PropItem.qml");
component.createObject(column, {
component.createObject(propItemsContainer, {
"label": proItem.property,
"object": proItem.object,
"property": proItem.property,
})
} break;
case 'printLabel': {
var component = Qt.createComponent("PropItem.qml");
component.createObject(propItemsContainer, {
"label": proItem.property
})
} break;
}
} else {
console.log('Invalid property: ' + JSON.stringify(proItem));
}
} else if (proItem['type'] === 'printLabel') {
var component = Qt.createComponent("PropItem.qml");
component.createObject(propItemsContainer, {
"label": proItem.label
})
} else {
console.log('Invalid object: ' + JSON.stringify(proItem));
}
}
}
Component.onCompleted: {
updatePropItems();
}
}

View file

@ -16,7 +16,7 @@ Item {
id: root
// Prop item is designed to author an object[property]:
property var object: NULL
property var object: {}
property string property: ""
// value is accessed through the "valueVarSetter" and "valueVarGetter"

View file

@ -32,7 +32,7 @@ Rectangle {
Column {
width: render.width
Prop.PropEnum {
/* Prop.PropEnum {
label: "Tone Curve"
object: render.mainViewTask.getConfig("ToneMapping")
property: "curve"
@ -44,9 +44,16 @@ Rectangle {
]
anchors.left: parent.left
anchors.right: parent.right
}
} */
Jet.TaskPropView {
id: "the"
jobPath: "RenderMainView.RenderDeferredTask"
label: "Le Render Deferred Job"
anchors.left: parent.left
anchors.right: parent.right
}
/* Jet.TaskPropView {
jobPath: "RenderMainView.ToneMapping"
label: "Le ToneMapping Job"
@ -59,7 +66,10 @@ Rectangle {
anchors.left: parent.left
anchors.right: parent.right
}
}*/
}
}
Component.onCompleted: {
}
}