Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Shortcut to make widgets in fullscreen mode #2467

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion meshroom/ui/qml/ImageGallery/ImageGallery.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Utils 1.0
*/
Panel {
id: root
visible: settings_UILayout.showImageGallery

property variant cameraInits
property variant cameraInit
Expand All @@ -32,12 +33,13 @@ Panel {
property int nbMeshroomScenes: 0
property int nbDraggedFiles: 0

property alias mouseArea: mouseArea

signal removeImageRequest(var attribute)
signal allViewpointsCleared()
signal filesDropped(var drop, var augmentSfm)

title: "Image Gallery"
implicitWidth: (root.defaultCellSize + 2) * 2

Connections {
target: _reconstruction
Expand Down Expand Up @@ -530,7 +532,9 @@ Panel {
}

MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onPressed: {
if (mouse.button == Qt.LeftButton)
grid.forceActiveFocus()
Expand Down
4 changes: 4 additions & 0 deletions meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ FocusScope {
property alias currentFrame: sequencePlayer.frameId
property alias frameRange: sequencePlayer.frameRange

property alias mouseArea: mouseArea

QtObject {
id: m
property variant viewpointMetadata: {
Expand Down Expand Up @@ -114,9 +116,11 @@ FocusScope {

// mouse area
MouseArea {
id: mouseArea
anchors.fill: parent
property double factor: 1.2
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
hoverEnabled: true
onPressed: {
imgContainer.forceActiveFocus()
if (mouse.button & Qt.MiddleButton || (mouse.button & Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier))
Expand Down
1 change: 1 addition & 0 deletions meshroom/ui/qml/Viewer3D/DefaultCameraController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Entity {
property alias rotationSpeed: trackball.rotationSpeed
property alias windowSize: trackball.windowSize
property alias trackballSize: trackball.trackballSize
property alias mouseHandler: mouseHandler

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

Expand Down
1 change: 1 addition & 0 deletions meshroom/ui/qml/Viewer3D/Viewer3D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ FocusScope {

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

// functions
function resetCameraPosition() {
Expand Down
35 changes: 26 additions & 9 deletions meshroom/ui/qml/WorkspaceView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Item {
readonly property variant cameraInits: _reconstruction ? _reconstruction.cameraInits : null
property bool readOnly: false
property alias panel3dViewer: panel3dViewerLoader.item
property alias viewer3DContainer: panel3dViewerContainer
readonly property Viewer2D viewer2D: viewer2D
readonly property alias imageGallery: imageGallery

Expand Down Expand Up @@ -66,12 +67,20 @@ Item {

Controls1.SplitView {
orientation: Qt.Vertical
Layout.fillHeight: true
implicitWidth: Math.round(parent.width * 0.2)
SplitView.fillHeight: true

Layout.minimumWidth: imageGallery.defaultCellSize
implicitWidth: (imageGallery.defaultCellSize + 2) * 2
Layout.fillWidth: imageGallery.isFullScreen
Layout.maximumWidth: imageGallery.isFullScreen ? parent.width : (imageGallery.defaultCellSize + 2) * 4

visible: settings_UILayout.showImageGallery || settings_UILayout.showLiveReconstruction

ImageGallery {
id: imageGallery
property bool isFullScreen: settings_UILayout.showImageGallery && !settings_UILayout.showLiveReconstruction && !settings_UILayout.showImageViewer && !settings_UILayout.showViewer3D && !settings_UILayout.showGraphEditor
Layout.fillWidth: isFullScreen
anchors.fill: parent
Layout.fillHeight: true
readOnly: root.readOnly
cameraInits: root.cameraInits
Expand All @@ -93,8 +102,7 @@ Item {
LiveSfmView {
visible: settings_UILayout.showLiveReconstruction
reconstruction: root.reconstruction
Layout.fillWidth: true
Layout.preferredHeight: childrenRect.height
SplitView.preferredHeight: childrenRect.height
}
}

Expand All @@ -103,8 +111,12 @@ Item {
visible: settings_UILayout.showImageViewer
implicitWidth: Math.round(parent.width * 0.35)
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumWidth: 50

property bool isFullScreen: !settings_UILayout.showImageGallery && !settings_UILayout.showLiveReconstruction && settings_UILayout.showImageViewer && !settings_UILayout.showViewer3D && !settings_UILayout.showGraphEditor

Layout.fillWidth: isFullScreen

Layout.minimumWidth: visible ? 50 : 0
loading: viewer2D.loadingModules.length > 0
loadingText: loading ? "Loading " + viewer2D.loadingModules : ""

Expand Down Expand Up @@ -184,13 +196,18 @@ Item {
}
}

Item {
Page {
id: panel3dViewerContainer
visible: settings_UILayout.showViewer3D
Layout.minimumWidth: 20
Layout.minimumHeight: 80
Layout.minimumWidth: visible ? 200 : 0
Layout.minimumHeight: visible ? 80 : 0
Layout.fillHeight: true
implicitWidth: Math.round(parent.width * 0.45)

property bool isFullScreen: !settings_UILayout.showImageGallery && !settings_UILayout.showLiveReconstruction && !settings_UILayout.showImageViewer && settings_UILayout.showViewer3D && !settings_UILayout.showGraphEditor

Layout.fillWidth: isFullScreen

Loader {
id: panel3dViewerLoader
active: settings_UILayout.showViewer3D
Expand Down
81 changes: 79 additions & 2 deletions meshroom/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ ApplicationWindow {
property alias showGraphEditor: graphEditorVisibilityCB.checked
property alias showImageViewer: imageViewerVisibilityCB.checked
property alias showViewer3D: viewer3DVisibilityCB.checked
property alias showImageGallery: imageGalleryVisibilityCB.checked
}

Component.onDestruction: {
Expand All @@ -112,6 +113,67 @@ ApplicationWindow {
onActivated: ensureSaved(function() { _reconstruction.new() })
}

// Action to put component with mouse focus in fullscreen
Action {
id: showFullScreenAction

property bool isFullScreen: false
property Settings settingsBeforeFullScreen: Settings {
property bool showLiveReconstruction: false
property bool showImageViewer: false
property bool showViewer3D: false
property bool showGraphEditor: false
property bool showImageGallery: false
}

function setSettingsBeforeFullScreen(setting) {
settingsBeforeFullScreen.showLiveReconstruction = settings_UILayout.showLiveReconstruction
settingsBeforeFullScreen.showImageViewer = settings_UILayout.showImageViewer
settingsBeforeFullScreen.showViewer3D = settings_UILayout.showViewer3D
settingsBeforeFullScreen.showGraphEditor = settings_UILayout.showGraphEditor
settingsBeforeFullScreen.showImageGallery = settings_UILayout.showImageGallery

// set all to false except the one that triggered the fullscreen
for (var name in settings_UILayout) {
if (name !== setting && !settings_UILayout[name].readOnly && typeof settings_UILayout[name] === "boolean")
settings_UILayout[name] = false
}

isFullScreen = true
}

function setSettingsAfterFullScreen() {
settings_UILayout.showLiveReconstruction = settingsBeforeFullScreen.showLiveReconstruction
settings_UILayout.showImageViewer = settingsBeforeFullScreen.showImageViewer
settings_UILayout.showViewer3D = settingsBeforeFullScreen.showViewer3D
settings_UILayout.showGraphEditor = settingsBeforeFullScreen.showGraphEditor
settings_UILayout.showImageGallery = settingsBeforeFullScreen.showImageGallery
}

shortcut: "Shift+F"
onTriggered: {
if (isFullScreen) {
setSettingsAfterFullScreen()
if (settings_UILayout.showGraphEditor)
graphEditor.fit()

isFullScreen = false
return
} else {
if (workspaceView.viewer2D.mouseArea.containsMouse) {
setSettingsBeforeFullScreen("showImageViewer")
} else if (workspaceView.imageGallery.mouseArea.containsMouse) {
setSettingsBeforeFullScreen("showImageGallery")
} else if (workspaceView.viewer3DContainer.hovered) {
setSettingsBeforeFullScreen("showViewer3D")
} else if (graphEditorPanel.hovered) {
setSettingsBeforeFullScreen("showGraphEditor")
graphEditor.fit()
}
}
}
}

MessageDialog {
id: unsavedDialog

Expand Down Expand Up @@ -896,6 +958,12 @@ ApplicationWindow {
checkable: true
checked: true
}
MenuItem {
id: imageGalleryVisibilityCB
text: "Image Gallery"
checkable: true
checked: true
}
MenuSeparator {}
Action {
text: "Fullscreen"
Expand Down Expand Up @@ -1045,7 +1113,7 @@ ApplicationWindow {
id: workspaceView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: 50
Layout.minimumHeight: graphEditorPanel.parent.isFullScreen ? 50 : 0
reconstruction: _reconstruction
readOnly: _reconstruction ? _reconstruction.computing : false

Expand Down Expand Up @@ -1081,14 +1149,21 @@ ApplicationWindow {
Controls1.SplitView {
orientation: Qt.Horizontal
width: parent.width
height: Math.round(parent.height * 0.3)

Layout.minimumHeight: graphEditorPanel.isFullScreen ? _window.height : 50
Layout.maximumHeight: graphEditorPanel.isFullScreen ? _window.height : Math.round(_window.height * 0.4)
visible: settings_UILayout.showGraphEditor

TabPanel {
id: graphEditorPanel
Layout.fillWidth: true

property bool isFullScreen: !settings_UILayout.showImageGallery && !settings_UILayout.showLiveReconstruction && !settings_UILayout.showImageViewer && !settings_UILayout.showViewer3D && settings_UILayout.showGraphEditor

implicitHeight: Math.round(_window.height * 0.3)
padding: 4
tabs: ["Graph Editor", "Task Manager", "Script Editor"]
hoverEnabled: true

headerBar: RowLayout {
MaterialToolButton {
Expand Down Expand Up @@ -1261,6 +1336,8 @@ ApplicationWindow {
_reconstruction.handleFilesUrl(filesByType, null, mousePosition)
}
}


}

TaskManager {
Expand Down
Loading