mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-05 20:31:56 +02:00
[qml] Optimize QML files and fix syntax warnings
This commit addresses warnings that were raised by QtCreator's linter: - IDs declared more than once - variables declared more than once in the same scope - type coercions - variables declared as "var" when their type is known - unclosed "case" in switch-case
This commit is contained in:
parent
8c2a7bba0f
commit
091346cbb8
18 changed files with 99 additions and 97 deletions
|
@ -68,7 +68,7 @@ RowLayout {
|
||||||
property Component menuComp: Menu {
|
property Component menuComp: Menu {
|
||||||
id: paramMenu
|
id: paramMenu
|
||||||
|
|
||||||
property bool isFileAttribute: attribute.type == "File"
|
property bool isFileAttribute: attribute.type === "File"
|
||||||
property bool isFilepath: isFileAttribute && Filepath.isFile(attribute.evalValue)
|
property bool isFilepath: isFileAttribute && Filepath.isFile(attribute.evalValue)
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
|
|
|
@ -86,11 +86,11 @@ RowLayout {
|
||||||
// Check if attributes are compatible to create a valid connection
|
// Check if attributes are compatible to create a valid connection
|
||||||
if( root.readOnly // cannot connect on a read-only attribute
|
if( root.readOnly // cannot connect on a read-only attribute
|
||||||
|| drag.source.objectName != inputDragTarget.objectName // not an edge connector
|
|| drag.source.objectName != inputDragTarget.objectName // not an edge connector
|
||||||
|| drag.source.baseType != inputDragTarget.baseType // not the same base type
|
|| drag.source.baseType !== inputDragTarget.baseType // not the same base type
|
||||||
|| drag.source.nodeItem == inputDragTarget.nodeItem // connection between attributes of the same node
|
|| 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 && !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.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)
|
|| 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
|
// Refuse attributes connection
|
||||||
|
@ -235,11 +235,11 @@ RowLayout {
|
||||||
onEntered: {
|
onEntered: {
|
||||||
// Check if attributes are compatible to create a valid connection
|
// Check if attributes are compatible to create a valid connection
|
||||||
if( drag.source.objectName != outputDragTarget.objectName // not an edge connector
|
if( drag.source.objectName != outputDragTarget.objectName // not an edge connector
|
||||||
|| drag.source.baseType != outputDragTarget.baseType // not the same base type
|
|| drag.source.baseType !== outputDragTarget.baseType // not the same base type
|
||||||
|| drag.source.nodeItem == outputDragTarget.nodeItem // connection between attributes of the same node
|
|| 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 && 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.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
|
|| drag.source.connectorType === "output" // refuse to connect an output pin on another one
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Refuse attributes connection
|
// Refuse attributes connection
|
||||||
|
|
|
@ -41,7 +41,7 @@ Shape {
|
||||||
startY: root.startY
|
startY: root.startY
|
||||||
fillColor: "transparent"
|
fillColor: "transparent"
|
||||||
strokeColor: "#3E3E3E"
|
strokeColor: "#3E3E3E"
|
||||||
strokeStyle: edge != undefined && ((edge.src != undefined && edge.src.isOutput) || edge.dst == undefined) ? ShapePath.SolidLine : ShapePath.DashLine
|
strokeStyle: edge !== undefined && ((edge.src !== undefined && edge.src.isOutput) || edge.dst === undefined) ? ShapePath.SolidLine : ShapePath.DashLine
|
||||||
strokeWidth: 1
|
strokeWidth: 1
|
||||||
// final visual width of this path (never below 1)
|
// final visual width of this path (never below 1)
|
||||||
readonly property real visualWidth: Math.max(strokeWidth, 1)
|
readonly property real visualWidth: Math.max(strokeWidth, 1)
|
||||||
|
|
|
@ -67,10 +67,11 @@ Item {
|
||||||
|
|
||||||
/// Duplicate a node and optionally all the following ones
|
/// Duplicate a node and optionally all the following ones
|
||||||
function duplicateNode(duplicateFollowingNodes) {
|
function duplicateNode(duplicateFollowingNodes) {
|
||||||
|
var nodes
|
||||||
if (duplicateFollowingNodes) {
|
if (duplicateFollowingNodes) {
|
||||||
var nodes = uigraph.duplicateNodesFrom(uigraph.selectedNodes)
|
nodes = uigraph.duplicateNodesFrom(uigraph.selectedNodes)
|
||||||
} else {
|
} else {
|
||||||
var nodes = uigraph.duplicateNodes(uigraph.selectedNodes)
|
nodes = uigraph.duplicateNodes(uigraph.selectedNodes)
|
||||||
}
|
}
|
||||||
uigraph.clearNodeSelection()
|
uigraph.clearNodeSelection()
|
||||||
uigraph.selectedNode = nodes[0]
|
uigraph.selectedNode = nodes[0]
|
||||||
|
@ -93,7 +94,7 @@ Item {
|
||||||
var finalPosition = undefined
|
var finalPosition = undefined
|
||||||
var centerPosition = false
|
var centerPosition = false
|
||||||
if (mouseArea.containsMouse) {
|
if (mouseArea.containsMouse) {
|
||||||
if (uigraph.hoveredNode != null) {
|
if (uigraph.hoveredNode !== null) {
|
||||||
var node = nodeDelegate(uigraph.hoveredNode)
|
var node = nodeDelegate(uigraph.hoveredNode)
|
||||||
finalPosition = Qt.point(node.mousePosition.x + node.x, node.mousePosition.y + node.y)
|
finalPosition = Qt.point(node.mousePosition.x + node.x, node.mousePosition.y + node.y)
|
||||||
} else {
|
} else {
|
||||||
|
@ -124,7 +125,7 @@ Item {
|
||||||
fit();
|
fit();
|
||||||
}
|
}
|
||||||
else if (event.key === Qt.Key_Delete) {
|
else if (event.key === Qt.Key_Delete) {
|
||||||
if (event.modifiers == Qt.AltModifier) {
|
if (event.modifiers === Qt.AltModifier) {
|
||||||
uigraph.removeNodesFrom(uigraph.selectedNodes);
|
uigraph.removeNodesFrom(uigraph.selectedNodes);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -132,15 +133,15 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.key === Qt.Key_D) {
|
else if (event.key === Qt.Key_D) {
|
||||||
duplicateNode(event.modifiers == Qt.AltModifier);
|
duplicateNode(event.modifiers === Qt.AltModifier);
|
||||||
}
|
}
|
||||||
else if (event.key === Qt.Key_C && event.modifiers == Qt.ControlModifier) {
|
else if (event.key === Qt.Key_C && event.modifiers === Qt.ControlModifier) {
|
||||||
copyNodes();
|
copyNodes();
|
||||||
}
|
}
|
||||||
else if (event.key === Qt.Key_V && event.modifiers == Qt.ControlModifier) {
|
else if (event.key === Qt.Key_V && event.modifiers === Qt.ControlModifier) {
|
||||||
pasteNodes();
|
pasteNodes();
|
||||||
}
|
}
|
||||||
else if (event.key == Qt.Key_Tab) {
|
else if (event.key === Qt.Key_Tab) {
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
if (mouseArea.containsMouse) {
|
if (mouseArea.containsMouse) {
|
||||||
newNodeMenu.spawnPosition = mouseArea.mapToItem(draggable, mouseArea.mouseX, mouseArea.mouseY);
|
newNodeMenu.spawnPosition = mouseArea.mapToItem(draggable, mouseArea.mouseX, mouseArea.mouseY);
|
||||||
|
@ -329,7 +330,7 @@ Item {
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: nodeMenuRepeater
|
id: nodeMenuRepeater
|
||||||
model: searchBar.text != "" ? Object.values(newNodeMenu.menuKeys) : undefined
|
model: searchBar.text !== "" ? Object.values(newNodeMenu.menuKeys) : undefined
|
||||||
|
|
||||||
// create Menu items from available items
|
// create Menu items from available items
|
||||||
delegate: menuItemDelegateComponent
|
delegate: menuItemDelegateComponent
|
||||||
|
@ -337,7 +338,7 @@ Item {
|
||||||
|
|
||||||
// Dynamically add the menu categories
|
// Dynamically add the menu categories
|
||||||
Instantiator {
|
Instantiator {
|
||||||
model: !(searchBar.text != "") ? Object.keys(newNodeMenu.parseCategories()).sort() : undefined
|
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)
|
onObjectRemoved: newNodeMenu.removeMenu(object)
|
||||||
|
|
||||||
|
@ -392,10 +393,10 @@ Item {
|
||||||
delegate: Edge {
|
delegate: Edge {
|
||||||
property var src: root._attributeToDelegate[edge.src]
|
property var src: root._attributeToDelegate[edge.src]
|
||||||
property var dst: root._attributeToDelegate[edge.dst]
|
property var dst: root._attributeToDelegate[edge.dst]
|
||||||
property bool isValidEdge: src != undefined && dst != undefined
|
property bool isValidEdge: src !== undefined && dst !== undefined
|
||||||
visible: isValidEdge
|
visible: isValidEdge
|
||||||
|
|
||||||
property bool inFocus: containsMouse || (edgeMenu.opened && edgeMenu.currentEdge == edge)
|
property bool inFocus: containsMouse || (edgeMenu.opened && edgeMenu.currentEdge === edge)
|
||||||
|
|
||||||
edge: object
|
edge: object
|
||||||
color: edge.dst === root.edgeAboutToBeRemoved ? "red" : inFocus ? activePalette.highlight : activePalette.text
|
color: edge.dst === root.edgeAboutToBeRemoved ? "red" : inFocus ? activePalette.highlight : activePalette.text
|
||||||
|
@ -408,7 +409,7 @@ Item {
|
||||||
onPressed: {
|
onPressed: {
|
||||||
const canEdit = !edge.dst.node.locked
|
const canEdit = !edge.dst.node.locked
|
||||||
|
|
||||||
if(event.button == Qt.RightButton)
|
if(event.button === Qt.RightButton)
|
||||||
{
|
{
|
||||||
if(canEdit && (event.modifiers & Qt.AltModifier)) {
|
if(canEdit && (event.modifiers & Qt.AltModifier)) {
|
||||||
uigraph.removeEdge(edge)
|
uigraph.removeEdge(edge)
|
||||||
|
@ -600,7 +601,7 @@ Item {
|
||||||
onAttributePinDeleted: unregisterAttributePin(attribute, pin)
|
onAttributePinDeleted: unregisterAttributePin(attribute, pin)
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
if (mouse.button == Qt.LeftButton) {
|
if (mouse.button === Qt.LeftButton) {
|
||||||
if (mouse.modifiers & Qt.ControlModifier && !(mouse.modifiers & Qt.AltModifier)) {
|
if (mouse.modifiers & Qt.ControlModifier && !(mouse.modifiers & Qt.AltModifier)) {
|
||||||
if (mainSelected && selected) {
|
if (mainSelected && selected) {
|
||||||
// left clicking a selected node twice with control will deselect it
|
// left clicking a selected node twice with control will deselect it
|
||||||
|
@ -617,7 +618,7 @@ Item {
|
||||||
} else if (!mainSelected && !selected) {
|
} else if (!mainSelected && !selected) {
|
||||||
uigraph.clearNodeSelection()
|
uigraph.clearNodeSelection()
|
||||||
}
|
}
|
||||||
} else if (mouse.button == Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
if (!mainSelected && !selected) {
|
if (!mainSelected && !selected) {
|
||||||
uigraph.clearNodeSelection()
|
uigraph.clearNodeSelection()
|
||||||
}
|
}
|
||||||
|
@ -663,7 +664,7 @@ Item {
|
||||||
// update all selected nodes positions with this node that is being dragged
|
// update all selected nodes positions with this node that is being dragged
|
||||||
for (var i = 0; i < nodeRepeater.count; i++) {
|
for (var i = 0; i < nodeRepeater.count; i++) {
|
||||||
var otherNode = nodeRepeater.itemAt(i)
|
var otherNode = nodeRepeater.itemAt(i)
|
||||||
if (uigraph.selectedNodes.contains(otherNode.node) && otherNode.node != node) {
|
if (uigraph.selectedNodes.contains(otherNode.node) && otherNode.node !== node) {
|
||||||
otherNode.x = otherNode.node.x + (x - node.x)
|
otherNode.x = otherNode.node.x + (x - node.x)
|
||||||
otherNode.y = otherNode.node.y + (y - node.y)
|
otherNode.y = otherNode.node.y + (y - node.y)
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,8 @@ Item {
|
||||||
function isFileAttributeBaseType(attribute) {
|
function isFileAttributeBaseType(attribute) {
|
||||||
// ATM, only File attributes are meant to be connected
|
// ATM, only File attributes are meant to be connected
|
||||||
// TODO: review this if we want to connect something else
|
// TODO: review this if we want to connect something else
|
||||||
return attribute.type == "File"
|
return attribute.type === "File"
|
||||||
|| (attribute.type == "ListAttribute" && attribute.desc.elementDesc.type == "File")
|
|| (attribute.type === "ListAttribute" && attribute.desc.elementDesc.type === "File")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to generate list of node's label sharing the same uid
|
// Used to generate list of node's label sharing the same uid
|
||||||
|
@ -480,22 +480,22 @@ Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
sourceComponent: AttributePin {
|
sourceComponent: AttributePin {
|
||||||
id: inPin
|
id: inParamsPin
|
||||||
nodeItem: root
|
nodeItem: root
|
||||||
property real globalX: root.x + nodeAttributes.x + inputParamsRect.x + paramLoader.x + inPin.x
|
property real globalX: root.x + nodeAttributes.x + inputParamsRect.x + paramLoader.x + inParamsPin.x
|
||||||
property real globalY: root.y + nodeAttributes.y + inputParamsRect.y + paramLoader.y + inPin.y
|
property real globalY: root.y + nodeAttributes.y + inputParamsRect.y + paramLoader.y + inParamsPin.y
|
||||||
|
|
||||||
height: isFullyActive ? childrenRect.height : 0
|
height: isFullyActive ? childrenRect.height : 0
|
||||||
Behavior on height { PropertyAnimation {easing.type: Easing.Linear} }
|
Behavior on height { PropertyAnimation {easing.type: Easing.Linear} }
|
||||||
visible: (height == childrenRect.height)
|
visible: (height == childrenRect.height)
|
||||||
attribute: object
|
attribute: object
|
||||||
readOnly: root.readOnly || object.isReadOnly
|
readOnly: root.readOnly || object.isReadOnly
|
||||||
Component.onCompleted: attributePinCreated(attribute, inPin)
|
Component.onCompleted: attributePinCreated(attribute, inParamsPin)
|
||||||
Component.onDestruction: attributePinDeleted(attribute, inPin)
|
Component.onDestruction: attributePinDeleted(attribute, inParamsPin)
|
||||||
onPressed: root.pressed(mouse)
|
onPressed: root.pressed(mouse)
|
||||||
onEdgeAboutToBeRemoved: root.edgeAboutToBeRemoved(input)
|
onEdgeAboutToBeRemoved: root.edgeAboutToBeRemoved(input)
|
||||||
onChildPinCreated: attributePinCreated(childAttribute, inPin)
|
onChildPinCreated: attributePinCreated(childAttribute, inParamsPin)
|
||||||
onChildPinDeleted: attributePinDeleted(childAttribute, inPin)
|
onChildPinDeleted: attributePinDeleted(childAttribute, inParamsPin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,9 +164,9 @@ Item {
|
||||||
Layout.preferredHeight: parent.height
|
Layout.preferredHeight: parent.height
|
||||||
horizontalAlignment: Label.AlignHCenter
|
horizontalAlignment: Label.AlignHCenter
|
||||||
verticalAlignment: Label.AlignVCenter
|
verticalAlignment: Label.AlignVCenter
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
color: object === uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
color: object === uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -182,9 +182,9 @@ Item {
|
||||||
Layout.preferredHeight: parent.height
|
Layout.preferredHeight: parent.height
|
||||||
horizontalAlignment: Label.AlignHCenter
|
horizontalAlignment: Label.AlignHCenter
|
||||||
verticalAlignment: Label.AlignVCenter
|
verticalAlignment: Label.AlignVCenter
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
color: object === uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
color: object === uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -200,9 +200,9 @@ Item {
|
||||||
Layout.preferredHeight: parent.height
|
Layout.preferredHeight: parent.height
|
||||||
horizontalAlignment: Label.AlignHCenter
|
horizontalAlignment: Label.AlignHCenter
|
||||||
verticalAlignment: Label.AlignVCenter
|
verticalAlignment: Label.AlignVCenter
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
color: object === uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
color: object === uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -218,9 +218,9 @@ Item {
|
||||||
Layout.preferredHeight: parent.height
|
Layout.preferredHeight: parent.height
|
||||||
horizontalAlignment: Label.AlignHCenter
|
horizontalAlignment: Label.AlignHCenter
|
||||||
verticalAlignment: Label.AlignVCenter
|
verticalAlignment: Label.AlignVCenter
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
color: object === uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
color: object === uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -236,9 +236,9 @@ Item {
|
||||||
Layout.preferredHeight: parent.height
|
Layout.preferredHeight: parent.height
|
||||||
horizontalAlignment: Label.AlignHCenter
|
horizontalAlignment: Label.AlignHCenter
|
||||||
verticalAlignment: Label.AlignVCenter
|
verticalAlignment: Label.AlignVCenter
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
color: object === uigraph.selectedNode ? Colors.sysPalette.window : Colors.sysPalette.text
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: object == uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
color: object === uigraph.selectedNode ? Colors.sysPalette.text : bgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -271,7 +271,7 @@ Item {
|
||||||
color: Colors.getChunkColor(object, {"NONE": bgColor})
|
color: Colors.getChunkColor(object, {"NONE": bgColor})
|
||||||
radius: 3
|
radius: 3
|
||||||
border.width: 2
|
border.width: 2
|
||||||
border.color: chunkList.node == uigraph.selectedNode ? Colors.sysPalette.text : Colors.getChunkColor(object, {"NONE": bgColor})
|
border.color: chunkList.node === uigraph.selectedNode ? Colors.sysPalette.text : Colors.getChunkColor(object, {"NONE": bgColor})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ DelegateModel {
|
||||||
function find(value, roleName) {
|
function find(value, roleName) {
|
||||||
for(var i = 0; i < filteredItems.count; ++i)
|
for(var i = 0; i < filteredItems.count; ++i)
|
||||||
{
|
{
|
||||||
if(modelData(filteredItems.get(i), roleName) == value)
|
if(modelData(filteredItems.get(i), roleName) === value)
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
|
|
|
@ -74,8 +74,8 @@ Item {
|
||||||
for (var i = 0; i < root.json.checkers.length; i++) {
|
for (var i = 0; i < root.json.checkers.length; i++) {
|
||||||
// Only load ccheckers for the current view
|
// Only load ccheckers for the current view
|
||||||
var checker = root.json.checkers[i]
|
var checker = root.json.checkers[i]
|
||||||
if (checker.viewId == viewId ||
|
if (checker.viewId === viewId ||
|
||||||
checker.imagePath == currentImagePath) {
|
checker.imagePath === currentImagePath) {
|
||||||
var cpt = Qt.createComponent("ColorCheckerEntity.qml");
|
var cpt = Qt.createComponent("ColorCheckerEntity.qml");
|
||||||
|
|
||||||
var obj = cpt.createObject(root, {
|
var obj = cpt.createObject(root, {
|
||||||
|
|
|
@ -163,14 +163,14 @@ FloatingPane {
|
||||||
editable: true
|
editable: true
|
||||||
|
|
||||||
textFromValue: function(value, locale) {
|
textFromValue: function(value, locale) {
|
||||||
if (value == -1) return "No Limit";
|
if (value === -1) return "No Limit";
|
||||||
if (value == 0) return "Disable";
|
if (value === 0) return "Disable";
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
valueFromText: function(text, locale) {
|
valueFromText: function(text, locale) {
|
||||||
if (text == "No Limit") return -1;
|
if (text === "No Limit") return -1;
|
||||||
if (text == "Disable") return 0;
|
if (text === "Disable") return 0;
|
||||||
return Number.fromLocaleString(locale, text);
|
return Number.fromLocaleString(locale, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ AliceVision.FloatImageViewer {
|
||||||
property int pointsNumber: (surface.subdivisions + 1) * (surface.subdivisions + 1);
|
property int pointsNumber: (surface.subdivisions + 1) * (surface.subdivisions + 1);
|
||||||
|
|
||||||
property int index: 0;
|
property int index: 0;
|
||||||
property var idView: 0;
|
property int idView: 0;
|
||||||
|
|
||||||
clearBeforeLoad: true
|
clearBeforeLoad: true
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ FloatingPane {
|
||||||
function getGPSCoordinates(metadata)
|
function getGPSCoordinates(metadata)
|
||||||
{
|
{
|
||||||
// GPS data available
|
// GPS data available
|
||||||
if(metadata && metadata["GPS:Longitude"] != undefined && metadata["GPS:Latitude"] != undefined)
|
if(metadata && metadata["GPS:Longitude"] !== undefined && metadata["GPS:Latitude"] !== undefined)
|
||||||
{
|
{
|
||||||
var latitude = gpsMetadataToCoordinates(metadata["GPS:Latitude"], metadata["GPS:LatitudeRef"])
|
var latitude = gpsMetadataToCoordinates(metadata["GPS:Latitude"], metadata["GPS:LatitudeRef"])
|
||||||
var longitude = gpsMetadataToCoordinates(metadata["GPS:Longitude"], metadata["GPS:LongitudeRef"])
|
var longitude = gpsMetadataToCoordinates(metadata["GPS:Longitude"], metadata["GPS:LongitudeRef"])
|
||||||
|
@ -79,11 +79,11 @@ FloatingPane {
|
||||||
var entry = {}
|
var entry = {}
|
||||||
// split on ":" to get group and key
|
// split on ":" to get group and key
|
||||||
var i = key.lastIndexOf(":")
|
var i = key.lastIndexOf(":")
|
||||||
if(i == -1)
|
if(i === -1)
|
||||||
{
|
{
|
||||||
i = key.lastIndexOf("/")
|
i = key.lastIndexOf("/")
|
||||||
}
|
}
|
||||||
if(i != -1)
|
if(i !== -1)
|
||||||
{
|
{
|
||||||
entry["group"] = key.substr(0, i)
|
entry["group"] = key.substr(0, i)
|
||||||
entry["key"] = key.substr(i+1)
|
entry["key"] = key.substr(i+1)
|
||||||
|
@ -190,7 +190,7 @@ FloatingPane {
|
||||||
sortRole: "raw"
|
sortRole: "raw"
|
||||||
filters: [{role: "raw", value: searchBar.text}]
|
filters: [{role: "raw", value: searchBar.text}]
|
||||||
delegate: RowLayout {
|
delegate: RowLayout {
|
||||||
width: parent.width
|
width: parent ? parent.width : 0
|
||||||
Label {
|
Label {
|
||||||
text: key
|
text: key
|
||||||
leftPadding: 6
|
leftPadding: 6
|
||||||
|
@ -289,7 +289,7 @@ FloatingPane {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
padding: 2
|
padding: 2
|
||||||
visible: map.center != coordinates
|
visible: map.center !== coordinates
|
||||||
|
|
||||||
ToolButton {
|
ToolButton {
|
||||||
font.family: MaterialIcons.fontFamily
|
font.family: MaterialIcons.fontFamily
|
||||||
|
|
|
@ -28,7 +28,7 @@ AliceVision.PanoramaViewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property var readyToLoad: Image.Null
|
property int readyToLoad: Image.Null
|
||||||
|
|
||||||
property int subdivisionsPano: 12
|
property int subdivisionsPano: 12
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ AliceVision.PanoramaViewer {
|
||||||
|
|
||||||
property bool cropFisheyePano: false
|
property bool cropFisheyePano: false
|
||||||
|
|
||||||
property var idSelected : -1
|
property int idSelected : -1
|
||||||
|
|
||||||
onIsHighlightableChanged:{
|
onIsHighlightableChanged:{
|
||||||
for (var i = 0; i < repeater.model; ++i) {
|
for (var i = 0; i < repeater.model; ++i) {
|
||||||
|
@ -53,26 +53,26 @@ AliceVision.PanoramaViewer {
|
||||||
property alias containsMouse: mouseAreaPano.containsMouse
|
property alias containsMouse: mouseAreaPano.containsMouse
|
||||||
|
|
||||||
property bool isRotating: false
|
property bool isRotating: false
|
||||||
property var lastX : 0
|
property double lastX : 0
|
||||||
property var lastY: 0
|
property double lastY: 0
|
||||||
|
|
||||||
property var xStart : 0
|
property double xStart : 0
|
||||||
property var yStart : 0
|
property double yStart : 0
|
||||||
|
|
||||||
property var previous_yaw: 0;
|
property double previous_yaw: 0;
|
||||||
property var previous_pitch: 0;
|
property double previous_pitch: 0;
|
||||||
property var previous_roll: 0;
|
property double previous_roll: 0;
|
||||||
|
|
||||||
property double yaw: 0;
|
property double yaw: 0;
|
||||||
property double pitch: 0;
|
property double pitch: 0;
|
||||||
property double roll: 0;
|
property double roll: 0;
|
||||||
|
|
||||||
property var activeNode: _reconstruction.activeNodes.get('SfMTransform').node
|
property var activeNode: _reconstruction.activeNodes.get('SfMTransform').node;
|
||||||
|
|
||||||
// Yaw and Pitch in Degrees from SfMTransform node sliders
|
// Yaw and Pitch in Degrees from SfMTransform node sliders
|
||||||
property int yawNode: activeNode.attribute("manualTransform.manualRotation.y").value;
|
property double yawNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.y").value : 0;
|
||||||
property int pitchNode: activeNode.attribute("manualTransform.manualRotation.x").value;
|
property double pitchNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.x").value : 0;
|
||||||
property int rollNode: activeNode.attribute("manualTransform.manualRotation.z").value;
|
property double rollNode: activeNode ? activeNode.attribute("manualTransform.manualRotation.z").value : 0;
|
||||||
|
|
||||||
//Convert angle functions
|
//Convert angle functions
|
||||||
function toDegrees(radians){
|
function toDegrees(radians){
|
||||||
|
@ -137,9 +137,7 @@ AliceVision.PanoramaViewer {
|
||||||
// Rotate Panorama
|
// Rotate Panorama
|
||||||
if (isRotating && isEditable) {
|
if (isRotating && isEditable) {
|
||||||
|
|
||||||
var nx = Math.max(0, mouse.x)
|
|
||||||
var nx = Math.min(width - 1, mouse.x)
|
var nx = Math.min(width - 1, mouse.x)
|
||||||
var ny = Math.max(0, mouse.y)
|
|
||||||
var ny = Math.min(height - 1, mouse.y)
|
var ny = Math.min(height - 1, mouse.y)
|
||||||
|
|
||||||
var xoffset = nx - lastX;
|
var xoffset = nx - lastX;
|
||||||
|
@ -156,17 +154,18 @@ AliceVision.PanoramaViewer {
|
||||||
var end_pt = Qt.vector2d(latitude_end, longitude_end)
|
var end_pt = Qt.vector2d(latitude_end, longitude_end)
|
||||||
|
|
||||||
var previous_euler = Qt.vector3d(previous_yaw, previous_pitch, previous_roll)
|
var previous_euler = Qt.vector3d(previous_yaw, previous_pitch, previous_roll)
|
||||||
|
var result
|
||||||
|
|
||||||
if (mouse.modifiers & Qt.ControlModifier)
|
if (mouse.modifiers & Qt.ControlModifier)
|
||||||
{
|
{
|
||||||
var result = Transformations3DHelper.updatePanoramaInPlane(previous_euler, start_pt, end_pt)
|
result = Transformations3DHelper.updatePanoramaInPlane(previous_euler, start_pt, end_pt)
|
||||||
root.pitch = result.x
|
root.pitch = result.x
|
||||||
root.yaw = result.y
|
root.yaw = result.y
|
||||||
root.roll = result.z
|
root.roll = result.z
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = Transformations3DHelper.updatePanorama(previous_euler, start_pt, end_pt)
|
result = Transformations3DHelper.updatePanorama(previous_euler, start_pt, end_pt)
|
||||||
root.pitch = result.x
|
root.pitch = result.x
|
||||||
root.yaw = result.y
|
root.yaw = result.y
|
||||||
root.roll = result.z
|
root.roll = result.z
|
||||||
|
|
|
@ -99,7 +99,7 @@ FocusScope {
|
||||||
|
|
||||||
// slots
|
// slots
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
if(event.key == Qt.Key_F) {
|
if(event.key === Qt.Key_F) {
|
||||||
root.fit();
|
root.fit();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ FocusScope {
|
||||||
// make sure the image is ready for use
|
// make sure the image is ready for use
|
||||||
if(!imgContainer.image)
|
if(!imgContainer.image)
|
||||||
return;
|
return;
|
||||||
if(imgContainer.image.status != Image.Ready)
|
if(imgContainer.image.status !== Image.Ready)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// for Exif orientation tags 5 to 8, a 90 degrees rotation is applied
|
// for Exif orientation tags 5 to 8, a 90 degrees rotation is applied
|
||||||
|
@ -225,7 +225,7 @@ FocusScope {
|
||||||
return "";
|
return "";
|
||||||
for (var i = 0; i < node.attributes.count; i++) {
|
for (var i = 0; i < node.attributes.count; i++) {
|
||||||
var attr = node.attributes.at(i);
|
var attr = node.attributes.at(i);
|
||||||
if (attr.name == attrName) {
|
if (attr.name === attrName) {
|
||||||
let path = String(attr.value)
|
let path = String(attr.value)
|
||||||
for (var key in patterns) {
|
for (var key in patterns) {
|
||||||
if (patterns.hasOwnProperty(key)) {
|
if (patterns.hasOwnProperty(key)) {
|
||||||
|
@ -333,7 +333,7 @@ FocusScope {
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if(floatImageViewerLoader.item.containsMouse == false)
|
if(floatImageViewerLoader.item.containsMouse === false)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -389,9 +389,9 @@ FocusScope {
|
||||||
orientationTag: imgContainer.orientationTag
|
orientationTag: imgContainer.orientationTag
|
||||||
xOrigin: imgContainer.width / 2
|
xOrigin: imgContainer.width / 2
|
||||||
yOrigin: imgContainer.height / 2
|
yOrigin: imgContainer.height / 2
|
||||||
property var fittedOnce: false
|
property bool fittedOnce: false
|
||||||
property var previousWidth: 0
|
property int previousWidth: 0
|
||||||
property var previousHeight: 0
|
property int previousHeight: 0
|
||||||
onHeightChanged: {
|
onHeightChanged: {
|
||||||
/* Image size is not updated through a single signal with the floatImage viewer, unlike
|
/* Image size is not updated through a single signal with the floatImage viewer, unlike
|
||||||
* the simple QML image viewer: instead of updating straight away the width and height to x and
|
* the simple QML image viewer: instead of updating straight away the width and height to x and
|
||||||
|
@ -404,7 +404,7 @@ FocusScope {
|
||||||
* group has already been auto-fitted. If we change the group of images (when another project is
|
* group has already been auto-fitted. If we change the group of images (when another project is
|
||||||
* opened, for example, and the images have a different size), then another auto-fit needs to be
|
* opened, for example, and the images have a different size), then another auto-fit needs to be
|
||||||
* performed */
|
* performed */
|
||||||
if ((!fittedOnce && imgContainer.image.status == Image.Ready && imgContainer.image.height > 0) ||
|
if ((!fittedOnce && imgContainer.image && imgContainer.image.status === Image.Ready && imgContainer.image.height > 0) ||
|
||||||
(fittedOnce && ((width > 1 && previousWidth != width) || (height > 1 && previousHeight != height)))) {
|
(fittedOnce && ((width > 1 && previousWidth != width) || (height > 1 && previousHeight != height)))) {
|
||||||
fit();
|
fit();
|
||||||
fittedOnce = true;
|
fittedOnce = true;
|
||||||
|
@ -1135,7 +1135,7 @@ FocusScope {
|
||||||
font.pointSize: 11
|
font.pointSize: 11
|
||||||
Layout.minimumWidth: 0
|
Layout.minimumWidth: 0
|
||||||
checkable: true
|
checkable: true
|
||||||
enabled: activeNode && activeNode.isComputed && _reconstruction.selectedViewId != -1
|
enabled: activeNode && activeNode.isComputed && _reconstruction.selectedViewId !== -1
|
||||||
checked: false
|
checked: false
|
||||||
visible: activeNode
|
visible: activeNode
|
||||||
onEnabledChanged: {
|
onEnabledChanged: {
|
||||||
|
|
|
@ -63,10 +63,11 @@ Entity {
|
||||||
currentPosition.x = mouse.x;
|
currentPosition.x = mouse.x;
|
||||||
currentPosition.y = mouse.y;
|
currentPosition.y = mouse.y;
|
||||||
|
|
||||||
const dt = 0.02
|
const dt = 0.02;
|
||||||
|
var d;
|
||||||
|
|
||||||
if(panning) { // translate
|
if(panning) { // translate
|
||||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03;
|
d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03;
|
||||||
var tx = axisMX.value * root.translateSpeed * d;
|
var tx = axisMX.value * root.translateSpeed * d;
|
||||||
var ty = axisMY.value * root.translateSpeed * d;
|
var ty = axisMY.value * root.translateSpeed * d;
|
||||||
mouseHandler.hasMoved = true;
|
mouseHandler.hasMoved = true;
|
||||||
|
@ -80,7 +81,7 @@ Entity {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(zooming) { // zoom with alt + RMD
|
if(zooming) { // zoom with alt + RMD
|
||||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.1;
|
d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.1;
|
||||||
var tz = axisMX.value * root.translateSpeed * d;
|
var tz = axisMX.value * root.translateSpeed * d;
|
||||||
mouseHandler.hasMoved = true;
|
mouseHandler.hasMoved = true;
|
||||||
root.camera.translate(Qt.vector3d(0, 0, tz).times(dt), Camera.DontTranslateViewCenter)
|
root.camera.translate(Qt.vector3d(0, 0, tz).times(dt), Camera.DontTranslateViewCenter)
|
||||||
|
|
|
@ -344,12 +344,12 @@ FloatingPane {
|
||||||
text: model.label
|
text: model.label
|
||||||
opacity: model.valid ? 1.0 : 0.6
|
opacity: model.valid ? 1.0 : 0.6
|
||||||
elide: Text.ElideMiddle
|
elide: Text.ElideMiddle
|
||||||
font.weight: mediaListView.currentIndex == index ? Font.DemiBold : Font.Normal
|
font.weight: mediaListView.currentIndex === index ? Font.DemiBold : Font.Normal
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
Connections {
|
Connections {
|
||||||
target: mediaLibrary
|
target: mediaLibrary
|
||||||
function onLoadRequest(idx) {
|
function onLoadRequest(idx) {
|
||||||
if(idx == index)
|
if(idx === index)
|
||||||
focusAnim.restart()
|
focusAnim.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ Entity {
|
||||||
return
|
return
|
||||||
for(var i=0; i < entity.components.length; ++i)
|
for(var i=0; i < entity.components.length; ++i)
|
||||||
{
|
{
|
||||||
if(entity.components[i].toString().indexOf(type) != -1)
|
if(entity.components[i].toString().indexOf(type) !== -1)
|
||||||
{
|
{
|
||||||
//entity.components[i].enabled = false;
|
//entity.components[i].enabled = false;
|
||||||
Scene3DHelper.removeComponent(entity, entity.components[i]);
|
Scene3DHelper.removeComponent(entity, entity.components[i]);
|
||||||
|
|
|
@ -88,7 +88,7 @@ FocusScope {
|
||||||
]
|
]
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
if (event.key == Qt.Key_F) {
|
if (event.key === Qt.Key_F) {
|
||||||
resetCameraPosition();
|
resetCameraPosition();
|
||||||
}
|
}
|
||||||
else if(Qt.Key_1 <= event.key && event.key < Qt.Key_1 + Viewer3DSettings.renderModes.length)
|
else if(Qt.Key_1 <= event.key && event.key < Qt.Key_1 + Viewer3DSettings.renderModes.length)
|
||||||
|
@ -168,7 +168,7 @@ FocusScope {
|
||||||
focus: scene3D.activeFocus
|
focus: scene3D.activeFocus
|
||||||
onMousePressed: {
|
onMousePressed: {
|
||||||
scene3D.forceActiveFocus()
|
scene3D.forceActiveFocus()
|
||||||
if(mouse.button == Qt.LeftButton)
|
if(mouse.button === Qt.LeftButton)
|
||||||
{
|
{
|
||||||
if(!doubleClickTimer.running)
|
if(!doubleClickTimer.running)
|
||||||
doubleClickTimer.restart()
|
doubleClickTimer.restart()
|
||||||
|
@ -179,7 +179,7 @@ FocusScope {
|
||||||
onMouseReleased: {
|
onMouseReleased: {
|
||||||
if(moving)
|
if(moving)
|
||||||
return
|
return
|
||||||
if(!moved && mouse.button == Qt.RightButton)
|
if(!moved && mouse.button === Qt.RightButton)
|
||||||
{
|
{
|
||||||
contextMenu.popup()
|
contextMenu.popup()
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ FocusScope {
|
||||||
]
|
]
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
if(pick.button == Qt.LeftButton)
|
if(pick.button === Qt.LeftButton)
|
||||||
{
|
{
|
||||||
mainCamera.viewCenter = pick.worldIntersection;
|
mainCamera.viewCenter = pick.worldIntersection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ ApplicationWindow {
|
||||||
{
|
{
|
||||||
saveFileDialog.open()
|
saveFileDialog.open()
|
||||||
function _callbackWrapper(rc) {
|
function _callbackWrapper(rc) {
|
||||||
if(rc == Platform.Dialog.Accepted)
|
if(rc === Platform.Dialog.Accepted)
|
||||||
fireCallback()
|
fireCallback()
|
||||||
saveFileDialog.closed.disconnect(_callbackWrapper)
|
saveFileDialog.closed.disconnect(_callbackWrapper)
|
||||||
}
|
}
|
||||||
|
@ -277,6 +277,7 @@ ApplicationWindow {
|
||||||
case "Compatibility Issue": {
|
case "Compatibility Issue": {
|
||||||
close()
|
close()
|
||||||
compatibilityManager.open()
|
compatibilityManager.open()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
default: close()
|
default: close()
|
||||||
}
|
}
|
||||||
|
@ -577,7 +578,7 @@ ApplicationWindow {
|
||||||
Menu {
|
Menu {
|
||||||
id: newPipelineMenu
|
id: newPipelineMenu
|
||||||
title: "New Pipeline"
|
title: "New Pipeline"
|
||||||
enabled: newPipelineMenuItems.model != undefined && newPipelineMenuItems.model.length > 0
|
enabled: newPipelineMenuItems.model !== undefined && newPipelineMenuItems.model.length > 0
|
||||||
property int maxWidth: 1000
|
property int maxWidth: 1000
|
||||||
property int fullWidth: {
|
property int fullWidth: {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
@ -621,7 +622,7 @@ ApplicationWindow {
|
||||||
Menu {
|
Menu {
|
||||||
id: openRecentMenu
|
id: openRecentMenu
|
||||||
title: "Open Recent"
|
title: "Open Recent"
|
||||||
enabled: recentFilesMenuItems.model != undefined && recentFilesMenuItems.model.length > 0
|
enabled: recentFilesMenuItems.model !== undefined && recentFilesMenuItems.model.length > 0
|
||||||
property int maxWidth: 1000
|
property int maxWidth: 1000
|
||||||
property int fullWidth: {
|
property int fullWidth: {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
@ -961,7 +962,7 @@ ApplicationWindow {
|
||||||
// 3D viewer
|
// 3D viewer
|
||||||
for (var i = 0; i < node.attributes.count; i++) {
|
for (var i = 0; i < node.attributes.count; i++) {
|
||||||
var attr = node.attributes.at(i)
|
var attr = node.attributes.at(i)
|
||||||
if(attr.isOutput && attr.desc.semantic != "image" && workspaceView.viewIn3D(attr, mouse))
|
if(attr.isOutput && attr.desc.semantic !== "image" && workspaceView.viewIn3D(attr, mouse))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue