1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-22 06:02:03 +02:00

callview: hide mainview window on fullscreen

- hide / show mainview window on fullscreen switch in order to avoid undesirable UI transitions or incorrect layout (when working with multiple screens)
- update and show only on top page of callStackView
- back button always present on CallOverlay (use close button icon on fullscreen mode)

Gitlab: #135

Change-Id: I0d7c6aac26ba9c899ee97ac58f41f2746dda2148
This commit is contained in:
ababi 2020-10-09 17:58:08 +02:00 committed by Ming Rui Zhang
parent a0c461e2fa
commit 9d41a3bc6e
9 changed files with 91 additions and 70 deletions

View file

@ -22,6 +22,8 @@ pragma Singleton
import QtQuick 2.14 import QtQuick 2.14
Item { Item {
property bool callIsFullscreen: false
TextMetrics { TextMetrics {
id: globalTextMetrics id: globalTextMetrics
} }

View file

@ -201,7 +201,6 @@ Window {
callStackView.setLinkedWebview(communicationPageMessageWebView) callStackView.setLinkedWebview(communicationPageMessageWebView)
callStackView.responsibleAccountId = AccountAdapter.currentAccountId callStackView.responsibleAccountId = AccountAdapter.currentAccountId
callStackView.responsibleConvUid = currentUID callStackView.responsibleConvUid = currentUID
callStackView.updateCorrespondingUI()
if (callState === Call.Status.IN_PROGRESS || callState === Call.Status.PAUSED) { if (callState === Call.Status.IN_PROGRESS || callState === Call.Status.PAUSED) {
UtilsAdapter.setCurrentCall(AccountAdapter.currentAccountId, currentUID) UtilsAdapter.setCurrentCall(AccountAdapter.currentAccountId, currentUID)
@ -210,12 +209,12 @@ Window {
else else
callStackView.showVideoCallPage() callStackView.showVideoCallPage()
} else if (callState === Call.Status.INCOMING_RINGING) { } else if (callState === Call.Status.INCOMING_RINGING) {
callStackView.showIncomingCallPage(AccountAdapter.currentAccountId, callStackView.showIncomingCallPage()
currentUID)
} else { } else {
callStackView.showOutgoingCallPage(callState) callStackView.showOutgoingCallPage(callState)
} }
pushCallStackView() pushCallStackView()
} else if (!inSettingsView) { } else if (!inSettingsView) {
if (currentConvUID !== currentUID) { if (currentConvUID !== currentUID) {
callStackView.needToCloseInCallConversationAndPotentialWindow() callStackView.needToCloseInCallConversationAndPotentialWindow()
@ -250,6 +249,20 @@ Window {
} }
} }
Connections {
target: JamiQmlUtils
function onCallIsFullscreenChanged() {
if (JamiQmlUtils.callIsFullscreen) {
UtilsAdapter.setSystemTrayIconVisible(false)
mainViewWindow.hide()
} else {
UtilsAdapter.setSystemTrayIconVisible(true)
mainViewWindow.show()
}
}
}
StackLayout { StackLayout {
id: mainViewStackLayout id: mainViewStackLayout

View file

@ -33,8 +33,6 @@ Rectangle {
property var linkedWebview: null property var linkedWebview: null
signal showFullScreenReqested
function updateUI(accountId, convUid) { function updateUI(accountId, convUid) {
contactImage.updateImage(convUid) contactImage.updateImage(convUid)
bestName = UtilsAdapter.getBestName(accountId, convUid) bestName = UtilsAdapter.getBestName(accountId, convUid)

View file

@ -172,7 +172,8 @@ Rectangle {
Layout.leftMargin: JamiTheme.preferredMarginSize Layout.leftMargin: JamiTheme.preferredMarginSize
source: callStackView.isFullscreen ? "qrc:/images/icons/round-close-24px.svg" : source: JamiQmlUtils.callIsFullscreen ?
"qrc:/images/icons/round-close-24px.svg" :
"qrc:/images/icons/ic_arrow_back_24px.svg" "qrc:/images/icons/ic_arrow_back_24px.svg"
pressedColor: JamiTheme.invertedPressedButtonColor pressedColor: JamiTheme.invertedPressedButtonColor
@ -183,10 +184,10 @@ Rectangle {
toolTipText: qsTr("Toggle to display side panel") toolTipText: qsTr("Toggle to display side panel")
visible: mainViewWindow.sidePanelOnly visible: true
onClicked: { onClicked: {
if (callStackView.isFullscreen) { if (JamiQmlUtils.callIsFullscreen) {
callStackView.toggleFullScreen() callStackView.toggleFullScreen()
} else { } else {
mainViewWindow.showWelcomeView() mainViewWindow.showWelcomeView()

View file

@ -29,8 +29,6 @@ import "../js/callfullscreenwindowcontainercreation.js" as CallFullScreenWindowC
Rectangle { Rectangle {
id: callStackViewWindow id: callStackViewWindow
property bool isFullscreen: false
enum StackNumber { enum StackNumber {
IncomingPageStack, IncomingPageStack,
OutgoingPageStack, OutgoingPageStack,
@ -53,33 +51,34 @@ Rectangle {
property string responsibleAccountId: "" property string responsibleAccountId: ""
function needToCloseInCallConversationAndPotentialWindow() { function needToCloseInCallConversationAndPotentialWindow() {
audioCallPage.closeInCallConversation()
videoCallPage.closeInCallConversation()
// Close potential window, context menu releated windows. // Close potential window, context menu releated windows.
if (callStackMainView.currentItem.stackNumber === CallStackView.AudioPageStack) {
audioCallPage.closeInCallConversation()
CallFullScreenWindowContainerCreation.closeVideoCallFullScreenWindowContainer()
audioCallPage.closeContextMenuAndRelatedWindows() audioCallPage.closeContextMenuAndRelatedWindows()
} else if (callStackMainView.currentItem.stackNumber === CallStackView.VideoPageStack) {
videoCallPage.closeInCallConversation()
CallFullScreenWindowContainerCreation.closeVideoCallFullScreenWindowContainer() CallFullScreenWindowContainerCreation.closeVideoCallFullScreenWindowContainer()
videoCallPage.closeContextMenuAndRelatedWindows() videoCallPage.closeContextMenuAndRelatedWindows()
} }
function setLinkedWebview(webViewId) {
audioCallPage.setLinkedWebview(webViewId)
videoCallPage.setLinkedWebview(webViewId)
} }
function updateCorrespondingUI() { function setLinkedWebview(webViewId) {
audioCallPage.updateUI(responsibleAccountId, responsibleConvUid) if (callStackMainView.currentItem.stackNumber === CallStackView.AudioPageStack) {
outgoingCallPage.updateUI(responsibleAccountId, responsibleConvUid) audioCallPage.setLinkedWebview(webViewId)
incomingCallPage.updateUI(responsibleAccountId, responsibleConvUid) } else if (callStackMainView.currentItem.stackNumber === CallStackView.VideoPageStack) {
videoCallPage.updateUI(responsibleAccountId, responsibleConvUid) videoCallPage.setLinkedWebview(webViewId)
}
}
function getItemFromStack(itemNumber) {
return callStackMainView.find(function (item) {
return item.stackNumber === itemNumber
})
} }
function showAudioCallPage() { function showAudioCallPage() {
var itemToFind = callStackMainView.find(function (item) { var itemToFind = getItemFromStack(CallStackView.AudioPageStack)
return item.stackNumber === CallStackView.AudioPageStack
})
if (!itemToFind) { if (!itemToFind) {
callStackMainView.push(audioCallPage, StackView.Immediate) callStackMainView.push(audioCallPage, StackView.Immediate)
} else { } else {
@ -89,37 +88,27 @@ Rectangle {
} }
function showOutgoingCallPage() { function showOutgoingCallPage() {
var itemToFind = callStackMainView.find(function (item) { var itemToFind = getItemFromStack(CallStackView.OutgoingPageStack)
return item.stackNumber === CallStackView.OutgoingPageStack
})
if (!itemToFind) { if (!itemToFind) {
callStackMainView.push(outgoingCallPage, StackView.Immediate) callStackMainView.push(outgoingCallPage, StackView.Immediate)
} else { } else {
callStackMainView.pop(itemToFind, StackView.Immediate) callStackMainView.pop(itemToFind, StackView.Immediate)
} }
outgoingCallPage.updateUI(responsibleAccountId, responsibleConvUid)
} }
function showIncomingCallPage(accountId, convUid) { function showIncomingCallPage(accountId, convUid) {
var itemToFind = callStackMainView.find(function (item) { var itemToFind = getItemFromStack(CallStackView.IncomingPageStack)
return item.stackNumber === CallStackView.IncomingPageStack
})
if (!itemToFind) { if (!itemToFind) {
callStackMainView.push(incomingCallPage, StackView.Immediate) callStackMainView.push(incomingCallPage, StackView.Immediate)
} else { } else {
callStackMainView.pop(itemToFind, StackView.Immediate) callStackMainView.pop(itemToFind, StackView.Immediate)
} }
responsibleAccountId = accountId incomingCallPage.updateUI(responsibleAccountId, responsibleConvUid)
responsibleConvUid = convUid
incomingCallPage.updateUI(accountId, convUid)
} }
function showVideoCallPage() { function showVideoCallPage() {
var itemToFind = callStackMainView.find(function (item) { var itemToFind = getItemFromStack(CallStackView.VideoPageStack)
return item.stackNumber === CallStackView.VideoPageStack
})
if (!itemToFind) { if (!itemToFind) {
callStackMainView.push(videoCallPage, StackView.Immediate) callStackMainView.push(videoCallPage, StackView.Immediate)
} else { } else {
@ -132,8 +121,10 @@ Rectangle {
} }
function toggleFullScreen() { function toggleFullScreen() {
isFullscreen = !isFullscreen JamiQmlUtils.callIsFullscreen = !JamiQmlUtils.callIsFullscreen
var callPage = callStackMainView.currentItem var callPage = callStackMainView.currentItem
if (!callPage)
return
CallFullScreenWindowContainerCreation.createvideoCallFullScreenWindowContainerObject() CallFullScreenWindowContainerCreation.createvideoCallFullScreenWindowContainerObject()
if (!CallFullScreenWindowContainerCreation.checkIfVisible()) { if (!CallFullScreenWindowContainerCreation.checkIfVisible()) {
@ -144,9 +135,7 @@ Rectangle {
CallFullScreenWindowContainerCreation.closeVideoCallFullScreenWindowContainer() CallFullScreenWindowContainerCreation.closeVideoCallFullScreenWindowContainer()
} }
if (callStackMainView.find(function (item) { if (callPage.stackNumber === CallStackView.VideoPageStack) {
return item.stackNumber === CallStackView.VideoPageStack
})) {
videoCallPage.handleParticipantsInfo(CallAdapter.getConferencesInfos()) videoCallPage.handleParticipantsInfo(CallAdapter.getConferencesInfos())
} }
} }
@ -155,23 +144,28 @@ Rectangle {
target: CallAdapter target: CallAdapter
function onCallStatusChanged(status, accountId, convUid) { function onCallStatusChanged(status, accountId, convUid) {
if (responsibleConvUid === convUid && responsibleAccountId === accountId) { if (callStackMainView.currentItem.stackNumber === CallStackView.OutgoingPageStack
&& responsibleConvUid === convUid && responsibleAccountId === accountId) {
outgoingCallPage.callStatus = status outgoingCallPage.callStatus = status
} }
} }
function onUpdateParticipantsInfos(infos, accountId, callId) { function onUpdateParticipantsInfos(infos, accountId, callId) {
if (callStackMainView.currentItem.stackNumber === CallStackView.VideoPageStack) {
var responsibleCallId = UtilsAdapter.getCallId(responsibleAccountId, responsibleConvUid) var responsibleCallId = UtilsAdapter.getCallId(responsibleAccountId, responsibleConvUid)
if (responsibleCallId === callId) { if (responsibleCallId === callId) {
videoCallPage.handleParticipantsInfo(infos) videoCallPage.handleParticipantsInfo(infos)
} }
} }
} }
}
AudioCallPage { AudioCallPage {
id: audioCallPage id: audioCallPage
property int stackNumber: CallStackView.AudioPageStack property int stackNumber: CallStackView.AudioPageStack
visible: callStackMainView.currentItem.stackNumber === stackNumber
} }
OutgoingCallPage { OutgoingCallPage {
@ -179,6 +173,8 @@ Rectangle {
property int stackNumber: CallStackView.OutgoingPageStack property int stackNumber: CallStackView.OutgoingPageStack
visible: callStackMainView.currentItem.stackNumber === stackNumber
onCallCancelButtonIsClicked: { onCallCancelButtonIsClicked: {
CallAdapter.hangUpACall(responsibleAccountId, responsibleConvUid) CallAdapter.hangUpACall(responsibleAccountId, responsibleConvUid)
} }
@ -189,6 +185,7 @@ Rectangle {
property int stackNumber: CallStackView.VideoPageStack property int stackNumber: CallStackView.VideoPageStack
visible: callStackMainView.currentItem.stackNumber === stackNumber
} }
IncomingCallPage { IncomingCallPage {
@ -205,6 +202,8 @@ Rectangle {
onCallCancelButtonIsClicked: { onCallCancelButtonIsClicked: {
CallAdapter.hangUpACall(responsibleAccountId, responsibleConvUid) CallAdapter.hangUpACall(responsibleAccountId, responsibleConvUid)
} }
visible: callStackMainView.currentItem.stackNumber === stackNumber
} }
StackView { StackView {

View file

@ -73,9 +73,10 @@ Item {
}) })
if (isAudioOnly && !isPaused) if (isAudioOnly && !isPaused)
ContextMenuGenerator.addMenuItem(callStackView.isFullscreen ? JamiStrings.exitFullScreen : ContextMenuGenerator.addMenuItem(
JamiQmlUtils.callIsFullscreen ? JamiStrings.exitFullScreen :
JamiStrings.fullScreen, JamiStrings.fullScreen,
callStackView.isFullscreen ? JamiQmlUtils.callIsFullscreen ?
"qrc:/images/icons/close_fullscreen-24px.svg" : "qrc:/images/icons/close_fullscreen-24px.svg" :
"qrc:/images/icons/open_in_full-24px.svg", "qrc:/images/icons/open_in_full-24px.svg",
function (){ function (){
@ -83,9 +84,10 @@ Item {
}) })
if (!isAudioOnly && !isPaused) { if (!isAudioOnly && !isPaused) {
ContextMenuGenerator.addMenuItem(callStackView.isFullscreen ? JamiStrings.exitFullScreen : ContextMenuGenerator.addMenuItem(
JamiQmlUtils.callIsFullscreen ? JamiStrings.exitFullScreen :
JamiStrings.fullScreen, JamiStrings.fullScreen,
callStackView.isFullscreen ? JamiQmlUtils.callIsFullscreen ?
"qrc:/images/icons/close_fullscreen-24px.svg" : "qrc:/images/icons/close_fullscreen-24px.svg" :
"qrc:/images/icons/open_in_full-24px.svg", "qrc:/images/icons/open_in_full-24px.svg",
function (){ function (){

View file

@ -40,8 +40,6 @@ Rectangle {
property var linkedWebview: null property var linkedWebview: null
signal showFullScreenReqested
function updateUI(accountId, convUid) { function updateUI(accountId, convUid) {
videoCallOverlay.handleParticipantsInfo(CallAdapter.getConferencesInfos()) videoCallOverlay.handleParticipantsInfo(CallAdapter.getConferencesInfos())

View file

@ -22,6 +22,7 @@
#include "utilsadapter.h" #include "utilsadapter.h"
#include "globalsystemtray.h"
#include "lrcinstance.h" #include "lrcinstance.h"
#include "utils.h" #include "utils.h"
#include "version.h" #include "version.h"
@ -381,3 +382,9 @@ UtilsAdapter::humanFileSize(qint64 fileSize)
{ {
return Utils::humanFileSize(fileSize); return Utils::humanFileSize(fileSize);
} }
void
UtilsAdapter::setSystemTrayIconVisible(bool visible)
{
GlobalSystemTray::instance().setVisible(visible);
}

View file

@ -80,6 +80,7 @@ public:
Q_INVOKABLE QString getExt(const QString& path); Q_INVOKABLE QString getExt(const QString& path);
Q_INVOKABLE bool isImage(const QString& fileExt); Q_INVOKABLE bool isImage(const QString& fileExt);
Q_INVOKABLE QString humanFileSize(qint64 fileSize); Q_INVOKABLE QString humanFileSize(qint64 fileSize);
Q_INVOKABLE void setSystemTrayIconVisible(bool visible);
private: private:
QClipboard* clipboard_; QClipboard* clipboard_;