From e7941ef75ecae763e1db80d57601b7dd66764e2c Mon Sep 17 00:00:00 2001 From: Landrodie Date: Mon, 25 Jan 2021 15:33:54 +0100 Subject: [PATCH] [Panorama Viewer] add Panorama Viewer toolbar Add two icons in material icons Update icon of viewer Add downscale value as spinbox Add 3 buttons for options in viewer --- .../ui/qml/MaterialIcons/MaterialIcons.qml | 2 + meshroom/ui/qml/Viewer/PanoramaToolbar.qml | 105 ++++++++++++++++++ meshroom/ui/qml/Viewer/Viewer2D.qml | 9 +- meshroom/ui/qml/WorkspaceView.qml | 7 ++ 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 meshroom/ui/qml/Viewer/PanoramaToolbar.qml diff --git a/meshroom/ui/qml/MaterialIcons/MaterialIcons.qml b/meshroom/ui/qml/MaterialIcons/MaterialIcons.qml index 8e853584..457845d2 100644 --- a/meshroom/ui/qml/MaterialIcons/MaterialIcons.qml +++ b/meshroom/ui/qml/MaterialIcons/MaterialIcons.qml @@ -660,6 +660,8 @@ QtObject { readonly property string panorama_fish_eye: "\ue40c" readonly property string panorama_horizontal: "\ue40d" readonly property string panorama_vertical: "\ue40e" + readonly property string panorama_sphere: "\ue9c9" + readonly property string panorama_sphere_filled: "\ue9ca" readonly property string panorama_wide_angle: "\ue40f" readonly property string party_mode: "\ue7fa" readonly property string pause: "\ue034" diff --git a/meshroom/ui/qml/Viewer/PanoramaToolbar.qml b/meshroom/ui/qml/Viewer/PanoramaToolbar.qml new file mode 100644 index 00000000..060c694d --- /dev/null +++ b/meshroom/ui/qml/Viewer/PanoramaToolbar.qml @@ -0,0 +1,105 @@ +import QtQuick 2.11 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import MaterialIcons 2.2 +import Controls 1.0 +import Utils 1.0 + +FloatingPane { + id: root + anchors.margins: 0 + padding: 5 + radius: 0 + + property bool enableEdit: enablePanoramaEdit.checked + property bool enableHover: enableHover.checked + + property int downscaleDefaultValue: 2 + + background: Rectangle { color: root.palette.window } + + DoubleValidator { + id: doubleValidator + locale: 'C' // use '.' decimal separator disregarding of the system locale + } + + RowLayout { + id: toolLayout + anchors.fill: parent + + MaterialToolButton { + id: enablePanoramaEdit + ToolTip.text: "Enable Panorama edition" + text: MaterialIcons.open_with + font.pointSize: 14 + padding: 5 + Layout.minimumWidth: 0 + checkable: true + checked: true + } + MaterialToolButton { + id: enableHover + ToolTip.text: "Enable hovering highlight" + text: MaterialIcons.highlight + font.pointSize: 14 + padding: 5 + Layout.minimumWidth: 0 + checkable: true + checked: true + } + MaterialToolButton { + id: displayGrid + ToolTip.text: "Display grid" + text: MaterialIcons.grid_on + font.pointSize: 14 + padding: 5 + Layout.minimumWidth: 0 + checkable: true + checked: true + } + //Fill rectangle to have a better UI + Rectangle { + color: root.palette.window + Layout.fillWidth: true + } + RowLayout{ + ToolButton { + text: "Downscale" + + ToolTip.visible: ToolTip.text && hovered + ToolTip.delay: 100 + ToolTip.text: "Reset the downscale" + + onClicked: { + downscaleSpinBox.value = downscaleDefaultValue; + } + } + SpinBox { + id: downscaleSpinBox + from: 0 + value: 2 + to: 3 + stepSize: 1 + Layout.fillWidth: false + + + validator: DoubleValidator { + bottom: Math.min(downscaleSpinBox.from, downscaleSpinBox.to) + top: Math.max(downscaleSpinBox.from, downscaleSpinBox.to) + } + + textFromValue: function(value, locale) { + if(value === 0){ + return 1 + } + else{ + return "1/" + Math.pow(2,value).toString() + } + + } + } + } + + } + +} diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 49dccac9..0223ad05 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -186,6 +186,13 @@ FocusScope { Layout.fillWidth: true } + PanoramaToolbar { + id: panoramaViewerToolbar + anchors.margins: 0 + visible: displayPanoramaToolBarAction.checked && displayPanoramaToolBarAction.enabled + Layout.fillWidth: true + } + // Image Item { id: imgLayout @@ -700,7 +707,7 @@ FocusScope { property bool isComputed: activeNode && activeNode.isComputed ToolTip.text: "Panorama Viewer" - text: MaterialIcons.panorama_wide_angle + text: MaterialIcons.panorama_sphere font.pointSize: 16 padding: 0 Layout.minimumWidth: 0 diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index 45239663..82995148 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -112,6 +112,13 @@ Item { checked: true enabled: viewer2D.useLensDistortionViewer } + Action { + id: displayPanoramaToolBarAction + text: "Display Panorama Toolbar" + checkable: true + checked: true + enabled: viewer2D.usePanoramaViewer + } Action { id: displayImagePathAction text: "Display Image Path"