mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-29 14:37:26 +02:00
[ui] AttributeEditor: add contextual actions on File params
* add 'Open Containing Folder'/'Open File' actions for filepaths * add 'Open Folder' action for folders * misc: tweak spacings
This commit is contained in:
parent
c45ebdf83c
commit
60f1f36ff8
3 changed files with 33 additions and 2 deletions
|
@ -64,7 +64,7 @@ ColumnLayout {
|
|||
id: attributesListView
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: 6
|
||||
anchors.margins: 4
|
||||
|
||||
clip: true
|
||||
spacing: 1
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 2.2
|
||||
import "../filepath.js" as Filepath
|
||||
|
||||
/**
|
||||
Instantiate a control to visualize and edit an Attribute based on its type.
|
||||
|
@ -52,11 +53,34 @@ RowLayout {
|
|||
property Component menuComp: Menu {
|
||||
id: paramMenu
|
||||
|
||||
property bool isFileAttribute: attribute.type == "File"
|
||||
property bool isFilepath: isFileAttribute && Filepath.isFile(attribute.value)
|
||||
|
||||
MenuItem {
|
||||
text: "Reset To Default Value"
|
||||
enabled: !attribute.isOutput && !attribute.isLink && !attribute.isDefault
|
||||
onTriggered: _reconstruction.resetAttribute(attribute)
|
||||
}
|
||||
|
||||
MenuSeparator {
|
||||
visible: paramMenu.isFileAttribute
|
||||
height: visible ? implicitHeight : 0
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
visible: paramMenu.isFileAttribute
|
||||
height: visible ? implicitHeight : 0
|
||||
text: paramMenu.isFilepath ? "Open Containing Folder" : "Open Folder"
|
||||
onClicked: paramMenu.isFilepath ? Qt.openUrlExternally(Filepath.dirname(attribute.value)) :
|
||||
Qt.openUrlExternally(attribute.value)
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
visible: paramMenu.isFilepath
|
||||
height: visible ? implicitHeight : 0
|
||||
text: "Open File"
|
||||
onClicked: Qt.openUrlExternally(attribute.value)
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
@ -240,7 +264,7 @@ RowLayout {
|
|||
Layout.fillWidth: true
|
||||
Layout.margins: 4
|
||||
clip: true
|
||||
spacing: 10
|
||||
spacing: 4
|
||||
|
||||
ScrollBar.vertical: ScrollBar { id: sb }
|
||||
|
||||
|
|
|
@ -15,3 +15,10 @@ function extension(path) {
|
|||
var dot_pos = path.lastIndexOf('.');
|
||||
return dot_pos > -1 ? path.substring(dot_pos, path.length) : ""
|
||||
}
|
||||
|
||||
/// Return whether the given path is a path to a file.
|
||||
/// (only based on the fact that the last portion of the path
|
||||
/// matches the 'basename.extension' pattern)
|
||||
function isFile(path) {
|
||||
return extension(path) !== ""
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue