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