diff --git a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml index b421b7a5..dd5528d0 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeEditor.qml @@ -31,7 +31,7 @@ ListView { && (object.isDefault && GraphEditorSettings.showDefaultAttributes || !object.isDefault && GraphEditorSettings.showModifiedAttributes) && (object.isOutput && GraphEditorSettings.showOutputAttributes || !object.isOutput && GraphEditorSettings.showInputAttributes) && (object.isLinkNested && GraphEditorSettings.showLinkAttributes || !object.isLink && GraphEditorSettings.showNotLinkAttributes)) - ) && object.matchText(filterText) + ) && object.matchText(filterText) visible: active sourceComponent: AttributeItemDelegate { diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index dbb1d6ff..cb24a08e 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -25,8 +25,7 @@ RowLayout { spacing: 2 - function updateAttributeLabel() - { + function updateAttributeLabel() { background.color = attribute.validValue ? Qt.darker(palette.window, 1.1) : Qt.darker(Colors.red, 1.5) if (attribute.desc) { @@ -40,7 +39,10 @@ RowLayout { } Pane { - background: Rectangle { id: background; color: object.validValue ? Qt.darker(parent.palette.window, 1.1) : Qt.darker(Colors.red, 1.5) } + background: Rectangle { + id: background + color: object.validValue ? Qt.darker(parent.palette.window, 1.1) : Qt.darker(Colors.red, 1.5) + } padding: 0 Layout.preferredWidth: labelWidth || implicitWidth Layout.fillHeight: true @@ -128,8 +130,7 @@ RowLayout { onClicked: { forceActiveFocus() - if(mouse.button == Qt.RightButton) - { + if (mouse.button == Qt.RightButton) { var menu = menuComp.createObject(parameterLabel) menu.parent = parameterLabel menu.popup() @@ -147,25 +148,23 @@ RowLayout { } } - function setTextFieldAttribute(value) - { + function setTextFieldAttribute(value) { // editingFinished called even when TextField is readonly - if(!editable) + if (!editable) return - switch(attribute.type) - { - case "IntParam": - case "FloatParam": - _reconstruction.setAttribute(root.attribute, Number(value)) - updateAttributeLabel() - break; - case "File": - _reconstruction.setAttribute(root.attribute, value) - break; - default: - _reconstruction.setAttribute(root.attribute, value.trim()) - updateAttributeLabel() - break; + switch (attribute.type) { + case "IntParam": + case "FloatParam": + _reconstruction.setAttribute(root.attribute, Number(value)) + updateAttributeLabel() + break + case "File": + _reconstruction.setAttribute(root.attribute, value) + break + default: + _reconstruction.setAttribute(root.attribute, value.trim()) + updateAttributeLabel() + break } } @@ -173,24 +172,28 @@ RowLayout { Layout.fillWidth: true sourceComponent: { - switch(attribute.type) - { - case "ChoiceParam": return attribute.desc.exclusive ? comboBox_component : multiChoice_component - case "IntParam": return slider_component - case "FloatParam": - if(attribute.desc.semantic === 'color/hue') - return color_hue_component - return slider_component - case "BoolParam": return checkbox_component - case "ListAttribute": return listAttribute_component - case "GroupAttribute": return groupAttribute_component - case "StringParam": - if (attribute.desc.semantic === 'multiline') - return textArea_component - return textField_component - case "ColorParam": - return color_component - default: return textField_component + switch (attribute.type) { + case "ChoiceParam": + return attribute.desc.exclusive ? comboBox_component : multiChoice_component + case "IntParam": return slider_component + case "FloatParam": + if (attribute.desc.semantic === 'color/hue') + return color_hue_component + return slider_component + case "BoolParam": + return checkbox_component + case "ListAttribute": + return listAttribute_component + case "GroupAttribute": + return groupAttribute_component + case "StringParam": + if (attribute.desc.semantic === 'multiline') + return textArea_component + return textField_component + case "ColorParam": + return color_component + default: + return textField_component } } @@ -206,16 +209,16 @@ RowLayout { root.forceActiveFocus() } Component.onDestruction: { - if(activeFocus) + if (activeFocus) setTextFieldAttribute(text) } DropArea { enabled: root.editable anchors.fill: parent onDropped: { - if(drop.hasUrls) + if (drop.hasUrls) setTextFieldAttribute(Filepath.urlToString(drop.urls[0])) - else if(drop.hasText && drop.text != '') + else if (drop.hasText && drop.text != '') setTextFieldAttribute(drop.text) } } @@ -282,7 +285,7 @@ RowLayout { checked: node && node.color === "" ? false : true text: "Custom Color" onClicked: { - if(checked) { + if (checked) { _reconstruction.setAttribute(attribute, "#0000FF") } else { _reconstruction.setAttribute(attribute, "") @@ -300,7 +303,7 @@ RowLayout { onEditingFinished: setTextFieldAttribute(text) onAccepted: setTextFieldAttribute(text) Component.onDestruction: { - if(activeFocus) + if (activeFocus) setTextFieldAttribute(text) } } @@ -366,8 +369,11 @@ RowLayout { checked: attribute.value.indexOf(modelData) >= 0 onToggled: { var t = attribute.value - if(!checked) { t.splice(t.indexOf(modelData), 1) } // remove element - else { t.push(modelData) } // add element + if (!checked) { + t.splice(t.indexOf(modelData), 1) // remove element + } else { + t.push(modelData) // add element + } _reconstruction.setAttribute(attribute, t) } } @@ -397,7 +403,7 @@ RowLayout { // When the value change keep the text align to the left to be able to read the most important part // of the number. When we are editing (item is in focus), the content should follow the editing. autoScroll: activeFocus - validator: attribute.type == "FloatParam" ? doubleValidator : intValidator + validator: attribute.type === "FloatParam" ? doubleValidator : intValidator onEditingFinished: setTextFieldAttribute(text) onAccepted: { setTextFieldAttribute(text) @@ -407,7 +413,7 @@ RowLayout { ensureVisible(0) } Component.onDestruction: { - if(activeFocus) + if (activeFocus) setTextFieldAttribute(text) } Component.onCompleted: { @@ -482,7 +488,7 @@ RowLayout { ListView { id: lv model: listAttribute_layout.expanded ? attribute.value : undefined - visible: model != undefined && count > 0 + visible: model !== undefined && count > 0 implicitHeight: Math.min(contentHeight, 300) Layout.fillWidth: true Layout.margins: 4 @@ -491,7 +497,7 @@ RowLayout { ScrollBar.vertical: ScrollBar { id: sb } - delegate: Loader{ + delegate: Loader { active: !objectsHideable || ((object.isDefault && GraphEditorSettings.showDefaultAttributes || !object.isDefault && GraphEditorSettings.showModifiedAttributes) && (object.isLinkNested && GraphEditorSettings.showLinkAttributes || !object.isLinkNested && GraphEditorSettings.showNotLinkAttributes)) @@ -505,14 +511,15 @@ RowLayout { Component.onCompleted: { var cpt = Qt.createComponent("AttributeItemDelegate.qml") var obj = cpt.createObject(item, - {'attribute': Qt.binding(function() { return item.childAttrib }), + { + 'attribute': Qt.binding(function() { return item.childAttrib }), 'readOnly': Qt.binding(function() { return !root.editable }) }) obj.Layout.fillWidth = true obj.label.text = index obj.label.horizontalAlignment = Text.AlignHCenter obj.label.verticalAlignment = Text.AlignVCenter - obj.doubleClicked.connect(function(attr) {root.doubleClicked(attr)}) + obj.doubleClicked.connect(function(attr) { root.doubleClicked(attr) }) } ToolButton { enabled: root.editable @@ -537,11 +544,12 @@ RowLayout { Component.onCompleted: { var cpt = Qt.createComponent("AttributeEditor.qml"); var obj = cpt.createObject(groupItem, - {'model': Qt.binding(function() { return attribute.value }), - 'readOnly': Qt.binding(function() { return root.readOnly }), - 'labelWidth': 100, // reduce label width for children (space gain) - 'objectsHideable': Qt.binding(function() { return root.objectsHideable }), - 'filterText': Qt.binding(function() { return root.filterText }), + { + 'model': Qt.binding(function() { return attribute.value }), + 'readOnly': Qt.binding(function() { return root.readOnly }), + 'labelWidth': 100, // reduce label width for children (space gain) + 'objectsHideable': Qt.binding(function() { return root.objectsHideable }), + 'filterText': Qt.binding(function() { return root.filterText }), }) obj.Layout.fillWidth = true; obj.attributeDoubleClicked.connect(function(attr) {root.doubleClicked(attr)}) @@ -565,7 +573,7 @@ RowLayout { onEditingFinished: setTextFieldAttribute(text) onAccepted: setTextFieldAttribute(text) Component.onDestruction: { - if(activeFocus) + if (activeFocus) setTextFieldAttribute(text) } } @@ -575,9 +583,9 @@ RowLayout { color: Qt.hsla(slider.pressed ? slider.formattedValue : attribute.value, 1, 0.5, 1) } Slider { + id: slider Layout.fillWidth: true - id: slider readonly property int stepDecimalCount: 2 readonly property real formattedValue: value.toFixed(stepDecimalCount) enabled: root.editable @@ -587,7 +595,7 @@ RowLayout { stepSize: 0.01 snapMode: Slider.SnapAlways onPressedChanged: { - if(!pressed) + if (!pressed) _reconstruction.setAttribute(attribute, formattedValue) } diff --git a/meshroom/ui/qml/GraphEditor/AttributePin.qml b/meshroom/ui/qml/GraphEditor/AttributePin.qml index effdf920..0d079e92 100755 --- a/meshroom/ui/qml/GraphEditor/AttributePin.qml +++ b/meshroom/ui/qml/GraphEditor/AttributePin.qml @@ -17,11 +17,11 @@ RowLayout { property bool displayOutputPinForInput: true // position of the anchor for attaching and edge to this attribute pin - readonly property point inputAnchorPos: Qt.point(inputAnchor.x + inputAnchor.width/2, - inputAnchor.y + inputAnchor.height/2) + readonly property point inputAnchorPos: Qt.point(inputAnchor.x + inputAnchor.width / 2, + inputAnchor.y + inputAnchor.height / 2) - readonly property point outputAnchorPos: Qt.point(outputAnchor.x + outputAnchor.width/2, - outputAnchor.y + outputAnchor.height/2) + readonly property point outputAnchorPos: Qt.point(outputAnchor.x + outputAnchor.width / 2, + outputAnchor.y + outputAnchor.height / 2) readonly property bool isList: attribute && attribute.type === "ListAttribute" @@ -39,8 +39,8 @@ RowLayout { Repeater { id: childrenRepeater model: isList && !attribute.isLink ? attribute.value : 0 - onItemAdded: {childPinCreated(item.childAttribute, item)} - onItemRemoved: {childPinDeleted(item.childAttribute, item)} + onItemAdded: childPinCreated(item.childAttribute, item) + onItemRemoved: childPinDeleted(item.childAttribute, item) delegate: Item { property var childAttribute: object } @@ -52,10 +52,10 @@ RowLayout { width: 8 height: width - radius: isList ? 0 : width/2 + radius: isList ? 0 : width / 2 Layout.alignment: Qt.AlignVCenter - border.color: Colors.sysPalette.mid + border.color: Colors.sysPalette.mid color: Colors.sysPalette.base Rectangle { @@ -64,7 +64,7 @@ RowLayout { anchors.fill: parent anchors.margins: 2 color: { - if(inputConnectMA.containsMouse || inputConnectMA.drag.active || (inputDropArea.containsDrag && inputDropArea.acceptableDrop)) + if (inputConnectMA.containsMouse || inputConnectMA.drag.active || (inputDropArea.containsDrag && inputDropArea.acceptableDrop)) return Colors.sysPalette.highlight return Colors.sysPalette.text } @@ -84,19 +84,17 @@ RowLayout { keys: [inputDragTarget.objectName] onEntered: { // Check if attributes are compatible to create a valid connection - if( root.readOnly // cannot connect on a read-only attribute - || drag.source.objectName != inputDragTarget.objectName // not an edge connector - || drag.source.baseType !== inputDragTarget.baseType // not the same base type - || drag.source.nodeItem === inputDragTarget.nodeItem // connection between attributes of the same node - || (drag.source.isList && !inputDragTarget.isList) // connection between a list and a simple attribute - || (drag.source.isList && childrenRepeater.count) // source/target are lists but target already has children - || drag.source.connectorType === "input" // refuse to connect an "input pin" on another one (input attr can be connected to input attr, but not the graphical pin) - ) - { + if (root.readOnly // cannot connect on a read-only attribute + || drag.source.objectName != inputDragTarget.objectName // not an edge connector + || drag.source.baseType !== inputDragTarget.baseType // not the same base type + || drag.source.nodeItem === inputDragTarget.nodeItem // connection between attributes of the same node + || (drag.source.isList && !inputDragTarget.isList) // connection between a list and a simple attribute + || (drag.source.isList && childrenRepeater.count) // source/target are lists but target already has children + || drag.source.connectorType === "input" // refuse to connect an "input pin" on another one (input attr can be connected to input attr, but not the graphical pin) + ) { // Refuse attributes connection drag.accepted = false - } - else if (inputDragTarget.attribute.isLink) { // already connected attribute + } else if (inputDragTarget.attribute.isLink) { // already connected attribute root.edgeAboutToBeRemoved(inputDragTarget.attribute) } inputDropArea.acceptableDrop = drag.accepted @@ -159,8 +157,8 @@ RowLayout { Edge { id: inputConnectEdge visible: false - point1x: inputDragTarget.x + inputDragTarget.width/2 - point1y: inputDragTarget.y + inputDragTarget.height/2 + point1x: inputDragTarget.x + inputDragTarget.width / 2 + point1y: inputDragTarget.y + inputDragTarget.height / 2 point2x: parent.width / 2 point2y: parent.width / 2 color: palette.highlight @@ -214,7 +212,7 @@ RowLayout { anchors.fill: parent anchors.margins: 2 color: { - if(outputConnectMA.containsMouse || outputConnectMA.drag.active || (outputDropArea.containsDrag && outputDropArea.acceptableDrop)) + if (outputConnectMA.containsMouse || outputConnectMA.drag.active || (outputDropArea.containsDrag && outputDropArea.acceptableDrop)) return Colors.sysPalette.highlight return Colors.sysPalette.text } @@ -234,18 +232,16 @@ RowLayout { keys: [outputDragTarget.objectName] onEntered: { // Check if attributes are compatible to create a valid connection - if( drag.source.objectName != outputDragTarget.objectName // not an edge connector - || drag.source.baseType !== outputDragTarget.baseType // not the same base type - || drag.source.nodeItem === outputDragTarget.nodeItem // connection between attributes of the same node - || (!drag.source.isList && outputDragTarget.isList) // connection between a list and a simple attribute - || (drag.source.isList && childrenRepeater.count) // source/target are lists but target already has children - || drag.source.connectorType === "output" // refuse to connect an output pin on another one - ) - { + if (drag.source.objectName != outputDragTarget.objectName // not an edge connector + || drag.source.baseType !== outputDragTarget.baseType // not the same base type + || drag.source.nodeItem === outputDragTarget.nodeItem // connection between attributes of the same node + || (!drag.source.isList && outputDragTarget.isList) // connection between a list and a simple attribute + || (drag.source.isList && childrenRepeater.count) // source/target are lists but target already has children + || drag.source.connectorType === "output" // refuse to connect an output pin on another one + ) { // Refuse attributes connection drag.accepted = false - } - else if (drag.source.attribute.isLink) { // already connected attribute + } else if (drag.source.attribute.isLink) { // already connected attribute root.edgeAboutToBeRemoved(drag.source.attribute) } outputDropArea.acceptableDrop = drag.accepted @@ -277,8 +273,8 @@ RowLayout { height: parent.height Drag.keys: [outputDragTarget.objectName] Drag.active: outputConnectMA.drag.active - Drag.hotSpot.x: width*0.5 - Drag.hotSpot.y: height*0.5 + Drag.hotSpot.x: width * 0.5 + Drag.hotSpot.y: height * 0.5 } MouseArea { @@ -304,8 +300,8 @@ RowLayout { visible: false point1x: parent.width / 2 point1y: parent.width / 2 - point2x: outputDragTarget.x + outputDragTarget.width/2 - point2y: outputDragTarget.y + outputDragTarget.height/2 + point2x: outputDragTarget.x + outputDragTarget.width / 2 + point2y: outputDragTarget.y + outputDragTarget.height / 2 color: palette.highlight thickness: outputDragTarget.dropAccepted ? 2 : 1 } @@ -354,8 +350,8 @@ RowLayout { script: { // Add the right offset if the initial click is not exactly at the center of the connection circle. var pos = inputDragTarget.mapFromItem(inputConnectMA, inputConnectMA.mouseX, inputConnectMA.mouseY); - inputDragTarget.x = pos.x - inputDragTarget.width/2; - inputDragTarget.y = pos.y - inputDragTarget.height/2; + inputDragTarget.x = pos.x - inputDragTarget.width / 2; + inputDragTarget.y = pos.y - inputDragTarget.height / 2; } } }, @@ -374,11 +370,10 @@ RowLayout { StateChangeScript { script: { var pos = outputDragTarget.mapFromItem(outputConnectMA, outputConnectMA.mouseX, outputConnectMA.mouseY); - outputDragTarget.x = pos.x - outputDragTarget.width/2; - outputDragTarget.y = pos.y - outputDragTarget.height/2; + outputDragTarget.x = pos.x - outputDragTarget.width / 2; + outputDragTarget.y = pos.y - outputDragTarget.height / 2; } } } ] - } diff --git a/meshroom/ui/qml/GraphEditor/ChunksListView.qml b/meshroom/ui/qml/GraphEditor/ChunksListView.qml index e359bcfa..c8fd39cb 100644 --- a/meshroom/ui/qml/GraphEditor/ChunksListView.qml +++ b/meshroom/ui/qml/GraphEditor/ChunksListView.qml @@ -18,7 +18,7 @@ ColumnLayout { onChunksChanged: { // When the list changes, ensure the current index is in the new range - if(currentIndex >= chunks.count) + if (currentIndex >= chunks.count) currentIndex = chunks.count-1 } @@ -39,8 +39,7 @@ ColumnLayout { focus: true currentIndex: root.currentIndex onCurrentIndexChanged: { - if(chunksLV.currentIndex !== root.currentIndex) - { + if (chunksLV.currentIndex !== root.currentIndex) { // When the list is resized, the currentIndex is reset to 0. // So here we force it to keep the binding. chunksLV.currentIndex = Qt.binding(function() { return root.currentIndex }) @@ -67,7 +66,7 @@ ColumnLayout { } highlight: Component { Rectangle { - visible: true // !root.chunksSummary + visible: true // !root.chunksSummary color: activePalette.highlight opacity: 0.3 z: 2 diff --git a/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml b/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml index 2b22683d..396eeae9 100644 --- a/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml +++ b/meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml @@ -23,7 +23,6 @@ Loader { property Component iconDelegate: Component { Label { - text: MaterialIcons.warning font.family: MaterialIcons.fontFamily font.pointSize: 12 @@ -74,6 +73,5 @@ Loader { } } } - } } diff --git a/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml b/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml index aab731d0..f81da217 100644 --- a/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml +++ b/meshroom/ui/qml/GraphEditor/CompatibilityManager.qml @@ -20,9 +20,8 @@ MessageDialog { // the number of CompatibilityNodes that can be upgraded readonly property int upgradableCount: { var count = 0 - for(var i=0; i 0 ? factor : 1/factor + var zoomFactor = wheel.angleDelta.y > 0 ? factor : 1 / factor var scale = draggable.scale * zoomFactor scale = Math.min(Math.max(minZoom, scale), maxZoom) - if(draggable.scale == scale) + if (draggable.scale == scale) return var point = mapToItem(draggable, wheel.x, wheel.y) - draggable.x += (1-zoomFactor) * point.x * draggable.scale - draggable.y += (1-zoomFactor) * point.y * draggable.scale + draggable.x += (1 - zoomFactor) * point.x * draggable.scale + draggable.y += (1 - zoomFactor) * point.y * draggable.scale draggable.scale = scale workspaceMoved() } @@ -197,16 +185,15 @@ Item { workspaceClicked() } onPositionChanged: { - if(drag.active) + if (drag.active) workspaceMoved() } onClicked: { - if(mouse.button == Qt.RightButton) - { + if (mouse.button == Qt.RightButton) { // store mouse click position in 'draggable' coordinates as new node spawn position - newNodeMenu.spawnPosition = mouseArea.mapToItem(draggable, mouse.x, mouse.y); - newNodeMenu.popup(); + newNodeMenu.spawnPosition = mouseArea.mapToItem(draggable, mouse.x, mouse.y) + newNodeMenu.popup() } } @@ -217,8 +204,7 @@ Item { property point spawnPosition property variant menuKeys: Object.keys(root.nodeTypesModel).concat(Object.values(MeshroomApp.pipelineTemplateNames)) - function createNode(nodeType) - { + function createNode(nodeType) { uigraph.clearNodeSelection() // Ensures that only the created node / imported pipeline will be selected // "nodeType" might be a pipeline (artificially added in the "Pipelines" category) instead of a node @@ -231,8 +217,7 @@ Item { close() } - function importPipeline(pipeline) - { + function importPipeline(pipeline) { if (MeshroomApp.pipelineTemplateNames.includes(pipeline)) { var url = MeshroomApp.pipelineTemplateFiles[MeshroomApp.pipelineTemplateNames.indexOf(pipeline)]["path"] var nodes = uigraph.importProject(Filepath.stringToUrl(url), spawnPosition) @@ -243,21 +228,20 @@ Item { return false } - function parseCategories() - { + function parseCategories() { // Organize nodes based on their category // {"category1": ["node1", "node2"], "category2": ["node3", "node4"]} let categories = {}; for (const [name, data] of Object.entries(root.nodeTypesModel)) { let category = data["category"]; if (categories[category] === undefined) { - categories[category] = []; + categories[category] = [] } categories[category].push(name) } // Add a "Pipelines" category, filled with the list of templates to create pipelines from the menu - categories["Pipelines"] = MeshroomApp.pipelineTemplateNames; + categories["Pipelines"] = MeshroomApp.pipelineTemplateNames return categories } @@ -287,27 +271,27 @@ Item { // Hide items that does not match the filter text visible: modelData.toLowerCase().indexOf(searchBar.text.toLowerCase()) > -1 // Reset menu currentIndex if highlighted items gets filtered out - onVisibleChanged: if(highlighted) newNodeMenu.currentIndex = 0 + onVisibleChanged: if (highlighted) newNodeMenu.currentIndex = 0 text: modelData // Forward key events to the search bar to continue typing seamlessly // even if this delegate took the activeFocus due to mouse hovering Keys.forwardTo: [searchBar.textField] Keys.onPressed: { event.accepted = false; - switch(event.key) { + switch (event.key) { case Qt.Key_Return: case Qt.Key_Enter: // create node on validation (Enter/Return keys) - newNodeMenu.createNode(modelData); - event.accepted = true; - break; + newNodeMenu.createNode(modelData) + event.accepted = true + break case Qt.Key_Up: case Qt.Key_Down: case Qt.Key_Left: case Qt.Key_Right: - break; // ignore if arrow key was pressed to let the menu be controlled + break // ignore if arrow key was pressed to let the menu be controlled default: - searchBar.forceActiveFocus(); + searchBar.forceActiveFocus() } } // Create node on mouse click @@ -339,7 +323,7 @@ Item { // Dynamically add the menu categories Instantiator { model: !(searchBar.text !== "") ? Object.keys(newNodeMenu.parseCategories()).sort() : undefined - onObjectAdded: newNodeMenu.insertMenu(index+1, object ) // add sub-menu under the search bar + onObjectAdded: newNodeMenu.insertMenu(index + 1, object ) // add sub-menu under the search bar onObjectRemoved: newNodeMenu.removeMenu(object) delegate: Menu { @@ -409,12 +393,10 @@ Item { onPressed: { const canEdit = !edge.dst.node.locked - if(event.button === Qt.RightButton) - { - if(canEdit && (event.modifiers & Qt.AltModifier)) { + if (event.button === Qt.RightButton) { + if (canEdit && (event.modifiers & Qt.AltModifier)) { uigraph.removeEdge(edge) - } - else { + } else { edgeMenu.currentEdge = edge edgeMenu.popup() } @@ -478,8 +460,8 @@ Item { ToolTip.text: "Copy selection to the clipboard and immediately paste it" ToolTip.visible: hovered onTriggered: { - copyNodes(); - pasteNodes(); + copyNodes() + pasteNodes() } } MenuItem { @@ -489,11 +471,14 @@ Item { MaterialToolButton { id: duplicateFollowingButton height: parent.height - anchors { right: parent.right; rightMargin: parent.padding } + anchors { + right: parent.right + rightMargin: parent.padding + } text: MaterialIcons.fast_forward onClicked: { - duplicateNode(true); - nodeMenu.close(); + duplicateNode(true) + nodeMenu.close() } } } @@ -504,11 +489,14 @@ Item { MaterialToolButton { id: removeFollowingButton height: parent.height - anchors { right: parent.right; rightMargin: parent.padding } + anchors { + right: parent.right + rightMargin: parent.padding + } text: MaterialIcons.fast_forward onClicked: { - uigraph.removeNodesFrom(uigraph.selectedNodes); - nodeMenu.close(); + uigraph.removeNodesFrom(uigraph.selectedNodes) + nodeMenu.close() } } } @@ -516,35 +504,38 @@ Item { MenuItem { text: "Delete Data" + (deleteFollowingButton.hovered ? " From Here" : "" ) + "..." enabled: { - if(!nodeMenu.currentNode) + if (!nodeMenu.currentNode) return false // Check if the current node is locked (needed because it does not belong to its own duplicates list) - if(nodeMenu.currentNode.locked) + if (nodeMenu.currentNode.locked) return false // Check if at least one of the duplicate nodes is locked - for(let i = 0; i < nodeMenu.currentNode.duplicates.count; ++i) { - if(nodeMenu.currentNode.duplicates.at(i).locked) + for (let i = 0; i < nodeMenu.currentNode.duplicates.count; ++i) { + if (nodeMenu.currentNode.duplicates.at(i).locked) return false } return true } function showConfirmationDialog(deleteFollowing) { - uigraph.forceNodesStatusUpdate(); + uigraph.forceNodesStatusUpdate() var obj = deleteDataDialog.createObject(root, { "node": nodeMenu.currentNode, "deleteFollowing": deleteFollowing - }); + }) obj.open() - nodeMenu.close(); + nodeMenu.close() } onTriggered: showConfirmationDialog(false) MaterialToolButton { id: deleteFollowingButton - anchors { right: parent.right; rightMargin: parent.padding } + anchors { + right: parent.right + rightMargin: parent.padding + } height: parent.height text: MaterialIcons.fast_forward onClicked: parent.showConfirmationDialog(true) @@ -566,10 +557,10 @@ Item { standardButtons: Dialog.Yes | Dialog.Cancel onAccepted: { - if(deleteFollowing) - uigraph.clearDataFrom(uigraph.selectedNodes); + if (deleteFollowing) + uigraph.clearDataFrom(uigraph.selectedNodes) else - uigraph.clearData(uigraph.selectedNodes); + uigraph.clearData(uigraph.selectedNodes) } onClosed: destroy() } @@ -611,7 +602,7 @@ Item { return } } else if (mouse.modifiers & Qt.AltModifier) { - if (!(mouse.modifiers & Qt.ControlModifier)){ + if (!(mouse.modifiers & Qt.ControlModifier)) { uigraph.clearNodeSelection() } uigraph.selectFollowing(node) @@ -796,10 +787,10 @@ Item { padding: 0 enabled: graphSearchBar.text !== "" onClicked: { - navigation.currentIndex--; + navigation.currentIndex-- if (navigation.currentIndex === -1) - navigation.currentIndex = filteredNodes.count - 1; - navigation.nextItem(); + navigation.currentIndex = filteredNodes.count - 1 + navigation.nextItem() } } @@ -808,10 +799,10 @@ Item { padding: 0 enabled: graphSearchBar.text !== "" onClicked: { - navigation.currentIndex++; + navigation.currentIndex++ if (navigation.currentIndex === filteredNodes.count) - navigation.currentIndex = 0; - navigation.nextItem(); + navigation.currentIndex = 0 + navigation.nextItem() } } @@ -839,38 +830,34 @@ Item { } } - function nextItem() - { + function nextItem() { // compute bounding box var node = nodeRepeater.itemAt(filteredNodes.itemAt(navigation.currentIndex).index_) var bbox = Qt.rect(node.x, node.y, node.width, node.height) // rescale to fit the bounding box in the view, zoom is limited to prevent huge text - draggable.scale = Math.min(Math.min(root.width/bbox.width, root.height/bbox.height),maxZoom) + draggable.scale = Math.min(Math.min(root.width / bbox.width, root.height / bbox.height),maxZoom) // recenter - draggable.x = bbox.x*draggable.scale*-1 + (root.width-bbox.width*draggable.scale)*0.5 - draggable.y = bbox.y*draggable.scale*-1 + (root.height-bbox.height*draggable.scale)*0.5 + draggable.x = bbox.x*draggable.scale * -1 + (root.width - bbox.width * draggable.scale) * 0.5 + draggable.y = bbox.y*draggable.scale * -1 + (root.height - bbox.height * draggable.scale) * 0.5 } } - function registerAttributePin(attribute, pin) - { + function registerAttributePin(attribute, pin) { root._attributeToDelegate[attribute] = pin } - function unregisterAttributePin(attribute, pin) - { + function unregisterAttributePin(attribute, pin) { delete root._attributeToDelegate[attribute] } - function boundingBox() - { + function boundingBox() { var first = nodeRepeater.itemAt(0) var bbox = Qt.rect(first.x, first.y, first.x + first.width, first.y + first.height) - for(var i=0; i 0 ? (100 / root.gpuTotalMemory) : 1; + var gpuMemoryRatio = root.gpuTotalMemory > 0 ? (100 / root.gpuTotalMemory) : 1 - if(gpuUsedMemory.length === 1) { + if (gpuUsedMemory.length === 1) { gpuUsedSerie.append(0, gpuUsed[0]) gpuUsedSerie.append(1 * root.deltaTime, gpuUsed[0]) @@ -282,9 +277,9 @@ Item { gpuTemperatureSerie.append(1 * root.deltaTime, gpuTemperature[0]) root.gpuMaxAxis = Math.max(gpuMaxAxis, gpuTemperature[0]) } else { - var displayLength = Math.min(maxDisplayLength, gpuUsedMemory.length); - var step = gpuUsedMemory.length / displayLength; - for(var ii = 0; ii < displayLength; ii+=step) { + var displayLength = Math.min(maxDisplayLength, gpuUsedMemory.length) + var step = gpuUsedMemory.length / displayLength + for (var ii = 0; ii < displayLength; ii += step) { var i = Math.floor(ii*step) gpuUsedSerie.append(i * root.deltaTime, gpuUsed[i]) @@ -356,7 +351,6 @@ Item { width: parent.width anchors.horizontalCenter: parent.horizontalCenter - ChartViewCheckBox { id: allCPU text: "ALL" @@ -365,9 +359,8 @@ Item { leftPadding: 0 onClicked: { var _checked = checked; - for(var i = 0; i < cpuChart.count; ++i) - { - cpuChart.series(i).visible = _checked; + for (var i = 0; i < cpuChart.count; ++i) { + cpuChart.series(i).visible = _checked } } } @@ -378,7 +371,6 @@ Item { Layout.fillHeight: true chartView: cpuChart } - } } @@ -386,7 +378,7 @@ Item { id: cpuChart Layout.fillWidth: true - Layout.preferredHeight: width/2 + Layout.preferredHeight: width / 2 margins.top: 0 margins.bottom: 0 antialiasing: true @@ -425,7 +417,6 @@ Item { shadesBorderColor: textColor labelsColor: textColor } - } } @@ -442,7 +433,7 @@ Item { margins.top: 0 margins.bottom: 0 Layout.fillWidth: true - Layout.preferredHeight: width/2 + Layout.preferredHeight: width / 2 antialiasing: true legend.color: textColor legend.labelColor: textColor @@ -491,7 +482,6 @@ Item { ColumnLayout { - InteractiveChartView { id: gpuChart @@ -537,8 +527,6 @@ Item { } } } - } } - } diff --git a/meshroom/ui/qml/GraphEditor/TaskManager.qml b/meshroom/ui/qml/GraphEditor/TaskManager.qml index a5735ba1..bcdade19 100644 --- a/meshroom/ui/qml/GraphEditor/TaskManager.qml +++ b/meshroom/ui/qml/GraphEditor/TaskManager.qml @@ -150,8 +150,8 @@ Item { function getNbFinishedChunks(chunks) { var nbSuccess = 0 - for(var i = 0; i < chunks.count; i++) { - if(chunks.at(i).statusName === "SUCCESS") { + for (var i = 0; i < chunks.count; i++) { + if (chunks.at(i).statusName === "SUCCESS") { nbSuccess += 1 } } @@ -159,7 +159,7 @@ Item { } Label { - text: index+1 + text: index + 1 Layout.preferredWidth: nbMetrics.width + 20 Layout.preferredHeight: parent.height horizontalAlignment: Label.AlignHCenter @@ -253,36 +253,36 @@ Item { Layout.minimumWidth: progressMetrics.width + 20 Layout.preferredHeight: parent.height - ListView { - id: chunkList - width: parent.width - height: parent.height - orientation: ListView.Horizontal - model: object.chunks - property var node: object + ListView { + id: chunkList + width: parent.width + height: parent.height + orientation: ListView.Horizontal + model: object.chunks + property var node: object - spacing: 3 + spacing: 3 - delegate: Label { - width: (ListView.view.width / ListView.view.model.count) -3 - height: ListView.view.height - anchors.verticalCenter: parent.verticalCenter - background: Rectangle { - color: Colors.getChunkColor(object, {"NONE": bgColor}) - radius: 3 - border.width: 2 - border.color: chunkList.node === uigraph.selectedNode ? Colors.sysPalette.text : Colors.getChunkColor(object, {"NONE": bgColor}) + delegate: Label { + width: (ListView.view.width / ListView.view.model.count) - 3 + height: ListView.view.height + anchors.verticalCenter: parent.verticalCenter + background: Rectangle { + color: Colors.getChunkColor(object, {"NONE": bgColor}) + radius: 3 + border.width: 2 + border.color: chunkList.node === uigraph.selectedNode ? Colors.sysPalette.text : Colors.getChunkColor(object, {"NONE": bgColor}) - } + } - MouseArea { - anchors.fill: parent - onPressed: { - selectNode(chunkList.node) - } + MouseArea { + anchors.fill: parent + onPressed: { + selectNode(chunkList.node) } } } + } } } } diff --git a/meshroom/ui/qml/GraphEditor/common.js b/meshroom/ui/qml/GraphEditor/common.js index 52c24976..35c754ce 100644 --- a/meshroom/ui/qml/GraphEditor/common.js +++ b/meshroom/ui/qml/GraphEditor/common.js @@ -12,21 +12,16 @@ var statusColorsExternOverrides = { "SUBMITTED": "#2196F3" } -function getChunkColor(chunk, overrides) -{ - if(overrides && chunk.statusName in overrides) - { +function getChunkColor(chunk, overrides) { + if (overrides && chunk.statusName in overrides) { return overrides[chunk.statusName] - } - else if(chunk.execModeName === "EXTERN" - && chunk.statusName in statusColorsExternOverrides) - { + } else if(chunk.execModeName === "EXTERN" + && chunk.statusName in statusColorsExternOverrides) { return statusColorsExternOverrides[chunk.statusName] - } - else if(chunk.statusName in statusColors) - { + } else if(chunk.statusName in statusColors) { return statusColors[chunk.statusName] } + console.warn("Unknown status : " + chunk.status) return "magenta" }