mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-23 22:16:30 +02:00
[PanoramaViewer] add panorama toolbar
This commit is contained in:
parent
48d118e4fe
commit
6a152ca69a
4 changed files with 174 additions and 10 deletions
145
meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml
Normal file
145
meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,8 +27,6 @@ AliceVision.PanoramaViewer {
|
||||||
return Image.Null;
|
return Image.Null;
|
||||||
|
|
||||||
root.defaultControlPoints();
|
root.defaultControlPoints();
|
||||||
grid.recalculateCP();
|
|
||||||
repeater.displayControlPoints();
|
|
||||||
|
|
||||||
return Image.Ready;
|
return Image.Ready;
|
||||||
}
|
}
|
||||||
|
@ -67,8 +65,11 @@ AliceVision.PanoramaViewer {
|
||||||
Connections {
|
Connections {
|
||||||
target: root
|
target: root
|
||||||
onVerticesChanged : {
|
onVerticesChanged : {
|
||||||
if (reinit)
|
if (reinit){
|
||||||
grid.recalculateCP()
|
grid.recalculateCP();
|
||||||
|
grid.generateControlPoints();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ FocusScope {
|
||||||
property Component floatViewerComp: Qt.createComponent("FloatImage.qml")
|
property Component floatViewerComp: Qt.createComponent("FloatImage.qml")
|
||||||
property alias useFloatImageViewer: displayHDR.checked
|
property alias useFloatImageViewer: displayHDR.checked
|
||||||
property alias usePanoramaImageViewer: displayPanoramaViewer.checked
|
property alias usePanoramaImageViewer: displayPanoramaViewer.checked
|
||||||
|
property bool displayGridPanorama: panoramaImageToolbar.displayGrid
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: aliceVisionPluginLoader
|
id: aliceVisionPluginLoader
|
||||||
|
@ -183,6 +184,13 @@ FocusScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PanoramaImageToolbar {
|
||||||
|
id: panoramaImageToolbar
|
||||||
|
anchors.margins: 0
|
||||||
|
visible: displayPanoramaToolBarAction.checked && displayPanoramaToolBarAction.enabled
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
// Image
|
// Image
|
||||||
Item {
|
Item {
|
||||||
id: imgLayout
|
id: imgLayout
|
||||||
|
@ -228,6 +236,10 @@ FocusScope {
|
||||||
setSource("", {})
|
setSource("", {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// displayGridPanorama. :{
|
||||||
|
// console.warn("Grid out ")
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// qtAliceVision Panorama Viewer
|
// qtAliceVision Panorama Viewer
|
||||||
|
@ -244,9 +256,9 @@ FocusScope {
|
||||||
// floatViewerComp.createObject(floatImageViewerLoader, {
|
// floatViewerComp.createObject(floatImageViewerLoader, {
|
||||||
setSource("PanoramaViewer.qml", {
|
setSource("PanoramaViewer.qml", {
|
||||||
'source': Qt.binding(function() { return getImageFile(imageType.type); }),
|
'source': Qt.binding(function() { return getImageFile(imageType.type); }),
|
||||||
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue; }),
|
'gamma': Qt.binding(function() { return panoramaImageToolbar.gammaValue; }),
|
||||||
'gain': Qt.binding(function() { return hdrImageToolbar.gainValue; }),
|
'gain': Qt.binding(function() { return panoramaImageToolbar.gainValue; }),
|
||||||
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue; }),
|
'channelModeString': Qt.binding(function() { return panoramaImageToolbar.channelModeValue; }),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
|
// 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
|
Layout.minimumWidth: 0
|
||||||
checkable: true
|
checkable: true
|
||||||
}
|
}
|
||||||
MaterialToolButton {
|
MaterialToolButton
|
||||||
|
{
|
||||||
id: displayHDR
|
id: displayHDR
|
||||||
ToolTip.text: "High-Dynamic-Range Image Viewer"
|
ToolTip.text: "High-Dynamic-Range Image Viewer"
|
||||||
text: MaterialIcons.hdr_on
|
text: MaterialIcons.hdr_on
|
||||||
|
@ -734,8 +747,6 @@ FocusScope {
|
||||||
id: displayPanoramaViewer
|
id: displayPanoramaViewer
|
||||||
ToolTip.text: "Panorama Viewer"
|
ToolTip.text: "Panorama Viewer"
|
||||||
text: MaterialIcons.panorama_horizontal
|
text: MaterialIcons.panorama_horizontal
|
||||||
// larger font but smaller padding,
|
|
||||||
// so it is visually similar.
|
|
||||||
font.pointSize: 16
|
font.pointSize: 16
|
||||||
padding: 0
|
padding: 0
|
||||||
Layout.minimumWidth: 0
|
Layout.minimumWidth: 0
|
||||||
|
|
|
@ -105,6 +105,13 @@ Item {
|
||||||
checked: true
|
checked: true
|
||||||
enabled: viewer2D.useFloatImageViewer
|
enabled: viewer2D.useFloatImageViewer
|
||||||
}
|
}
|
||||||
|
Action {
|
||||||
|
id: displayPanoramaToolBarAction
|
||||||
|
text: "Display Panorama Toolbar"
|
||||||
|
checkable: true
|
||||||
|
checked: true
|
||||||
|
enabled: viewer2D.usePanoramaImageViewer
|
||||||
|
}
|
||||||
Action {
|
Action {
|
||||||
id: displayImagePathAction
|
id: displayImagePathAction
|
||||||
text: "Display Image Path"
|
text: "Display Image Path"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue