mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-31 18:06:31 +02:00
[qml] Clean-up: Harmonize syntax across all files
This commit is contained in:
parent
e9d80611c7
commit
e463f0dce2
6 changed files with 99 additions and 94 deletions
|
@ -14,7 +14,11 @@ Dialog {
|
||||||
|
|
||||||
// Fade in transition
|
// Fade in transition
|
||||||
enter: Transition {
|
enter: Transition {
|
||||||
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
|
NumberAnimation {
|
||||||
|
property: "opacity"
|
||||||
|
from: 0.0
|
||||||
|
to: 1.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
modal: true
|
modal: true
|
||||||
|
|
|
@ -19,14 +19,13 @@ ToolButton {
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: {
|
color: {
|
||||||
if(pressed || checked || hovered)
|
if (pressed || checked || hovered) {
|
||||||
{
|
|
||||||
if (pressed || checked)
|
if (pressed || checked)
|
||||||
return Qt.darker(parent.palette.base, 1.3)
|
return Qt.darker(parent.palette.base, 1.3)
|
||||||
if (hovered)
|
if (hovered)
|
||||||
return Qt.darker(parent.palette.base, 0.6)
|
return Qt.darker(parent.palette.base, 0.6)
|
||||||
}
|
}
|
||||||
return "transparent";
|
return "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
border.color: checked ? Qt.darker(parent.palette.base, 1.4) : "transparent"
|
border.color: checked ? Qt.darker(parent.palette.base, 1.4) : "transparent"
|
||||||
|
|
|
@ -36,14 +36,13 @@ ToolButton {
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: {
|
color: {
|
||||||
if(pressed || checked || hovered)
|
if (pressed || checked || hovered) {
|
||||||
{
|
|
||||||
if (pressed || checked)
|
if (pressed || checked)
|
||||||
return Qt.darker(parent.palette.base, 1.3)
|
return Qt.darker(parent.palette.base, 1.3)
|
||||||
if (hovered)
|
if (hovered)
|
||||||
return Qt.darker(parent.palette.base, 0.6)
|
return Qt.darker(parent.palette.base, 0.6)
|
||||||
}
|
}
|
||||||
return "transparent";
|
return "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
border.color: checked ? Qt.darker(parent.palette.base, 1.4) : "transparent"
|
border.color: checked ? Qt.darker(parent.palette.base, 1.4) : "transparent"
|
||||||
|
|
|
@ -33,7 +33,7 @@ Item {
|
||||||
// Load a 3D media file in the 3D viewer
|
// Load a 3D media file in the 3D viewer
|
||||||
function load3DMedia(filepath, label = undefined) {
|
function load3DMedia(filepath, label = undefined) {
|
||||||
if (panel3dViewerLoader.active) {
|
if (panel3dViewerLoader.active) {
|
||||||
panel3dViewerLoader.item.viewer3D.load(filepath, label);
|
panel3dViewerLoader.item.viewer3D.load(filepath, label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,11 +51,11 @@ Item {
|
||||||
|
|
||||||
// Load reconstruction's current SfM file
|
// Load reconstruction's current SfM file
|
||||||
function viewSfM() {
|
function viewSfM() {
|
||||||
var activeNode = _reconstruction.activeNodes ? _reconstruction.activeNodes.get('sfm').node : null;
|
var activeNode = _reconstruction.activeNodes ? _reconstruction.activeNodes.get('sfm').node : null
|
||||||
if (!activeNode)
|
if (!activeNode)
|
||||||
return;
|
return
|
||||||
if (panel3dViewerLoader.active) {
|
if (panel3dViewerLoader.active) {
|
||||||
panel3dViewerLoader.item.viewer3D.view(activeNode.attribute('output'));
|
panel3dViewerLoader.item.viewer3D.view(activeNode.attribute('output'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,9 +256,17 @@ ApplicationWindow {
|
||||||
function openError(type, msg, node) {
|
function openError(type, msg, node) {
|
||||||
errorType = type
|
errorType = type
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "Already Submitted": this.setupPendingStatusError(msg, node); break
|
case "Already Submitted": {
|
||||||
case "Compatibility Issue": this.setupCompatibilityIssue(msg); break
|
this.setupPendingStatusError(msg, node)
|
||||||
default: this.onlyDisplayError(msg)
|
break
|
||||||
|
}
|
||||||
|
case "Compatibility Issue": {
|
||||||
|
this.setupCompatibilityIssue(msg)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
this.onlyDisplayError(msg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.open()
|
this.open()
|
||||||
|
@ -337,7 +345,11 @@ ApplicationWindow {
|
||||||
standardButton(Dialog.Discard).text = "Continue without Saving"
|
standardButton(Dialog.Discard).text = "Continue without Saving"
|
||||||
}
|
}
|
||||||
|
|
||||||
onDiscarded: { close(); computeManager.compute(currentNode, true) }
|
onDiscarded: {
|
||||||
|
close()
|
||||||
|
computeManager.compute(currentNode, true)
|
||||||
|
}
|
||||||
|
|
||||||
onAccepted: saveAsAction.trigger()
|
onAccepted: saveAsAction.trigger()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,8 +375,7 @@ ApplicationWindow {
|
||||||
title: "Open File"
|
title: "Open File"
|
||||||
nameFilters: ["Meshroom Graphs (*.mg)"]
|
nameFilters: ["Meshroom Graphs (*.mg)"]
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if(_reconstruction.loadUrl(fileUrl))
|
if (_reconstruction.loadUrl(fileUrl)) {
|
||||||
{
|
|
||||||
MeshroomApp.addRecentProjectFile(fileUrl.toString())
|
MeshroomApp.addRecentProjectFile(fileUrl.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,13 +424,9 @@ ApplicationWindow {
|
||||||
function ensureSaved(callback)
|
function ensureSaved(callback)
|
||||||
{
|
{
|
||||||
var saved = _reconstruction.undoStack.clean
|
var saved = _reconstruction.undoStack.clean
|
||||||
// If current document is modified, open "unsaved dialog"
|
if (!saved) { // If current document is modified, open "unsaved dialog"
|
||||||
if(!saved)
|
|
||||||
{
|
|
||||||
unsavedDialog.prompt(callback)
|
unsavedDialog.prompt(callback)
|
||||||
}
|
} else { // Otherwise, directly call the callback
|
||||||
else // otherwise, directly call the callback
|
|
||||||
{
|
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
return saved
|
return saved
|
||||||
|
@ -578,23 +585,23 @@ ApplicationWindow {
|
||||||
let folder = "";
|
let folder = "";
|
||||||
|
|
||||||
if (imagesFolder.toString() === "" && workspaceView.imageGallery.galleryGrid.itemAtIndex(0) !== null) {
|
if (imagesFolder.toString() === "" && workspaceView.imageGallery.galleryGrid.itemAtIndex(0) !== null) {
|
||||||
imagesFolder = Filepath.stringToUrl(Filepath.dirname(workspaceView.imageGallery.galleryGrid.itemAtIndex(0).source));
|
imagesFolder = Filepath.stringToUrl(Filepath.dirname(workspaceView.imageGallery.galleryGrid.itemAtIndex(0).source))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_reconstruction.graph && _reconstruction.graph.filepath) {
|
if (_reconstruction.graph && _reconstruction.graph.filepath) {
|
||||||
folder = Filepath.stringToUrl(Filepath.dirname(_reconstruction.graph.filepath));
|
folder = Filepath.stringToUrl(Filepath.dirname(_reconstruction.graph.filepath))
|
||||||
} else {
|
} else {
|
||||||
var projects = MeshroomApp.recentProjectFiles;
|
var projects = MeshroomApp.recentProjectFiles;
|
||||||
if (projects.length > 0 && Filepath.exists(projects[0])) {
|
if (projects.length > 0 && Filepath.exists(projects[0])) {
|
||||||
folder = Filepath.stringToUrl(Filepath.dirname(projects[0]));
|
folder = Filepath.stringToUrl(Filepath.dirname(projects[0]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (importImages && imagesFolder.toString() !== "" && Filepath.exists(imagesFolder)) {
|
if (importImages && imagesFolder.toString() !== "" && Filepath.exists(imagesFolder)) {
|
||||||
folder = imagesFolder;
|
folder = imagesFolder
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.folder = folder;
|
dialog.folder = folder
|
||||||
}
|
}
|
||||||
|
|
||||||
header: MenuBar {
|
header: MenuBar {
|
||||||
|
@ -609,8 +616,8 @@ ApplicationWindow {
|
||||||
property int fullWidth: {
|
property int fullWidth: {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
for (var i = 0; i < count; ++i) {
|
for (var i = 0; i < count; ++i) {
|
||||||
var item = itemAt(i);
|
var item = itemAt(i)
|
||||||
result = Math.max(item.implicitWidth + item.padding * 2, result);
|
result = Math.max(item.implicitWidth + item.padding * 2, result)
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -641,8 +648,8 @@ ApplicationWindow {
|
||||||
text: "Open"
|
text: "Open"
|
||||||
shortcut: "Ctrl+O"
|
shortcut: "Ctrl+O"
|
||||||
onTriggered: ensureSaved(function() {
|
onTriggered: ensureSaved(function() {
|
||||||
initFileDialogFolder(openFileDialog);
|
initFileDialogFolder(openFileDialog)
|
||||||
openFileDialog.open();
|
openFileDialog.open()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Menu {
|
Menu {
|
||||||
|
@ -653,10 +660,10 @@ ApplicationWindow {
|
||||||
property int fullWidth: {
|
property int fullWidth: {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
for (var i = 0; i < count; ++i) {
|
for (var i = 0; i < count; ++i) {
|
||||||
var item = itemAt(i);
|
var item = itemAt(i)
|
||||||
result = Math.max(item.implicitWidth + item.padding * 2, result);
|
result = Math.max(item.implicitWidth + item.padding * 2, result)
|
||||||
}
|
}
|
||||||
return result;
|
return result
|
||||||
}
|
}
|
||||||
implicitWidth: fullWidth
|
implicitWidth: fullWidth
|
||||||
Repeater {
|
Repeater {
|
||||||
|
@ -664,14 +671,11 @@ ApplicationWindow {
|
||||||
model: MeshroomApp.recentProjectFiles
|
model: MeshroomApp.recentProjectFiles
|
||||||
MenuItem {
|
MenuItem {
|
||||||
onTriggered: ensureSaved(function() {
|
onTriggered: ensureSaved(function() {
|
||||||
openRecentMenu.dismiss();
|
openRecentMenu.dismiss()
|
||||||
if(_reconstruction.loadUrl(modelData))
|
if (_reconstruction.loadUrl(modelData)) {
|
||||||
{
|
MeshroomApp.addRecentProjectFile(modelData)
|
||||||
MeshroomApp.addRecentProjectFile(modelData);
|
} else {
|
||||||
}
|
MeshroomApp.removeRecentProjectFile(modelData)
|
||||||
else
|
|
||||||
{
|
|
||||||
MeshroomApp.removeRecentProjectFile(modelData);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -693,12 +697,10 @@ ApplicationWindow {
|
||||||
enabled: _reconstruction ? (_reconstruction.graph && !_reconstruction.graph.filepath) || !_reconstruction.undoStack.clean : false
|
enabled: _reconstruction ? (_reconstruction.graph && !_reconstruction.graph.filepath) || !_reconstruction.undoStack.clean : false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (_reconstruction.graph.filepath) {
|
if (_reconstruction.graph.filepath) {
|
||||||
_reconstruction.save();
|
_reconstruction.save()
|
||||||
}
|
} else {
|
||||||
else
|
initFileDialogFolder(saveFileDialog)
|
||||||
{
|
saveFileDialog.open()
|
||||||
initFileDialogFolder(saveFileDialog);
|
|
||||||
saveFileDialog.open();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -707,8 +709,8 @@ ApplicationWindow {
|
||||||
text: "Save As..."
|
text: "Save As..."
|
||||||
shortcut: "Ctrl+Shift+S"
|
shortcut: "Ctrl+Shift+S"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
initFileDialogFolder(saveFileDialog);
|
initFileDialogFolder(saveFileDialog)
|
||||||
saveFileDialog.open();
|
saveFileDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
@ -717,8 +719,8 @@ ApplicationWindow {
|
||||||
text: "Import Images"
|
text: "Import Images"
|
||||||
shortcut: "Ctrl+I"
|
shortcut: "Ctrl+I"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
initFileDialogFolder(importImagesDialog, true);
|
initFileDialogFolder(importImagesDialog, true)
|
||||||
importImagesDialog.open();
|
importImagesDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,8 +745,8 @@ ApplicationWindow {
|
||||||
onActivated: saveAsTemplateAction.triggered()
|
onActivated: saveAsTemplateAction.triggered()
|
||||||
}
|
}
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
initFileDialogFolder(saveTemplateDialog);
|
initFileDialogFolder(saveTemplateDialog)
|
||||||
saveTemplateDialog.open();
|
saveTemplateDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,8 +765,8 @@ ApplicationWindow {
|
||||||
onActivated: importProjectAction.triggered()
|
onActivated: importProjectAction.triggered()
|
||||||
}
|
}
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
initFileDialogFolder(importProjectDialog);
|
initFileDialogFolder(importProjectDialog)
|
||||||
importProjectDialog.open();
|
importProjectDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,24 +986,25 @@ ApplicationWindow {
|
||||||
|
|
||||||
function viewNode(node, mouse) {
|
function viewNode(node, mouse) {
|
||||||
// 2D viewer
|
// 2D viewer
|
||||||
viewer2D.tryLoadNode(node);
|
viewer2D.tryLoadNode(node)
|
||||||
|
|
||||||
// 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewIn3D(attribute, mouse) {
|
function viewIn3D(attribute, mouse) {
|
||||||
if (!panel3dViewer || !attribute.node.has3DOutput)
|
if (!panel3dViewer || !attribute.node.has3DOutput)
|
||||||
return false;
|
return false
|
||||||
var loaded = panel3dViewer.viewer3D.view(attribute);
|
var loaded = panel3dViewer.viewer3D.view(attribute)
|
||||||
|
|
||||||
// solo media if Control modifier was held
|
// solo media if Control modifier was held
|
||||||
if (loaded && mouse && mouse.modifiers & Qt.ControlModifier)
|
if (loaded && mouse && mouse.modifiers & Qt.ControlModifier)
|
||||||
panel3dViewer.viewer3D.solo(attribute);
|
panel3dViewer.viewer3D.solo(attribute)
|
||||||
return loaded;
|
return loaded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1203,8 +1206,8 @@ ApplicationWindow {
|
||||||
readOnly: node ? node.locked : false
|
readOnly: node ? node.locked : false
|
||||||
|
|
||||||
onUpgradeRequest: {
|
onUpgradeRequest: {
|
||||||
var n = _reconstruction.upgradeNode(node);
|
var n = _reconstruction.upgradeNode(node)
|
||||||
_reconstruction.selectedNode = n;
|
_reconstruction.selectedNode = n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue