[ui] Replacement of Controls1 SplitView to Controls2 SplitView

This commit is contained in:
Aurore LAFAURIE 2024-09-17 18:32:59 +02:00
parent 34e3847cea
commit ccd88c4646
8 changed files with 190 additions and 196 deletions

View file

@ -1,6 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as Controls1 // For SplitView
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import QtQuick.Window 2.15 import QtQuick.Window 2.15
import QtQml.Models 2.15 import QtQml.Models 2.15
@ -976,33 +975,32 @@ Page {
function onError() { createDialog(dialogsFactory.error, arguments[0]) } function onError() { createDialog(dialogsFactory.error, arguments[0]) }
} }
Controls1.SplitView { ColumnLayout {
anchors.fill: parent anchors.fill: parent
orientation: Qt.Vertical spacing: 4
// Setup global tooltip style // "ProgressBar" reflecting status of all the chunks in the graph, in their process order
ToolTip.toolTip.background: Rectangle { color: activePalette.base; border.color: activePalette.mid } NodeChunks {
id: chunksListView
height: 6
width: parent.width
model: _reconstruction ? _reconstruction.sortedDFSChunks : null
highlightChunks: false
}
ColumnLayout { SplitView {
Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
implicitHeight: Math.round(parent.height * 0.7) width: parent.width
spacing: 4
// "ProgressBar" reflecting status of all the chunks in the graph, in their process order orientation: Qt.Vertical
NodeChunks {
id: chunksListView // Setup global tooltip style
Layout.fillWidth: true ToolTip.toolTip.background: Rectangle { color: activePalette.base; border.color: activePalette.mid }
height: 6
model: _reconstruction ? _reconstruction.sortedDFSChunks : null
highlightChunks: false
}
WorkspaceView { WorkspaceView {
id: workspaceView id: workspaceView
Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.minimumHeight: 50 SplitView.preferredHeight: 0.7 * parent.height
reconstruction: _reconstruction reconstruction: _reconstruction
readOnly: _reconstruction ? _reconstruction.computing : false readOnly: _reconstruction ? _reconstruction.computing : false
@ -1018,7 +1016,7 @@ Page {
if (attr.isOutput && attr.desc.semantic !== "image") if (attr.isOutput && attr.desc.semantic !== "image")
if (!alreadyDisplay || attr.desc.semantic == "3D") if (!alreadyDisplay || attr.desc.semantic == "3D")
if (workspaceView.viewIn3D(attr, mouse)) if (workspaceView.viewIn3D(attr, mouse))
alreadyDisplay = true alreadyDisplay = true
} }
} }
@ -1033,184 +1031,183 @@ Page {
return loaded return loaded
} }
} }
}
Controls1.SplitView { SplitView {
orientation: Qt.Horizontal id: bottomContainer
width: parent.width orientation: Qt.Horizontal
property bool isOnlyGraphEditorVisible: settingsUILayout.showGraphEditor && !settingsUILayout.showImageViewer && !settingsUILayout.showViewer3D && !settingsUILayout.showImageGallery visible: settingsUILayout.showGraphEditor
height: isOnlyGraphEditorVisible ? parent.height : Math.round(parent.height * 0.3) SplitView.preferredHeight: 0.3 * parent.height
visible: settingsUILayout.showGraphEditor
TabPanel { TabPanel {
id: graphEditorPanel id: graphEditorPanel
Layout.fillWidth: true Layout.fillWidth: true
padding: 4 SplitView.preferredWidth: 0.7 * parent.width
tabs: ["Graph Editor", "Task Manager", "Script Editor"]
headerBar: RowLayout { padding: 4
MaterialToolButton { tabs: ["Graph Editor", "Task Manager", "Script Editor"]
text: MaterialIcons.sync
ToolTip.text: "Refresh Nodes Status" headerBar: RowLayout {
ToolTip.visible: hovered MaterialToolButton {
font.pointSize: 11 text: MaterialIcons.sync
padding: 2 ToolTip.text: "Refresh Nodes Status"
onClicked: { ToolTip.visible: hovered
updatingStatus = true font.pointSize: 11
_reconstruction.forceNodesStatusUpdate() padding: 2
updatingStatus = false onClicked: {
updatingStatus = true
_reconstruction.forceNodesStatusUpdate()
updatingStatus = false
}
property bool updatingStatus: false
enabled: !updatingStatus
} }
property bool updatingStatus: false MaterialToolButton {
enabled: !updatingStatus text: MaterialIcons.more_vert
} font.pointSize: 11
MaterialToolButton { padding: 2
text: MaterialIcons.more_vert onClicked: graphEditorMenu.open()
font.pointSize: 11 checkable: true
padding: 2 checked: graphEditorMenu.visible
onClicked: graphEditorMenu.open()
checkable: true
checked: graphEditorMenu.visible
Menu {
id: graphEditorMenu
y: parent.height
x: -width + parent.width
MenuItem {
text: "Clear Pending Status"
enabled: _reconstruction ? !_reconstruction.computingLocally : false
onTriggered: _reconstruction.graph.clearSubmittedNodes()
}
MenuItem {
text: "Force Unlock Nodes"
onTriggered: _reconstruction.graph.forceUnlockNodes()
}
Menu { Menu {
title: "Refresh Nodes Status" id: graphEditorMenu
y: parent.height
x: -width + parent.width
MenuItem { MenuItem {
id: enableAutoRefresh text: "Clear Pending Status"
text: "Enable Auto-Refresh" enabled: _reconstruction ? !_reconstruction.computingLocally : false
checkable: true onTriggered: _reconstruction.graph.clearSubmittedNodes()
checked: _reconstruction.filePollerRefresh === 0
ToolTip.text: "Check every file's status periodically"
ToolTip.visible: hovered
ToolTip.delay: 200
onToggled: {
if (checked) {
disableAutoRefresh.checked = false
minimalAutoRefresh.checked = false
_reconstruction.filePollerRefreshChanged(0)
}
// Prevents cases where the user unchecks the currently checked option
enableAutoRefresh.checked = true
} }
} MenuItem {
MenuItem { text: "Force Unlock Nodes"
id: disableAutoRefresh onTriggered: _reconstruction.graph.forceUnlockNodes()
text: "Disable Auto-Refresh"
checkable: true
checked: _reconstruction.filePollerRefresh === 1
ToolTip.text: "No file status will be checked"
ToolTip.visible: hovered
ToolTip.delay: 200
onToggled: {
if (checked) {
enableAutoRefresh.checked = false
minimalAutoRefresh.checked = false
_reconstruction.filePollerRefreshChanged(1)
}
// Prevents cases where the user unchecks the currently checked option
disableAutoRefresh.checked = true
} }
}
MenuItem { Menu {
id: minimalAutoRefresh title: "Refresh Nodes Status"
text: "Enable Minimal Auto-Refresh"
checkable: true MenuItem {
checked: _reconstruction.filePollerRefresh === 2 id: enableAutoRefresh
ToolTip.text: "Check the file status of submitted or running chunks periodically" text: "Enable Auto-Refresh"
ToolTip.visible: hovered checkable: true
ToolTip.delay: 200 checked: _reconstruction.filePollerRefresh === 0
onToggled: { ToolTip.text: "Check every file's status periodically"
if (checked) { ToolTip.visible: hovered
disableAutoRefresh.checked = false ToolTip.delay: 200
enableAutoRefresh.checked = false onToggled: {
_reconstruction.filePollerRefreshChanged(2) if (checked) {
disableAutoRefresh.checked = false
minimalAutoRefresh.checked = false
_reconstruction.filePollerRefreshChanged(0)
}
// Prevents cases where the user unchecks the currently checked option
enableAutoRefresh.checked = true
} }
// Prevents cases where the user unchecks the currently checked option
minimalAutoRefresh.checked = true
} }
} MenuItem {
id: disableAutoRefresh
text: "Disable Auto-Refresh"
checkable: true
checked: _reconstruction.filePollerRefresh === 1
ToolTip.text: "No file status will be checked"
ToolTip.visible: hovered
ToolTip.delay: 200
onToggled: {
if (checked) {
enableAutoRefresh.checked = false
minimalAutoRefresh.checked = false
_reconstruction.filePollerRefreshChanged(1)
}
// Prevents cases where the user unchecks the currently checked option
disableAutoRefresh.checked = true
}
}
MenuItem {
id: minimalAutoRefresh
text: "Enable Minimal Auto-Refresh"
checkable: true
checked: _reconstruction.filePollerRefresh === 2
ToolTip.text: "Check the file status of submitted or running chunks periodically"
ToolTip.visible: hovered
ToolTip.delay: 200
onToggled: {
if (checked) {
disableAutoRefresh.checked = false
enableAutoRefresh.checked = false
_reconstruction.filePollerRefreshChanged(2)
}
// Prevents cases where the user unchecks the currently checked option
minimalAutoRefresh.checked = true
}
}
}
} }
} }
} }
}
GraphEditor { GraphEditor {
id: graphEditor id: graphEditor
anchors.fill: parent
visible: graphEditorPanel.currentTab === 0 visible: graphEditorPanel.currentTab === 0
anchors.fill: parent uigraph: _reconstruction
uigraph: _reconstruction nodeTypesModel: _nodeTypes
nodeTypesModel: _nodeTypes
onNodeDoubleClicked: { onNodeDoubleClicked: {
_reconstruction.setActiveNode(node); _reconstruction.setActiveNode(node);
workspaceView.viewNode(node, mouse); workspaceView.viewNode(node, mouse);
} }
onComputeRequest: { onComputeRequest: {
_reconstruction.forceNodesStatusUpdate(); _reconstruction.forceNodesStatusUpdate();
computeManager.compute(nodes) computeManager.compute(nodes)
} }
onSubmitRequest: { onSubmitRequest: {
_reconstruction.forceNodesStatusUpdate(); _reconstruction.forceNodesStatusUpdate();
computeManager.submit(nodes) computeManager.submit(nodes)
} }
onFilesDropped: { onFilesDropped: {
var filesByType = _reconstruction.getFilesByTypeFromDrop(drop.urls) var filesByType = _reconstruction.getFilesByTypeFromDrop(drop.urls)
if (filesByType["meshroomScenes"].length == 1) { if (filesByType["meshroomScenes"].length == 1) {
ensureSaved(function() { ensureSaved(function() {
if (_reconstruction.handleFilesUrl(filesByType, null, mousePosition)) { if (_reconstruction.handleFilesUrl(filesByType, null, mousePosition)) {
MeshroomApp.addRecentProjectFile(filesByType["meshroomScenes"][0]) MeshroomApp.addRecentProjectFile(filesByType["meshroomScenes"][0])
} }
}) })
} else { } else {
_reconstruction.handleFilesUrl(filesByType, null, mousePosition) _reconstruction.handleFilesUrl(filesByType, null, mousePosition)
}
} }
} }
TaskManager {
id: taskManager
anchors.fill: parent
visible: graphEditorPanel.currentTab === 1
uigraph: _reconstruction
taskManager: _reconstruction ? _reconstruction.taskManager : null
}
ScriptEditor {
id: scriptEditor
anchors.fill: parent
visible: graphEditorPanel.currentTab === 2
}
} }
TaskManager { NodeEditor {
id: taskManager id: nodeEditor
node: _reconstruction ? _reconstruction.selectedNode : null
property bool computing: _reconstruction ? _reconstruction.computing : false
// Make NodeEditor readOnly when computing
readOnly: node ? node.locked : false
visible: graphEditorPanel.currentTab === 1 onUpgradeRequest: {
var n = _reconstruction.upgradeNode(node)
uigraph: _reconstruction _reconstruction.selectedNode = n
taskManager: _reconstruction ? _reconstruction.taskManager : null }
anchors.fill: parent
}
ScriptEditor {
id: scriptEditor
visible: graphEditorPanel.currentTab === 2
anchors.fill: parent
}
}
NodeEditor {
id: nodeEditor
width: Math.round(parent.width * 0.3)
node: _reconstruction ? _reconstruction.selectedNode : null
property bool computing: _reconstruction ? _reconstruction.computing : false
// Make NodeEditor readOnly when computing
readOnly: node ? node.locked : false
onUpgradeRequest: {
var n = _reconstruction.upgradeNode(node)
_reconstruction.selectedNode = n
} }
} }
} }

View file

@ -1,6 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as Controls1 // SplitView
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import MaterialIcons 2.2 import MaterialIcons 2.2
import Controls 1.0 import Controls 1.0

View file

@ -20,7 +20,7 @@ ListView {
} }
orientation: ListView.Horizontal orientation: ListView.Horizontal
implicitWidth: 100
// If we have enough space, add one pixel margin between chunks // If we have enough space, add one pixel margin between chunks
spacing: modelIsBig ? 0 : 1 spacing: modelIsBig ? 0 : 1
delegate: Rectangle { delegate: Rectangle {

View file

@ -1,6 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as Controls1 // SplitView
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import MaterialIcons 2.2 import MaterialIcons 2.2
import Controls 1.0 import Controls 1.0
@ -254,7 +253,7 @@ Panel {
Component { Component {
id: editor_component id: editor_component
Controls1.SplitView { SplitView {
anchors.fill: parent anchors.fill: parent
// The list of chunks // The list of chunks

View file

@ -1,6 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as Controls1 // SplitView
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import MaterialIcons 2.2 import MaterialIcons 2.2
import Controls 1.0 import Controls 1.0

View file

@ -1,6 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as Controls1 // For SplitView
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import Utils 1.0 import Utils 1.0
import MaterialIcons 2.2 import MaterialIcons 2.2
@ -16,7 +15,7 @@ Page {
} }
} }
Controls1.SplitView { SplitView {
id: splitView id: splitView
anchors.fill: parent anchors.fill: parent
@ -25,8 +24,8 @@ Page {
id: leftColumn id: leftColumn
height: parent.height height: parent.height
Layout.minimumWidth: 200 SplitView.minimumWidth: 200
Layout.maximumWidth: 300 SplitView.maximumWidth: 300
AnimatedImage { AnimatedImage {
id: logo id: logo

View file

@ -1,6 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as Controls1
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import QtQml.Models 2.15 import QtQml.Models 2.15
import QtQuick.Scene3D 2.15 import QtQuick.Scene3D 2.15

View file

@ -1,6 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as Controls1 // For SplitView
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import Qt.labs.platform 1.0 as Platform import Qt.labs.platform 1.0 as Platform
import ImageGallery 1.0 import ImageGallery 1.0
@ -26,11 +25,9 @@ Item {
readonly property Viewer2D viewer2D: viewer2D readonly property Viewer2D viewer2D: viewer2D
readonly property alias imageGallery: imageGallery readonly property alias imageGallery: imageGallery
implicitWidth: 300 // Use settings instead of visible property as property changes are not propagated
implicitHeight: 400
visible: settingsUILayout.showImageGallery || settingsUILayout.showImageViewer || settingsUILayout.showViewer3D || settingsUILayout.showLiveReconstruction visible: settingsUILayout.showImageGallery || settingsUILayout.showImageViewer || settingsUILayout.showViewer3D || settingsUILayout.showLiveReconstruction
// 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) {
@ -62,10 +59,12 @@ Item {
SystemPalette { id: activePalette } SystemPalette { id: activePalette }
Controls1.SplitView { SplitView {
id: mainSplitView
anchors.fill: parent anchors.fill: parent
Controls1.SplitView { SplitView {
id: leftSplitView
visible: settingsUILayout.showImageGallery || settingsUILayout.showLiveReconstruction visible: settingsUILayout.showImageGallery || settingsUILayout.showLiveReconstruction
orientation: Qt.Vertical orientation: Qt.Vertical
Layout.fillHeight: true Layout.fillHeight: true
@ -96,6 +95,7 @@ Item {
} }
} }
LiveSfmView { LiveSfmView {
id: liveSfmView
visible: settingsUILayout.showLiveReconstruction visible: settingsUILayout.showLiveReconstruction
reconstruction: root.reconstruction reconstruction: root.reconstruction
Layout.fillWidth: true Layout.fillWidth: true
@ -104,6 +104,7 @@ Item {
} }
Panel { Panel {
id: imageViewer
title: "Image Viewer" title: "Image Viewer"
visible: settingsUILayout.showImageViewer visible: settingsUILayout.showImageViewer
implicitWidth: Math.round(parent.width * 0.35) implicitWidth: Math.round(parent.width * 0.35)
@ -190,6 +191,7 @@ Item {
} }
Item { Item {
id: viewer3DContainer
visible: settingsUILayout.showViewer3D visible: settingsUILayout.showViewer3D
Layout.minimumWidth: 20 Layout.minimumWidth: 20
Layout.minimumHeight: 80 Layout.minimumHeight: 80
@ -213,15 +215,15 @@ Item {
property alias viewer3D: c_viewer3D property alias viewer3D: c_viewer3D
Controls1.SplitView { SplitView {
id: c_viewer3DSplitView id: c_viewer3DSplitView
anchors.fill: parent anchors.fill: parent
Viewer3D { Viewer3D {
id: c_viewer3D id: c_viewer3D
Layout.fillWidth: true SplitView.fillWidth: true
Layout.fillHeight: true SplitView.fillHeight: true
Layout.minimumWidth: 20 SplitView.minimumWidth: 20
DropArea { DropArea {
anchors.fill: parent anchors.fill: parent