mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
[ImageGallery] Clean-up: Harmonize syntax across all files
This commit is contained in:
parent
2908aa94a3
commit
2bdf061d2e
4 changed files with 76 additions and 93 deletions
|
@ -36,10 +36,10 @@ Item {
|
||||||
// update thumbnail location
|
// update thumbnail location
|
||||||
// can be called from the GridView when a new thumbnail has been written on disk
|
// can be called from the GridView when a new thumbnail has been written on disk
|
||||||
function updateThumbnail() {
|
function updateThumbnail() {
|
||||||
thumbnail.source = ThumbnailCache.thumbnail(root.source, root.cellID);
|
thumbnail.source = ThumbnailCache.thumbnail(root.source, root.cellID)
|
||||||
}
|
}
|
||||||
onSourceChanged: {
|
onSourceChanged: {
|
||||||
updateThumbnail();
|
updateThumbnail()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a new request after 5 seconds if thumbnail is not loaded
|
// Send a new request after 5 seconds if thumbnail is not loaded
|
||||||
|
@ -49,7 +49,7 @@ Item {
|
||||||
running: true
|
running: true
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (thumbnail.status == Image.Null) {
|
if (thumbnail.status == Image.Null) {
|
||||||
updateThumbnail();
|
updateThumbnail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,35 +78,33 @@ Panel {
|
||||||
|
|
||||||
function parseIntr() {
|
function parseIntr() {
|
||||||
parsedIntrinsic = []
|
parsedIntrinsic = []
|
||||||
if(!m.intrinsics) {
|
if (!m.intrinsics) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//Loop through all intrinsics
|
// Loop through all intrinsics
|
||||||
for(var i = 0; i < m.intrinsics.count; ++i) {
|
for (var i = 0; i < m.intrinsics.count; ++i) {
|
||||||
var intrinsic = {}
|
var intrinsic = {}
|
||||||
|
|
||||||
//Loop through all attributes
|
// Loop through all attributes
|
||||||
for(var j=0; j < m.intrinsics.at(i).value.count; ++j) {
|
for (var j = 0; j < m.intrinsics.at(i).value.count; ++j) {
|
||||||
var currentAttribute = m.intrinsics.at(i).value.at(j)
|
var currentAttribute = m.intrinsics.at(i).value.at(j)
|
||||||
if(currentAttribute.type === "GroupAttribute") {
|
if (currentAttribute.type === "GroupAttribute") {
|
||||||
for(var k=0; k < currentAttribute.value.count; ++k) {
|
for (var k = 0; k < currentAttribute.value.count; ++k) {
|
||||||
intrinsic[currentAttribute.name + "." + currentAttribute.value.at(k).name] = currentAttribute.value.at(k)
|
intrinsic[currentAttribute.name + "." + currentAttribute.value.at(k).name] = currentAttribute.value.at(k)
|
||||||
}
|
}
|
||||||
}
|
} else if (currentAttribute.type === "ListAttribute") {
|
||||||
else if(currentAttribute.type === "ListAttribute") {
|
|
||||||
// not needed for now
|
// not needed for now
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
intrinsic[currentAttribute.name] = currentAttribute
|
intrinsic[currentAttribute.name] = currentAttribute
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Table Model needs to contain an entry for each column.
|
// Table Model needs to contain an entry for each column.
|
||||||
// In case of old file formats, some intrinsic keys that we display may not exist in the model.
|
// In case of old file formats, some intrinsic keys that we display may not exist in the model.
|
||||||
// So, here we create an empty entry to enforce that the key exists in the model.
|
// So, here we create an empty entry to enforce that the key exists in the model.
|
||||||
for(var n = 0; n < intrinsicModel.columnNames.length; ++n) {
|
for (var n = 0; n < intrinsicModel.columnNames.length; ++n) {
|
||||||
var name = intrinsicModel.columnNames[n]
|
var name = intrinsicModel.columnNames[n]
|
||||||
if(!(name in intrinsic)) {
|
if (!(name in intrinsic)) {
|
||||||
intrinsic[name] = {}
|
intrinsic[name] = {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,14 +217,14 @@ Panel {
|
||||||
function onThumbnailCreated(imgSource, callerID) {
|
function onThumbnailCreated(imgSource, callerID) {
|
||||||
let item = grid.itemAtIndex(callerID); // item is an ImageDelegate
|
let item = grid.itemAtIndex(callerID); // item is an ImageDelegate
|
||||||
if (item && item.source === imgSource) {
|
if (item && item.source === imgSource) {
|
||||||
item.updateThumbnail();
|
item.updateThumbnail()
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
// fallback in case the ImageDelegate cellID changed
|
// fallback in case the ImageDelegate cellID changed
|
||||||
for (let idx = 0; idx < grid.count; idx++) {
|
for (let idx = 0; idx < grid.count; idx++) {
|
||||||
item = grid.itemAtIndex(idx);
|
item = grid.itemAtIndex(idx)
|
||||||
if (item && item.source === imgSource) {
|
if (item && item.source === imgSource) {
|
||||||
item.updateThumbnail();
|
item.updateThumbnail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,18 +250,18 @@ Panel {
|
||||||
|
|
||||||
// override modelData to return basename of viewpoint's path for sorting
|
// override modelData to return basename of viewpoint's path for sorting
|
||||||
function modelData(item, roleName_) {
|
function modelData(item, roleName_) {
|
||||||
var roleNameAndCmd = roleName_.split(".");
|
var roleNameAndCmd = roleName_.split(".")
|
||||||
var roleName = roleName_;
|
var roleName = roleName_
|
||||||
var cmd = "";
|
var cmd = ""
|
||||||
if(roleNameAndCmd.length >= 2) {
|
if (roleNameAndCmd.length >= 2) {
|
||||||
roleName = roleNameAndCmd[0];
|
roleName = roleNameAndCmd[0]
|
||||||
cmd = roleNameAndCmd[1];
|
cmd = roleNameAndCmd[1]
|
||||||
}
|
}
|
||||||
if(cmd == "isReconstructed")
|
if (cmd == "isReconstructed")
|
||||||
return _reconstruction.isReconstructed(item.model.object);
|
return _reconstruction.isReconstructed(item.model.object);
|
||||||
|
|
||||||
var value = item.model.object.childAttribute(roleName).value;
|
var value = item.model.object.childAttribute(roleName).value;
|
||||||
if(cmd == "basename")
|
if (cmd == "basename")
|
||||||
return Filepath.basename(value);
|
return Filepath.basename(value);
|
||||||
if (cmd == "asString")
|
if (cmd == "asString")
|
||||||
return value.toString();
|
return value.toString();
|
||||||
|
@ -374,43 +372,28 @@ Panel {
|
||||||
// Keyboard shortcut to change current image group
|
// Keyboard shortcut to change current image group
|
||||||
Keys.priority: Keys.BeforeItem
|
Keys.priority: Keys.BeforeItem
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
if(event.modifiers & Qt.AltModifier)
|
if (event.modifiers & Qt.AltModifier) {
|
||||||
{
|
if (event.key === Qt.Key_Right) {
|
||||||
if(event.key === Qt.Key_Right)
|
|
||||||
{
|
|
||||||
_reconstruction.cameraInitIndex = Math.min(root.cameraInits.count - 1, root.cameraInitIndex + 1)
|
_reconstruction.cameraInitIndex = Math.min(root.cameraInits.count - 1, root.cameraInitIndex + 1)
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
} else if (event.key === Qt.Key_Left) {
|
||||||
else if(event.key === Qt.Key_Left)
|
|
||||||
{
|
|
||||||
_reconstruction.cameraInitIndex = Math.max(0, root.cameraInitIndex - 1)
|
_reconstruction.cameraInitIndex = Math.max(0, root.cameraInitIndex - 1)
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (event.key === Qt.Key_Right) {
|
||||||
{
|
|
||||||
if(event.key === Qt.Key_Right)
|
|
||||||
{
|
|
||||||
grid.moveCurrentIndexRight()
|
grid.moveCurrentIndexRight()
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
} else if (event.key === Qt.Key_Left) {
|
||||||
else if(event.key === Qt.Key_Left)
|
|
||||||
{
|
|
||||||
grid.moveCurrentIndexLeft()
|
grid.moveCurrentIndexLeft()
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
} else if (event.key === Qt.Key_Up) {
|
||||||
else if(event.key === Qt.Key_Up)
|
|
||||||
{
|
|
||||||
grid.moveCurrentIndexUp()
|
grid.moveCurrentIndexUp()
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
} else if (event.key === Qt.Key_Down) {
|
||||||
else if(event.key === Qt.Key_Down)
|
|
||||||
{
|
|
||||||
grid.moveCurrentIndexDown()
|
grid.moveCurrentIndexDown()
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
} else if (event.key === Qt.Key_Tab) {
|
||||||
else if (event.key === Qt.Key_Tab)
|
|
||||||
{
|
|
||||||
searchBar.forceActiveFocus()
|
searchBar.forceActiveFocus()
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
|
@ -513,7 +496,7 @@ Panel {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onPressed: {
|
onPressed: {
|
||||||
if(mouse.button == Qt.LeftButton)
|
if (mouse.button == Qt.LeftButton)
|
||||||
grid.forceActiveFocus()
|
grid.forceActiveFocus()
|
||||||
mouse.accepted = false
|
mouse.accepted = false
|
||||||
}
|
}
|
||||||
|
@ -611,7 +594,10 @@ Panel {
|
||||||
enabled: nodesCB.currentIndex > 0
|
enabled: nodesCB.currentIndex > 0
|
||||||
onClicked: nodesCB.decrementCurrentIndex()
|
onClicked: nodesCB.decrementCurrentIndex()
|
||||||
}
|
}
|
||||||
Label { id: groupLabel; text: "Group " }
|
Label {
|
||||||
|
id: groupLabel
|
||||||
|
text: "Group "
|
||||||
|
}
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: nodesCB
|
id: nodesCB
|
||||||
model: {
|
model: {
|
||||||
|
@ -718,8 +704,8 @@ Panel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEnabledChanged: {
|
onEnabledChanged: {
|
||||||
if(!enabled) {
|
if (!enabled) {
|
||||||
if(checked)
|
if (checked)
|
||||||
inputImagesFilterButton.checked = true
|
inputImagesFilterButton.checked = true
|
||||||
checked = false
|
checked = false
|
||||||
}
|
}
|
||||||
|
@ -751,8 +737,8 @@ Panel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEnabledChanged: {
|
onEnabledChanged: {
|
||||||
if(!enabled) {
|
if (!enabled) {
|
||||||
if(checked)
|
if (checked)
|
||||||
inputImagesFilterButton.checked = true
|
inputImagesFilterButton.checked = true
|
||||||
checked = false
|
checked = false
|
||||||
}
|
}
|
||||||
|
@ -782,8 +768,8 @@ Panel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEnabledChanged: {
|
onEnabledChanged: {
|
||||||
if(!enabled) {
|
if (!enabled) {
|
||||||
if(checked)
|
if (checked)
|
||||||
inputImagesFilterButton.checked = true
|
inputImagesFilterButton.checked = true
|
||||||
checked = false
|
checked = false
|
||||||
}
|
}
|
||||||
|
@ -806,34 +792,34 @@ Panel {
|
||||||
enabled: activeNode && activeNode.isComputed && (m.viewpoints ? m.viewpoints.count > 0 : false)
|
enabled: activeNode && activeNode.isComputed && (m.viewpoints ? m.viewpoints.count > 0 : false)
|
||||||
property string nodeID: activeNode ? (activeNode.label + activeNode.isComputed) : ""
|
property string nodeID: activeNode ? (activeNode.label + activeNode.isComputed) : ""
|
||||||
onNodeIDChanged: {
|
onNodeIDChanged: {
|
||||||
if(checked) {
|
if (checked) {
|
||||||
open();
|
open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEnabledChanged: {
|
onEnabledChanged: {
|
||||||
// Reset the toggle to avoid getting stuck
|
// Reset the toggle to avoid getting stuck
|
||||||
// with the HDR node checked but disabled.
|
// with the HDR node checked but disabled.
|
||||||
if(checked) {
|
if (checked) {
|
||||||
checked = false;
|
checked = false
|
||||||
close();
|
close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: false
|
checked: false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(checked) {
|
if (checked) {
|
||||||
open();
|
open()
|
||||||
} else {
|
} else {
|
||||||
close();
|
close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function open() {
|
function open() {
|
||||||
if(imageProcessing.checked)
|
if (imageProcessing.checked)
|
||||||
imageProcessing.checked = false;
|
imageProcessing.checked = false
|
||||||
_reconstruction.setupTempCameraInit(activeNode, "outSfMData");
|
_reconstruction.setupTempCameraInit(activeNode, "outSfMData")
|
||||||
}
|
}
|
||||||
function close() {
|
function close() {
|
||||||
_reconstruction.clearTempCameraInit();
|
_reconstruction.clearTempCameraInit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -850,34 +836,34 @@ Panel {
|
||||||
enabled: activeNode && activeNode.isComputed
|
enabled: activeNode && activeNode.isComputed
|
||||||
property string nodeID: activeNode ? (activeNode.label + activeNode.isComputed) : ""
|
property string nodeID: activeNode ? (activeNode.label + activeNode.isComputed) : ""
|
||||||
onNodeIDChanged: {
|
onNodeIDChanged: {
|
||||||
if(checked) {
|
if (checked) {
|
||||||
open();
|
open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEnabledChanged: {
|
onEnabledChanged: {
|
||||||
// Reset the toggle to avoid getting stuck
|
// Reset the toggle to avoid getting stuck
|
||||||
// with the HDR node checked but disabled.
|
// with the HDR node checked but disabled.
|
||||||
if(checked) {
|
if (checked) {
|
||||||
checked = false;
|
checked = false
|
||||||
close();
|
close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: false
|
checked: false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(checked) {
|
if (checked) {
|
||||||
open();
|
open()
|
||||||
} else {
|
} else {
|
||||||
close();
|
close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function open() {
|
function open() {
|
||||||
if(displayHDR.checked)
|
if (displayHDR.checked)
|
||||||
displayHDR.checked = false;
|
displayHDR.checked = false
|
||||||
_reconstruction.setupTempCameraInit(activeNode, "outSfMData");
|
_reconstruction.setupTempCameraInit(activeNode, "outSfMData")
|
||||||
}
|
}
|
||||||
function close() {
|
function close() {
|
||||||
_reconstruction.clearTempCameraInit();
|
_reconstruction.clearTempCameraInit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,7 @@ RowLayout {
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if (!attribute)
|
if (!attribute)
|
||||||
return undefined
|
return undefined
|
||||||
switch (attribute.type)
|
switch (attribute.type) {
|
||||||
{
|
|
||||||
case "ChoiceParam": return choice_component
|
case "ChoiceParam": return choice_component
|
||||||
case "IntParam": return int_component
|
case "IntParam": return int_component
|
||||||
case "FloatParam": return float_component
|
case "FloatParam": return float_component
|
||||||
|
@ -115,7 +114,7 @@ RowLayout {
|
||||||
_reconstruction.setAttribute(attribute, Number(text))
|
_reconstruction.setAttribute(attribute, Number(text))
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
if(activeFocus)
|
if (activeFocus)
|
||||||
_reconstruction.setAttribute(attribute, Number(text))
|
_reconstruction.setAttribute(attribute, Number(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +175,7 @@ RowLayout {
|
||||||
readOnly: root.readOnly
|
readOnly: root.readOnly
|
||||||
enabled: !readOnly
|
enabled: !readOnly
|
||||||
|
|
||||||
clip: true;
|
clip: true
|
||||||
|
|
||||||
autoScroll: activeFocus
|
autoScroll: activeFocus
|
||||||
|
|
||||||
|
@ -203,10 +202,9 @@ RowLayout {
|
||||||
_reconstruction.setAttribute(attribute, Number(text))
|
_reconstruction.setAttribute(attribute, Number(text))
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
if(activeFocus)
|
if (activeFocus)
|
||||||
_reconstruction.setAttribute(attribute, Number(text))
|
_reconstruction.setAttribute(attribute, Number(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,8 @@ ImageBadge {
|
||||||
|
|
||||||
function findMetadata(key) {
|
function findMetadata(key) {
|
||||||
var keyLower = key.toLowerCase()
|
var keyLower = key.toLowerCase()
|
||||||
for(var mKey in metadata)
|
for (var mKey in metadata) {
|
||||||
{
|
if (mKey.toLowerCase().endsWith(keyLower))
|
||||||
if(mKey.toLowerCase().endsWith(keyLower))
|
|
||||||
return metadata[mKey]
|
return metadata[mKey]
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue