diff --git a/meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml b/meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml new file mode 100644 index 00000000..ce491184 --- /dev/null +++ b/meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml @@ -0,0 +1,145 @@ +import QtQuick 2.11 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import MaterialIcons 2.2 +import Controls 1.0 + +FloatingPane { + id: root + anchors.margins: 0 + padding: 5 + radius: 0 + + property real gainDefaultValue: 1 + property real gammaDefaultValue: 1 + property real slidersPowerValue: 4 + property real gainValue: Math.pow(gainCtrl.value, slidersPowerValue) + property real gammaValue: Math.pow(gammaCtrl.value, slidersPowerValue) + property string channelModeValue: channelsCtrl.value + property variant colorRGBA: null + property bool displayGrid: displayGridButton.checked + + background: Rectangle { color: root.palette.window } + + DoubleValidator { + id: doubleValidator + locale: 'C' // use '.' decimal separator disregarding of the system locale + } + + RowLayout { + id: toolLayout + // anchors.verticalCenter: parent + anchors.fill: parent + + // channel mode + ComboBox { + id: channelsCtrl + + // set min size to 4 characters + one margin for the combobox + Layout.minimumWidth: 5.0 * Qt.application.font.pixelSize + Layout.preferredWidth: Layout.minimumWidth + flat: true + + property var channels: ["rgba", "rgb", "r", "g", "b","a"] + property string value: channels[currentIndex] + + model: channels + } + MaterialToolButton { + id: displayGridButton + ToolTip.text: "Display Grid" + text: MaterialIcons.grid_on + font.pointSize: 16 + padding: 0 + Layout.minimumWidth: 0 + checkable: true + checked: false + } + + // gain slider + RowLayout { + spacing: 5 + + ToolButton { + text: "Gain" + + ToolTip.visible: ToolTip.text && hovered + ToolTip.delay: 100 + ToolTip.text: "Reset Gain" + + onClicked: { + gainCtrl.value = gainDefaultValue; + } + } + TextField { + id: gainLabel + + ToolTip.visible: ToolTip.text && hovered + ToolTip.delay: 100 + ToolTip.text: "Color Gain (in linear colorspace)" + + text: gainValue.toFixed(2) + Layout.preferredWidth: textMetrics_gainValue.width + selectByMouse: true + validator: doubleValidator + onAccepted: { + gainCtrl.value = Math.pow(Number(gainLabel.text), 1.0/slidersPowerValue) + } + } + Slider { + id: gainCtrl + Layout.fillWidth: true + from: 0.01 + to: 2 + value: gainDefaultValue + stepSize: 0.01 + } + } + + // gamma slider + RowLayout { + spacing: 5 + + ToolButton { + text: "γ" + + ToolTip.visible: ToolTip.text && hovered + ToolTip.delay: 100 + ToolTip.text: "Reset Gamma" + + onClicked: { + gammaCtrl.value = gammaDefaultValue; + } + } + TextField { + id: gammaLabel + + ToolTip.visible: ToolTip.text && hovered + ToolTip.delay: 100 + ToolTip.text: "Apply Gamma (after Gain and in linear colorspace)" + + text: gammaValue.toFixed(2) + Layout.preferredWidth: textMetrics_gainValue.width + selectByMouse: true + validator: doubleValidator + onAccepted: { + gammaCtrl.value = Math.pow(Number(gammaLabel.text), 1.0/slidersPowerValue) + } + } + Slider { + id: gammaCtrl + Layout.fillWidth: true + from: 0.01 + to: 2 + value: gammaDefaultValue + stepSize: 0.01 + } + } + + } + TextMetrics { + id: textMetrics_gainValue + font: gainLabel.font + text: "1.2345" + } +} diff --git a/meshroom/ui/qml/Viewer/PanoramaViewer.qml b/meshroom/ui/qml/Viewer/PanoramaViewer.qml index 22c1d498..ad009726 100644 --- a/meshroom/ui/qml/Viewer/PanoramaViewer.qml +++ b/meshroom/ui/qml/Viewer/PanoramaViewer.qml @@ -27,8 +27,6 @@ AliceVision.PanoramaViewer { return Image.Null; root.defaultControlPoints(); - grid.recalculateCP(); - repeater.displayControlPoints(); return Image.Ready; } @@ -67,8 +65,11 @@ AliceVision.PanoramaViewer { Connections { target: root onVerticesChanged : { - if (reinit) - grid.recalculateCP() + if (reinit){ + grid.recalculateCP(); + grid.generateControlPoints(); + } + } } diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 5f088243..8518861f 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -16,6 +16,7 @@ FocusScope { property Component floatViewerComp: Qt.createComponent("FloatImage.qml") property alias useFloatImageViewer: displayHDR.checked property alias usePanoramaImageViewer: displayPanoramaViewer.checked + property bool displayGridPanorama: panoramaImageToolbar.displayGrid Loader { id: aliceVisionPluginLoader @@ -183,6 +184,13 @@ FocusScope { } } + PanoramaImageToolbar { + id: panoramaImageToolbar + anchors.margins: 0 + visible: displayPanoramaToolBarAction.checked && displayPanoramaToolBarAction.enabled + Layout.fillWidth: true + } + // Image Item { id: imgLayout @@ -228,6 +236,10 @@ FocusScope { setSource("", {}) } } + +// displayGridPanorama. :{ +// console.warn("Grid out ") +// } } // qtAliceVision Panorama Viewer @@ -244,9 +256,9 @@ FocusScope { // floatViewerComp.createObject(floatImageViewerLoader, { setSource("PanoramaViewer.qml", { 'source': Qt.binding(function() { return getImageFile(imageType.type); }), - 'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue; }), - 'gain': Qt.binding(function() { return hdrImageToolbar.gainValue; }), - 'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue; }), + 'gamma': Qt.binding(function() { return panoramaImageToolbar.gammaValue; }), + 'gain': Qt.binding(function() { return panoramaImageToolbar.gainValue; }), + 'channelModeString': Qt.binding(function() { return panoramaImageToolbar.channelModeValue; }), }) } else { // Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 @@ -717,7 +729,8 @@ FocusScope { Layout.minimumWidth: 0 checkable: true } - MaterialToolButton { + MaterialToolButton + { id: displayHDR ToolTip.text: "High-Dynamic-Range Image Viewer" text: MaterialIcons.hdr_on @@ -734,8 +747,6 @@ FocusScope { id: displayPanoramaViewer ToolTip.text: "Panorama Viewer" text: MaterialIcons.panorama_horizontal - // larger font but smaller padding, - // so it is visually similar. font.pointSize: 16 padding: 0 Layout.minimumWidth: 0 diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index ab6807dc..0c9996fa 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -105,6 +105,13 @@ Item { checked: true enabled: viewer2D.useFloatImageViewer } + Action { + id: displayPanoramaToolBarAction + text: "Display Panorama Toolbar" + checkable: true + checked: true + enabled: viewer2D.usePanoramaImageViewer + } Action { id: displayImagePathAction text: "Display Image Path"