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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,9 @@ Panel {
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,12 +250,12 @@ 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);
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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: {
|
||||||
|
@ -807,33 +793,33 @@ Panel {
|
||||||
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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,33 +837,33 @@ Panel {
|
||||||
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
|
||||||
|
@ -176,7 +175,7 @@ RowLayout {
|
||||||
readOnly: root.readOnly
|
readOnly: root.readOnly
|
||||||
enabled: !readOnly
|
enabled: !readOnly
|
||||||
|
|
||||||
clip: true;
|
clip: true
|
||||||
|
|
||||||
autoScroll: activeFocus
|
autoScroll: activeFocus
|
||||||
|
|
||||||
|
@ -208,5 +207,4 @@ RowLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,7 @@ 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]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue