Skip to content
Snippets Groups Projects
Commit 95146f97 authored by Albert  Babí Oller's avatar Albert Babí Oller Committed by Albert Babí Oller
Browse files

misc: avoid unnecessary signals for WelcomeView

- centralize signals / functions at MainView when switching back to welcome view
- avoid unnecessary signal propagation between modules
- avoid names such as "needTo"

Gitlab: #85
Gitlab: #86

Change-Id: I121cbc12a83db269df4329a2690f5cedaa0534d5
parent 3b6bbe77
No related branches found
No related tags found
No related merge requests found
...@@ -66,6 +66,7 @@ Window { ...@@ -66,6 +66,7 @@ Window {
mainViewStack.pop(welcomePage, StackView.Immediate) mainViewStack.pop(welcomePage, StackView.Immediate)
} }
} }
recordBox.visible = false
} }
function setCallStackView() { function setCallStackView() {
...@@ -299,6 +300,11 @@ Window { ...@@ -299,6 +300,11 @@ Window {
function onAccountStatusChanged() { function onAccountStatusChanged() {
accountComboBox.resetAccountListModel() accountComboBox.resetAccountListModel()
} }
function onNavigateToWelcomePageRequested() {
if (!inSettingsView && !currentAccountIsCalling())
showWelcomeView()
}
} }
onSettingBtnClicked: { onSettingBtnClicked: {
...@@ -310,21 +316,11 @@ Window { ...@@ -310,21 +316,11 @@ Window {
AccountAdapter.accountChanged(index) AccountAdapter.accountChanged(index)
settingsView.slotAccountListChanged() if (inSettingsView) {
settingsView.setSelected(settingsView.selectedMenu, true) settingsView.slotAccountListChanged()
settingsView.setSelected(settingsView.selectedMenu, true)
if (!inSettingsView) { } else if (currentAccountIsCalling()) {
if (currentAccountIsCalling()) { setCallStackView()
setCallStackView()
} else {
showWelcomeView()
}
}
}
onNeedToBackToWelcomePage: {
if (!inSettingsView && !currentAccountIsCalling()) {
mainViewWindowSidePanel.accountComboBoxNeedToShowWelcomePage()
} }
} }
...@@ -509,17 +505,6 @@ Window { ...@@ -509,17 +505,6 @@ Window {
} }
} }
onAccountComboBoxNeedToShowWelcomePage: {
// If the item argument is specified, all items down to (but not including) item will be popped.
if (!inSettingsView && !currentAccountIsCalling()) {
showWelcomeView()
}
}
onConversationSmartListViewNeedToShowWelcomePage: {
showWelcomeView()
}
onNeedToUpdateConversationForAddedContact: { onNeedToUpdateConversationForAddedContact: {
MessagesAdapter.updateConversationForAddedContact() MessagesAdapter.updateConversationForAddedContact()
mainViewWindowSidePanel.clearContactSearchBar() mainViewWindowSidePanel.clearContactSearchBar()
...@@ -529,6 +514,14 @@ Window { ...@@ -529,6 +514,14 @@ Window {
onNeedToAddNewAccount: { onNeedToAddNewAccount: {
mainViewStackLayout.currentIndex = 1 mainViewStackLayout.currentIndex = 1
} }
Connections {
target: ConversationsAdapter
function onNavigateToWelcomePageRequested() {
showWelcomeView()
}
}
} }
CallStackView { CallStackView {
...@@ -583,11 +576,6 @@ Window { ...@@ -583,11 +576,6 @@ Window {
} }
} }
onNeedToGoBackToWelcomeView: {
showWelcomeView()
recordBox.visible = false
}
Component.onCompleted: { Component.onCompleted: {
recordBox.x = Qt.binding(function() { recordBox.x = Qt.binding(function() {
var i = ((mainViewStack.visible && mainViewStack.width > 1000) ? var i = ((mainViewStack.visible && mainViewStack.width > 1000) ?
......
...@@ -28,7 +28,6 @@ ComboBox { ...@@ -28,7 +28,6 @@ ComboBox {
id: root id: root
signal accountChanged(int index) signal accountChanged(int index)
signal needToBackToWelcomePage
signal newAccountButtonClicked signal newAccountButtonClicked
signal settingBtnClicked signal settingBtnClicked
...@@ -52,14 +51,6 @@ ComboBox { ...@@ -52,14 +51,6 @@ ComboBox {
} }
} }
Connections {
target: AccountAdapter
function onNavigateToWelcomePageRequested() {
needToBackToWelcomePage()
}
}
Image { Image {
id: userImageRoot id: userImageRoot
......
...@@ -172,7 +172,7 @@ Rectangle { ...@@ -172,7 +172,7 @@ Rectangle {
visible: mainViewWindow.sidePanelOnly visible: mainViewWindow.sidePanelOnly
onClicked: { onClicked: {
mainViewWindow.showWelcomeView() // TODO: refactor with msg manager mainViewWindow.showWelcomeView()
} }
} }
......
...@@ -29,7 +29,6 @@ ListView { ...@@ -29,7 +29,6 @@ ListView {
signal needToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState) signal needToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState)
signal needToSelectItems(string conversationUid) signal needToSelectItems(string conversationUid)
signal needToDeselectItems signal needToDeselectItems
signal needToBackToWelcomePage
signal needToGrabFocus signal needToGrabFocus
signal needToShowChatView(string accountId, string convUid) signal needToShowChatView(string accountId, string convUid)
...@@ -73,10 +72,6 @@ ListView { ...@@ -73,10 +72,6 @@ ListView {
function onUpdateListViewRequested() { function onUpdateListViewRequested() {
updateListView() updateListView()
} }
function onNavigateToWelcomePageRequested() {
root.needToBackToWelcomePage()
}
} }
Connections { Connections {
......
...@@ -33,7 +33,6 @@ Rectangle { ...@@ -33,7 +33,6 @@ Rectangle {
property string headerUserAliasLabelText: "" property string headerUserAliasLabelText: ""
property string headerUserUserNameLabelText: "" property string headerUserUserNameLabelText: ""
signal needToGoBackToWelcomeView
signal needToHideConversationInCall signal needToHideConversationInCall
signal needToSendContactRequest signal needToSendContactRequest
...@@ -93,9 +92,9 @@ Rectangle { ...@@ -93,9 +92,9 @@ Rectangle {
userAliasLabelText: headerUserAliasLabelText userAliasLabelText: headerUserAliasLabelText
userUserNameLabelText: headerUserUserNameLabelText userUserNameLabelText: headerUserUserNameLabelText
onBackToWelcomeViewButtonClicked: { onBackClicked: {
MessagesAdapter.updateDraft() MessagesAdapter.updateDraft()
messageWebViewRect.needToGoBackToWelcomeView() mainViewWindow.showWelcomeView()
} }
onNeedToHideConversationInCall: { onNeedToHideConversationInCall: {
......
...@@ -32,7 +32,7 @@ Rectangle { ...@@ -32,7 +32,7 @@ Rectangle {
property string backToWelcomeViewButtonSource: "qrc:/images/icons/ic_arrow_back_24px.svg" property string backToWelcomeViewButtonSource: "qrc:/images/icons/ic_arrow_back_24px.svg"
property bool sendContactRequestButtonVisible: true property bool sendContactRequestButtonVisible: true
signal backToWelcomeViewButtonClicked signal backClicked
signal needToHideConversationInCall signal needToHideConversationInCall
signal sendContactRequestButtonClicked signal sendContactRequestButtonClicked
...@@ -65,7 +65,7 @@ Rectangle { ...@@ -65,7 +65,7 @@ Rectangle {
onClicked: { onClicked: {
if (backToWelcomeViewButtonSource === "qrc:/images/icons/ic_arrow_back_24px.svg") if (backToWelcomeViewButtonSource === "qrc:/images/icons/ic_arrow_back_24px.svg")
messagingHeaderRect.backToWelcomeViewButtonClicked() messagingHeaderRect.backClicked()
else else
messagingHeaderRect.needToHideConversationInCall() messagingHeaderRect.needToHideConversationInCall()
} }
......
...@@ -40,8 +40,6 @@ Rectangle { ...@@ -40,8 +40,6 @@ Rectangle {
} }
signal conversationSmartListNeedToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState) signal conversationSmartListNeedToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState)
signal accountComboBoxNeedToShowWelcomePage()
signal conversationSmartListViewNeedToShowWelcomePage
signal needToUpdateConversationForAddedContact signal needToUpdateConversationForAddedContact
signal needToAddNewAccount signal needToAddNewAccount
...@@ -209,10 +207,6 @@ Rectangle { ...@@ -209,10 +207,6 @@ Rectangle {
ConversationsAdapter.selectConversation(conversationUid) ConversationsAdapter.selectConversation(conversationUid)
} }
onNeedToBackToWelcomePage: {
sidePanelRect.conversationSmartListViewNeedToShowWelcomePage()
}
onNeedToAccessMessageWebView: { onNeedToAccessMessageWebView: {
sidePanelRect.conversationSmartListNeedToAccessMessageWebView( sidePanelRect.conversationSmartListNeedToAccessMessageWebView(
currentUserDisplayName, currentUserAlias, currentUserDisplayName, currentUserAlias,
......
...@@ -69,7 +69,7 @@ Rectangle { ...@@ -69,7 +69,7 @@ Rectangle {
visible: mainViewWindow.sidePanelOnly visible: mainViewWindow.sidePanelOnly
onClicked: { onClicked: {
mainViewWindow.showWelcomeView() // TODO: refactor with msg manager mainViewWindow.showWelcomeView()
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment