1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-10 12:03:18 +02:00

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
This commit is contained in:
ababi 2020-09-21 11:50:29 +02:00 committed by Albert Babí Oller
parent 3b6bbe772a
commit 95146f97b3
8 changed files with 25 additions and 58 deletions

View file

@ -66,6 +66,7 @@ Window {
mainViewStack.pop(welcomePage, StackView.Immediate)
}
}
recordBox.visible = false
}
function setCallStackView() {
@ -299,6 +300,11 @@ Window {
function onAccountStatusChanged() {
accountComboBox.resetAccountListModel()
}
function onNavigateToWelcomePageRequested() {
if (!inSettingsView && !currentAccountIsCalling())
showWelcomeView()
}
}
onSettingBtnClicked: {
@ -310,21 +316,11 @@ Window {
AccountAdapter.accountChanged(index)
settingsView.slotAccountListChanged()
settingsView.setSelected(settingsView.selectedMenu, true)
if (!inSettingsView) {
if (currentAccountIsCalling()) {
setCallStackView()
} else {
showWelcomeView()
}
}
}
onNeedToBackToWelcomePage: {
if (!inSettingsView && !currentAccountIsCalling()) {
mainViewWindowSidePanel.accountComboBoxNeedToShowWelcomePage()
if (inSettingsView) {
settingsView.slotAccountListChanged()
settingsView.setSelected(settingsView.selectedMenu, true)
} else if (currentAccountIsCalling()) {
setCallStackView()
}
}
@ -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: {
MessagesAdapter.updateConversationForAddedContact()
mainViewWindowSidePanel.clearContactSearchBar()
@ -529,6 +514,14 @@ Window {
onNeedToAddNewAccount: {
mainViewStackLayout.currentIndex = 1
}
Connections {
target: ConversationsAdapter
function onNavigateToWelcomePageRequested() {
showWelcomeView()
}
}
}
CallStackView {
@ -583,11 +576,6 @@ Window {
}
}
onNeedToGoBackToWelcomeView: {
showWelcomeView()
recordBox.visible = false
}
Component.onCompleted: {
recordBox.x = Qt.binding(function() {
var i = ((mainViewStack.visible && mainViewStack.width > 1000) ?

View file

@ -28,7 +28,6 @@ ComboBox {
id: root
signal accountChanged(int index)
signal needToBackToWelcomePage
signal newAccountButtonClicked
signal settingBtnClicked
@ -52,14 +51,6 @@ ComboBox {
}
}
Connections {
target: AccountAdapter
function onNavigateToWelcomePageRequested() {
needToBackToWelcomePage()
}
}
Image {
id: userImageRoot

View file

@ -172,7 +172,7 @@ Rectangle {
visible: mainViewWindow.sidePanelOnly
onClicked: {
mainViewWindow.showWelcomeView() // TODO: refactor with msg manager
mainViewWindow.showWelcomeView()
}
}

View file

@ -29,7 +29,6 @@ ListView {
signal needToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState)
signal needToSelectItems(string conversationUid)
signal needToDeselectItems
signal needToBackToWelcomePage
signal needToGrabFocus
signal needToShowChatView(string accountId, string convUid)
@ -73,10 +72,6 @@ ListView {
function onUpdateListViewRequested() {
updateListView()
}
function onNavigateToWelcomePageRequested() {
root.needToBackToWelcomePage()
}
}
Connections {

View file

@ -33,7 +33,6 @@ Rectangle {
property string headerUserAliasLabelText: ""
property string headerUserUserNameLabelText: ""
signal needToGoBackToWelcomeView
signal needToHideConversationInCall
signal needToSendContactRequest
@ -93,9 +92,9 @@ Rectangle {
userAliasLabelText: headerUserAliasLabelText
userUserNameLabelText: headerUserUserNameLabelText
onBackToWelcomeViewButtonClicked: {
onBackClicked: {
MessagesAdapter.updateDraft()
messageWebViewRect.needToGoBackToWelcomeView()
mainViewWindow.showWelcomeView()
}
onNeedToHideConversationInCall: {

View file

@ -32,7 +32,7 @@ Rectangle {
property string backToWelcomeViewButtonSource: "qrc:/images/icons/ic_arrow_back_24px.svg"
property bool sendContactRequestButtonVisible: true
signal backToWelcomeViewButtonClicked
signal backClicked
signal needToHideConversationInCall
signal sendContactRequestButtonClicked
@ -65,7 +65,7 @@ Rectangle {
onClicked: {
if (backToWelcomeViewButtonSource === "qrc:/images/icons/ic_arrow_back_24px.svg")
messagingHeaderRect.backToWelcomeViewButtonClicked()
messagingHeaderRect.backClicked()
else
messagingHeaderRect.needToHideConversationInCall()
}

View file

@ -40,8 +40,6 @@ Rectangle {
}
signal conversationSmartListNeedToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState)
signal accountComboBoxNeedToShowWelcomePage()
signal conversationSmartListViewNeedToShowWelcomePage
signal needToUpdateConversationForAddedContact
signal needToAddNewAccount
@ -209,10 +207,6 @@ Rectangle {
ConversationsAdapter.selectConversation(conversationUid)
}
onNeedToBackToWelcomePage: {
sidePanelRect.conversationSmartListViewNeedToShowWelcomePage()
}
onNeedToAccessMessageWebView: {
sidePanelRect.conversationSmartListNeedToAccessMessageWebView(
currentUserDisplayName, currentUserAlias,

View file

@ -69,7 +69,7 @@ Rectangle {
visible: mainViewWindow.sidePanelOnly
onClicked: {
mainViewWindow.showWelcomeView() // TODO: refactor with msg manager
mainViewWindow.showWelcomeView()
}
}