mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-21 15:24:01 +02:00
mainview: code optimization for page on stack view checking
Change-Id: I8ff7122a430b73f1c5626ae931f13f5a4ffe242a
This commit is contained in:
parent
9a20e2da1a
commit
a8b0adbef7
1 changed files with 18 additions and 21 deletions
|
@ -70,13 +70,22 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPageInStack(objectName, stackView) {
|
||||||
|
var foundItem = stackView.find(function (item, index) {
|
||||||
|
return item.objectName === objectName
|
||||||
|
})
|
||||||
|
|
||||||
|
return foundItem ? true : false
|
||||||
|
}
|
||||||
|
|
||||||
function showWelcomeView() {
|
function showWelcomeView() {
|
||||||
mainViewWindowSidePanel.deselectConversationSmartList()
|
mainViewWindowSidePanel.deselectConversationSmartList()
|
||||||
if (communicationPageMessageWebView.visible || callStackView.visible) {
|
if (isPageInStack("callStackViewObject", sidePanelViewStack) ||
|
||||||
|
isPageInStack("communicationPageMessageWebView", sidePanelViewStack) ||
|
||||||
|
isPageInStack("communicationPageMessageWebView", mainViewStack) ||
|
||||||
|
isPageInStack("callStackViewObject", mainViewStack)) {
|
||||||
sidePanelViewStack.pop(StackView.Immediate)
|
sidePanelViewStack.pop(StackView.Immediate)
|
||||||
if (!sidePanelOnly) {
|
mainViewStack.pop(welcomePage, StackView.Immediate)
|
||||||
mainViewStack.pop(welcomePage, StackView.Immediate)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
recordBox.visible = false
|
recordBox.visible = false
|
||||||
}
|
}
|
||||||
|
@ -112,7 +121,6 @@ Window {
|
||||||
callStackView.updateCorrespondingUI()
|
callStackView.updateCorrespondingUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function pushCallStackView() {
|
function pushCallStackView() {
|
||||||
if (sidePanelOnly) {
|
if (sidePanelOnly) {
|
||||||
sidePanelViewStack.push(callStackView, StackView.Immediate)
|
sidePanelViewStack.push(callStackView, StackView.Immediate)
|
||||||
|
@ -153,7 +161,6 @@ Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleSettingsView() {
|
function toggleSettingsView() {
|
||||||
|
|
||||||
inSettingsView = !inSettingsView
|
inSettingsView = !inSettingsView
|
||||||
|
|
||||||
if (inSettingsView) {
|
if (inSettingsView) {
|
||||||
|
@ -210,11 +217,8 @@ Window {
|
||||||
// Check if call stack view is on any of the stackview.
|
// Check if call stack view is on any of the stackview.
|
||||||
if (callStackView.responsibleAccountId === accountId
|
if (callStackView.responsibleAccountId === accountId
|
||||||
&& callStackView.responsibleConvUid === convUid) {
|
&& callStackView.responsibleConvUid === convUid) {
|
||||||
if (mainViewStack.find(function (item, index) {
|
if (isPageInStack("callStackViewObject", sidePanelViewStack) ||
|
||||||
return item.objectName === "callStackViewObject"
|
isPageInStack("callStackViewObject", mainViewStack)) {
|
||||||
}) || sidePanelViewStack.find(function (item, index) {
|
|
||||||
return item.objectName === "callStackViewObject"
|
|
||||||
})) {
|
|
||||||
if (!inSettingsView) {
|
if (!inSettingsView) {
|
||||||
callStackView.needToCloseInCallConversationAndPotentialWindow()
|
callStackView.needToCloseInCallConversationAndPotentialWindow()
|
||||||
pushCommunicationMessageWebView()
|
pushCommunicationMessageWebView()
|
||||||
|
@ -224,7 +228,6 @@ Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onIncomingCallNeedToSetupMainView(accountId, convUid, fromNotification) {
|
function onIncomingCallNeedToSetupMainView(accountId, convUid, fromNotification) {
|
||||||
|
|
||||||
// Set up the call stack view that is needed by call overlay.
|
// Set up the call stack view that is needed by call overlay.
|
||||||
if (!inSettingsView) {
|
if (!inSettingsView) {
|
||||||
mainViewStack.pop(welcomePage, StackView.Immediate)
|
mainViewStack.pop(welcomePage, StackView.Immediate)
|
||||||
|
@ -478,15 +481,10 @@ Window {
|
||||||
MessagesAdapter.setupChatView(currentUID)
|
MessagesAdapter.setupChatView(currentUID)
|
||||||
callStackView.setLinkedWebview(communicationPageMessageWebView)
|
callStackView.setLinkedWebview(communicationPageMessageWebView)
|
||||||
|
|
||||||
if (mainViewStack.find(function (item, index) {
|
if (isPageInStack("communicationPageMessageWebView", sidePanelViewStack) ||
|
||||||
return item.objectName === "communicationPageMessageWebView"
|
isPageInStack("communicationPageMessageWebView", mainViewStack)) {
|
||||||
}) || sidePanelViewStack.find(function (item, index) {
|
if (!callStackViewShouldShow)
|
||||||
return item.objectName === "communicationPageMessageWebView"
|
|
||||||
})) {
|
|
||||||
if (!callStackViewShouldShow) {
|
|
||||||
communicationPageMessageWebView.focusMessageWebView()
|
|
||||||
return
|
return
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push messageWebView or callStackView onto the correct stackview
|
// Push messageWebView or callStackView onto the correct stackview
|
||||||
|
@ -541,7 +539,6 @@ Window {
|
||||||
|
|
||||||
WelcomePage {
|
WelcomePage {
|
||||||
id: welcomePage
|
id: welcomePage
|
||||||
|
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue