Skip to content

Commit 972b31d

Browse files
committed
[ui] Shortcut to make widgets in fullscreen mode
1 parent cf656b6 commit 972b31d

File tree

6 files changed

+116
-12
lines changed

6 files changed

+116
-12
lines changed

meshroom/ui/qml/ImageGallery/ImageGallery.qml

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Utils 1.0
1414
*/
1515
Panel {
1616
id: root
17+
visible: settings_UILayout.showImageGallery
1718

1819
property variant cameraInits
1920
property variant cameraInit
@@ -32,12 +33,13 @@ Panel {
3233
property int nbMeshroomScenes: 0
3334
property int nbDraggedFiles: 0
3435

36+
property alias mouseArea: mouseArea
37+
3538
signal removeImageRequest(var attribute)
3639
signal allViewpointsCleared()
3740
signal filesDropped(var drop, var augmentSfm)
3841

3942
title: "Image Gallery"
40-
implicitWidth: (root.defaultCellSize + 2) * 2
4143

4244
Connections {
4345
target: _reconstruction
@@ -530,7 +532,9 @@ Panel {
530532
}
531533

532534
MouseArea {
535+
id: mouseArea
533536
anchors.fill: parent
537+
hoverEnabled: true
534538
onPressed: {
535539
if (mouse.button == Qt.LeftButton)
536540
grid.forceActiveFocus()

meshroom/ui/qml/Viewer/Viewer2D.qml

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ FocusScope {
3636
property alias currentFrame: sequencePlayer.frameId
3737
property alias frameRange: sequencePlayer.frameRange
3838

39+
property alias mouseArea: mouseArea
40+
3941
QtObject {
4042
id: m
4143
property variant viewpointMetadata: {
@@ -114,9 +116,11 @@ FocusScope {
114116

115117
// mouse area
116118
MouseArea {
119+
id: mouseArea
117120
anchors.fill: parent
118121
property double factor: 1.2
119122
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
123+
hoverEnabled: true
120124
onPressed: {
121125
imgContainer.forceActiveFocus()
122126
if (mouse.button & Qt.MiddleButton || (mouse.button & Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier))

meshroom/ui/qml/Viewer3D/DefaultCameraController.qml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Entity {
2222
property alias rotationSpeed: trackball.rotationSpeed
2323
property alias windowSize: trackball.windowSize
2424
property alias trackballSize: trackball.trackballSize
25+
property alias mouseHandler: mouseHandler
2526

2627
property bool loseMouseFocus: false // Must be changed by other entities when they want to take mouse focus
2728

meshroom/ui/qml/Viewer3D/Viewer3D.qml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ FocusScope {
2828

2929
readonly property var viewpoint: _reconstruction ? _reconstruction.selectedViewpoint : null
3030
readonly property bool doSyncViewpointCamera: Viewer3DSettings.syncViewpointCamera && (viewpoint && viewpoint.isReconstructed)
31+
property alias mouseArea: cameraController
3132

3233
// functions
3334
function resetCameraPosition() {

meshroom/ui/qml/WorkspaceView.qml

+26-9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Item {
2323
readonly property variant cameraInits: _reconstruction ? _reconstruction.cameraInits : null
2424
property bool readOnly: false
2525
property alias panel3dViewer: panel3dViewerLoader.item
26+
property alias viewer3DContainer: panel3dViewerContainer
2627
readonly property Viewer2D viewer2D: viewer2D
2728
readonly property alias imageGallery: imageGallery
2829

@@ -66,12 +67,20 @@ Item {
6667

6768
Controls1.SplitView {
6869
orientation: Qt.Vertical
69-
Layout.fillHeight: true
70-
implicitWidth: Math.round(parent.width * 0.2)
70+
SplitView.fillHeight: true
71+
7172
Layout.minimumWidth: imageGallery.defaultCellSize
73+
implicitWidth: (imageGallery.defaultCellSize + 2) * 2
74+
Layout.fillWidth: imageGallery.isFullScreen
75+
Layout.maximumWidth: imageGallery.isFullScreen ? parent.width : (imageGallery.defaultCellSize + 2) * 4
76+
77+
visible: settings_UILayout.showImageGallery || settings_UILayout.showLiveReconstruction
7278

7379
ImageGallery {
7480
id: imageGallery
81+
property bool isFullScreen: settings_UILayout.showImageGallery && !settings_UILayout.showLiveReconstruction && !settings_UILayout.showImageViewer && !settings_UILayout.showViewer3D && !settings_UILayout.showGraphEditor
82+
Layout.fillWidth: isFullScreen
83+
anchors.fill: parent
7584
Layout.fillHeight: true
7685
readOnly: root.readOnly
7786
cameraInits: root.cameraInits
@@ -93,8 +102,7 @@ Item {
93102
LiveSfmView {
94103
visible: settings_UILayout.showLiveReconstruction
95104
reconstruction: root.reconstruction
96-
Layout.fillWidth: true
97-
Layout.preferredHeight: childrenRect.height
105+
SplitView.preferredHeight: childrenRect.height
98106
}
99107
}
100108

@@ -103,8 +111,12 @@ Item {
103111
visible: settings_UILayout.showImageViewer
104112
implicitWidth: Math.round(parent.width * 0.35)
105113
Layout.fillHeight: true
106-
Layout.fillWidth: true
107-
Layout.minimumWidth: 50
114+
115+
property bool isFullScreen: !settings_UILayout.showImageGallery && !settings_UILayout.showLiveReconstruction && settings_UILayout.showImageViewer && !settings_UILayout.showViewer3D && !settings_UILayout.showGraphEditor
116+
117+
Layout.fillWidth: isFullScreen
118+
119+
Layout.minimumWidth: visible ? 50 : 0
108120
loading: viewer2D.loadingModules.length > 0
109121
loadingText: loading ? "Loading " + viewer2D.loadingModules : ""
110122

@@ -184,13 +196,18 @@ Item {
184196
}
185197
}
186198

187-
Item {
199+
Page {
200+
id: panel3dViewerContainer
188201
visible: settings_UILayout.showViewer3D
189-
Layout.minimumWidth: 20
190-
Layout.minimumHeight: 80
202+
Layout.minimumWidth: visible ? 200 : 0
203+
Layout.minimumHeight: visible ? 80 : 0
191204
Layout.fillHeight: true
192205
implicitWidth: Math.round(parent.width * 0.45)
193206

207+
property bool isFullScreen: !settings_UILayout.showImageGallery && !settings_UILayout.showLiveReconstruction && !settings_UILayout.showImageViewer && settings_UILayout.showViewer3D && !settings_UILayout.showGraphEditor
208+
209+
Layout.fillWidth: isFullScreen
210+
194211
Loader {
195212
id: panel3dViewerLoader
196213
active: settings_UILayout.showViewer3D

meshroom/ui/qml/main.qml

+79-2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ ApplicationWindow {
9797
property alias showGraphEditor: graphEditorVisibilityCB.checked
9898
property alias showImageViewer: imageViewerVisibilityCB.checked
9999
property alias showViewer3D: viewer3DVisibilityCB.checked
100+
property alias showImageGallery: imageGalleryVisibilityCB.checked
100101
}
101102

102103
Component.onDestruction: {
@@ -112,6 +113,67 @@ ApplicationWindow {
112113
onActivated: ensureSaved(function() { _reconstruction.new() })
113114
}
114115

116+
// Action to put component with mouse focus in fullscreen
117+
Action {
118+
id: showFullScreenAction
119+
120+
property bool isFullScreen: false
121+
property Settings settingsBeforeFullScreen: Settings {
122+
property bool showLiveReconstruction: false
123+
property bool showImageViewer: false
124+
property bool showViewer3D: false
125+
property bool showGraphEditor: false
126+
property bool showImageGallery: false
127+
}
128+
129+
function setSettingsBeforeFullScreen(setting) {
130+
settingsBeforeFullScreen.showLiveReconstruction = settings_UILayout.showLiveReconstruction
131+
settingsBeforeFullScreen.showImageViewer = settings_UILayout.showImageViewer
132+
settingsBeforeFullScreen.showViewer3D = settings_UILayout.showViewer3D
133+
settingsBeforeFullScreen.showGraphEditor = settings_UILayout.showGraphEditor
134+
settingsBeforeFullScreen.showImageGallery = settings_UILayout.showImageGallery
135+
136+
// set all to false except the one that triggered the fullscreen
137+
for (var name in settings_UILayout) {
138+
if (name !== setting && !settings_UILayout[name].readOnly && typeof settings_UILayout[name] === "boolean")
139+
settings_UILayout[name] = false
140+
}
141+
142+
isFullScreen = true
143+
}
144+
145+
function setSettingsAfterFullScreen() {
146+
settings_UILayout.showLiveReconstruction = settingsBeforeFullScreen.showLiveReconstruction
147+
settings_UILayout.showImageViewer = settingsBeforeFullScreen.showImageViewer
148+
settings_UILayout.showViewer3D = settingsBeforeFullScreen.showViewer3D
149+
settings_UILayout.showGraphEditor = settingsBeforeFullScreen.showGraphEditor
150+
settings_UILayout.showImageGallery = settingsBeforeFullScreen.showImageGallery
151+
}
152+
153+
shortcut: "Shift+F"
154+
onTriggered: {
155+
if (isFullScreen) {
156+
setSettingsAfterFullScreen()
157+
if (settings_UILayout.showGraphEditor)
158+
graphEditor.fit()
159+
160+
isFullScreen = false
161+
return
162+
} else {
163+
if (workspaceView.viewer2D.mouseArea.containsMouse) {
164+
setSettingsBeforeFullScreen("showImageViewer")
165+
} else if (workspaceView.imageGallery.mouseArea.containsMouse) {
166+
setSettingsBeforeFullScreen("showImageGallery")
167+
} else if (workspaceView.viewer3DContainer.hovered) {
168+
setSettingsBeforeFullScreen("showViewer3D")
169+
} else if (graphEditorPanel.hovered) {
170+
setSettingsBeforeFullScreen("showGraphEditor")
171+
graphEditor.fit()
172+
}
173+
}
174+
}
175+
}
176+
115177
MessageDialog {
116178
id: unsavedDialog
117179

@@ -896,6 +958,12 @@ ApplicationWindow {
896958
checkable: true
897959
checked: true
898960
}
961+
MenuItem {
962+
id: imageGalleryVisibilityCB
963+
text: "Image Gallery"
964+
checkable: true
965+
checked: true
966+
}
899967
MenuSeparator {}
900968
Action {
901969
text: "Fullscreen"
@@ -1045,7 +1113,7 @@ ApplicationWindow {
10451113
id: workspaceView
10461114
Layout.fillWidth: true
10471115
Layout.fillHeight: true
1048-
Layout.minimumHeight: 50
1116+
Layout.minimumHeight: graphEditorPanel.parent.isFullScreen ? 50 : 0
10491117
reconstruction: _reconstruction
10501118
readOnly: _reconstruction ? _reconstruction.computing : false
10511119

@@ -1081,14 +1149,21 @@ ApplicationWindow {
10811149
Controls1.SplitView {
10821150
orientation: Qt.Horizontal
10831151
width: parent.width
1084-
height: Math.round(parent.height * 0.3)
1152+
1153+
Layout.minimumHeight: graphEditorPanel.isFullScreen ? _window.height : 50
1154+
Layout.maximumHeight: graphEditorPanel.isFullScreen ? _window.height : Math.round(_window.height * 0.4)
10851155
visible: settings_UILayout.showGraphEditor
10861156

10871157
TabPanel {
10881158
id: graphEditorPanel
10891159
Layout.fillWidth: true
1160+
1161+
property bool isFullScreen: !settings_UILayout.showImageGallery && !settings_UILayout.showLiveReconstruction && !settings_UILayout.showImageViewer && !settings_UILayout.showViewer3D && settings_UILayout.showGraphEditor
1162+
1163+
implicitHeight: Math.round(_window.height * 0.3)
10901164
padding: 4
10911165
tabs: ["Graph Editor", "Task Manager", "Script Editor"]
1166+
hoverEnabled: true
10921167

10931168
headerBar: RowLayout {
10941169
MaterialToolButton {
@@ -1261,6 +1336,8 @@ ApplicationWindow {
12611336
_reconstruction.handleFilesUrl(filesByType, null, mousePosition)
12621337
}
12631338
}
1339+
1340+
12641341
}
12651342

12661343
TaskManager {

0 commit comments

Comments
 (0)