Skip to content
Snippets Groups Projects
Commit 0a7a6643 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

mainapplication: fix fullscreen management

Remove all references to appWindow.isFullScreen and uses visibility
Store latest state to keep previous states when passing the call
in fullscreen or a media player. Fix also fullscreen's transition
on media messages

Change-Id: I1b141fc052aa607561275faf231504f48b3c49b8
parent db0fd567
No related branches found
No related tags found
No related merge requests found
...@@ -47,12 +47,13 @@ ApplicationWindow { ...@@ -47,12 +47,13 @@ ApplicationWindow {
} }
property ApplicationWindow appWindow : root property ApplicationWindow appWindow : root
property bool isFullscreen: visibility === Window.FullScreen
function toggleFullScreen() { function toggleFullScreen() {
if (visibility !== Window.FullScreen) { if (isFullscreen) {
showFullScreen()
} else {
showNormal() showNormal()
} else {
showFullScreen()
} }
} }
......
...@@ -35,6 +35,7 @@ Loader { ...@@ -35,6 +35,7 @@ Loader {
property bool showTime: false property bool showTime: false
property int seq: MsgSeq.single property int seq: MsgSeq.single
property string author: Author property string author: Author
property bool changeWindowVisibility: false
width: ListView.view ? ListView.view.width : 0 width: ListView.view ? ListView.view.width : 0
...@@ -278,7 +279,7 @@ Loader { ...@@ -278,7 +279,7 @@ Loader {
settings.fullScreenSupportEnabled: mediaInfo.isVideo settings.fullScreenSupportEnabled: mediaInfo.isVideo
settings.javascriptCanOpenWindows: false settings.javascriptCanOpenWindows: false
Component.onCompleted: loadHtml(mediaInfo.html, 'file://') Component.onCompleted: loadHtml(mediaInfo.html, 'file://')
layer.enabled: parent !== appContainer && !appWindow.isFullScreen layer.enabled: parent !== appContainer && !appWindow.isFullscreen
layer.effect: OpacityMask { layer.effect: OpacityMask {
maskSource: MessageBubble { maskSource: MessageBubble {
out: isOutgoing out: isOutgoing
...@@ -288,20 +289,43 @@ Loader { ...@@ -288,20 +289,43 @@ Loader {
radius: msgRadius radius: msgRadius
} }
} }
function leaveFullScreen() {
parent = localMediaCompLoader
if (root.changeWindowVisibility) {
root.changeWindowVisibility = false
appWindow.showNormal()
}
}
onFullScreenRequested: function(request) { onFullScreenRequested: function(request) {
if (JamiQmlUtils.callIsFullscreen) if (JamiQmlUtils.callIsFullscreen)
return return
if (request.toggleOn && !appWindow.isFullScreen) { if (request.toggleOn) {
parent = appContainer parent = appContainer
appWindow.toggleFullScreen() if (!appWindow.isFullscreen) {
} else if (!request.toggleOn && appWindow.isFullScreen) { root.changeWindowVisibility = true
parent = localMediaCompLoader appWindow.showFullScreen()
appWindow.toggleFullScreen() }
} else {
leaveFullScreen()
} }
request.accept() request.accept()
} }
Connections {
target: appWindow
function onVisibilityChanged() {
if (wev.isFullScreen && !appWindow.isFullScreen) {
wev.fullScreenCancelled()
leaveFullScreen()
}
}
}
} }
} }
Component { Component {
id: animatedImageComp id: animatedImageComp
AnimatedImage { AnimatedImage {
......
...@@ -562,7 +562,7 @@ Rectangle { ...@@ -562,7 +562,7 @@ Rectangle {
onActivated: { onActivated: {
if (JamiQmlUtils.callIsFullscreen) if (JamiQmlUtils.callIsFullscreen)
callStackView.toggleFullScreen() callStackView.toggleFullScreen()
else if (appWindow.isFullScreen) else if (appWindow.visibility === Window.FullScreen)
appWindow.toggleFullScreen() appWindow.toggleFullScreen()
} }
} }
......
...@@ -26,9 +26,10 @@ import net.jami.Constants 1.1 ...@@ -26,9 +26,10 @@ import net.jami.Constants 1.1
import "../../commoncomponents" import "../../commoncomponents"
Rectangle { Rectangle {
id: callStackViewWindow id: root
property bool isAudioOnly: false property bool isAudioOnly: false
property bool changeWindowVisibility: false
property var sipKeys: [ property var sipKeys: [
"1", "2", "3", "A", "1", "2", "3", "A",
"4", "5", "6", "B", "4", "5", "6", "B",
...@@ -116,10 +117,13 @@ Rectangle { ...@@ -116,10 +117,13 @@ Rectangle {
// manual toggle here because of our fake fullscreen mode (F11) // manual toggle here because of our fake fullscreen mode (F11)
// TODO: handle and save window states, not just a boolean isFullScreen // TODO: handle and save window states, not just a boolean isFullScreen
if (!appWindow.isFullScreen && !JamiQmlUtils.callIsFullscreen) if (!appWindow.isFullscreen && !JamiQmlUtils.callIsFullscreen) {
appWindow.isFullScreen = true root.changeWindowVisibility = true
else if (JamiQmlUtils.callIsFullscreen) appWindow.showFullScreen()
appWindow.isFullScreen = false } else if (JamiQmlUtils.callIsFullscreen && root.changeWindowVisibility) {
root.changeWindowVisibility = false
appWindow.showNormal()
}
JamiQmlUtils.callIsFullscreen = !JamiQmlUtils.callIsFullscreen JamiQmlUtils.callIsFullscreen = !JamiQmlUtils.callIsFullscreen
callPage.parent = JamiQmlUtils.callIsFullscreen ? callPage.parent = JamiQmlUtils.callIsFullscreen ?
...@@ -134,7 +138,7 @@ Rectangle { ...@@ -134,7 +138,7 @@ Rectangle {
target: JamiQmlUtils target: JamiQmlUtils
function onFullScreenCallEnded() { function onFullScreenCallEnded() {
if (appWindow.isFullScreen) { if (appWindow.isFullscreen) {
toggleFullScreen() toggleFullScreen()
} }
} }
...@@ -173,7 +177,7 @@ Rectangle { ...@@ -173,7 +177,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
property int stackNumber: CallStackView.OngoingPageStack property int stackNumber: CallStackView.OngoingPageStack
isAudioOnly: callStackViewWindow.isAudioOnly isAudioOnly: root.isAudioOnly
visible: callStackMainView.currentItem.stackNumber === stackNumber visible: callStackMainView.currentItem.stackNumber === stackNumber
} }
...@@ -184,7 +188,7 @@ Rectangle { ...@@ -184,7 +188,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
property int stackNumber: CallStackView.InitialPageStack property int stackNumber: CallStackView.InitialPageStack
isAudioOnly: callStackViewWindow.isAudioOnly isAudioOnly: root.isAudioOnly
onCallAccepted: { onCallAccepted: {
CallAdapter.acceptACall(responsibleAccountId, responsibleConvUid) CallAdapter.acceptACall(responsibleAccountId, responsibleConvUid)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment