From 2ce880670d07142cb10d9799a25eb003a6435c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Fri, 5 May 2023 11:33:25 -0400 Subject: [PATCH] qt6: fix misplacements and some warnings Change-Id: I4ff37c5dd109ed51de3946d9a6337273e1812c64 --- .../mainview/components/ChatViewHeader.qml | 149 +++++++++--------- src/app/mainview/components/Searchbar.qml | 10 +- src/app/wizardview/components/WelcomePage.qml | 21 +-- 3 files changed, 91 insertions(+), 89 deletions(-) diff --git a/src/app/mainview/components/ChatViewHeader.qml b/src/app/mainview/components/ChatViewHeader.qml index b8b72e8a..4672c1d5 100644 --- a/src/app/mainview/components/ChatViewHeader.qml +++ b/src/app/mainview/components/ChatViewHeader.qml @@ -74,6 +74,8 @@ Rectangle { id: messagingHeaderRectRowLayout anchors.fill: parent + anchors.rightMargin: 8 + spacing: 16 PushButton { id: backToWelcomeViewButton @@ -146,115 +148,108 @@ Rectangle { } } - RowLayout { - id: headerButtons + Searchbar { + id: rowSearchBar Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - Layout.rightMargin: 8 - spacing: 16 - Layout.fillWidth: true + Layout.preferredHeight: 30 + Layout.preferredWidth: 30 + (isOpen? JamiTheme.searchbarSize : 0) - Searchbar { - id: rowSearchBar + visible: root.swarmDetailsVisibility - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - spacing: headerButtons.spacing - visible: root.swarmDetailsVisibility - - Shortcut { - sequence: "Ctrl+Shift+F" - context: Qt.ApplicationShortcut - enabled: rowSearchBar.visible - onActivated: { - rowSearchBar.openSearchBar(); - } + Shortcut { + sequence: "Ctrl+Shift+F" + context: Qt.ApplicationShortcut + enabled: rowSearchBar.visible + onActivated: { + rowSearchBar.openSearchBar(); } } + } - PushButton { - id: startAAudioCallButton + PushButton { + id: startAAudioCallButton - visible: interactionButtonsVisibility && (!addMemberVisibility || UtilsAdapter.getAppValue(Settings.EnableExperimentalSwarm)) + visible: interactionButtonsVisibility && (!addMemberVisibility || UtilsAdapter.getAppValue(Settings.EnableExperimentalSwarm)) - source: JamiResources.place_audiocall_24dp_svg - toolTipText: JamiStrings.placeAudioCall + source: JamiResources.place_audiocall_24dp_svg + toolTipText: JamiStrings.placeAudioCall - normalColor: JamiTheme.chatviewBgColor - imageColor: JamiTheme.chatviewButtonColor + normalColor: JamiTheme.chatviewBgColor + imageColor: JamiTheme.chatviewButtonColor - onClicked: CallAdapter.placeAudioOnlyCall() + onClicked: CallAdapter.placeAudioOnlyCall() + } + + PushButton { + id: startAVideoCallButton + + visible: CurrentAccount.videoEnabled_Video && interactionButtonsVisibility && (!addMemberVisibility || UtilsAdapter.getAppValue(Settings.EnableExperimentalSwarm)) + source: JamiResources.videocam_24dp_svg + toolTipText: JamiStrings.placeVideoCall + + normalColor: JamiTheme.chatviewBgColor + imageColor: JamiTheme.chatviewButtonColor + + onClicked: { + CallAdapter.placeCall(); } + } - PushButton { - id: startAVideoCallButton + PushButton { + id: addParticipantsButton - visible: CurrentAccount.videoEnabled_Video && interactionButtonsVisibility && (!addMemberVisibility || UtilsAdapter.getAppValue(Settings.EnableExperimentalSwarm)) - source: JamiResources.videocam_24dp_svg - toolTipText: JamiStrings.placeVideoCall + source: JamiResources.add_people_24dp_svg + toolTipText: JamiStrings.addParticipants - normalColor: JamiTheme.chatviewBgColor - imageColor: JamiTheme.chatviewButtonColor + normalColor: JamiTheme.chatviewBgColor + imageColor: JamiTheme.chatviewButtonColor - onClicked: { - CallAdapter.placeCall(); - } - } + visible: interactionButtonsVisibility && addMemberVisibility - PushButton { - id: addParticipantsButton + onClicked: addToConversationClicked() + } - source: JamiResources.add_people_24dp_svg - toolTipText: JamiStrings.addParticipants + PushButton { + id: selectPluginButton - normalColor: JamiTheme.chatviewBgColor - imageColor: JamiTheme.chatviewButtonColor + visible: PluginAdapter.isEnabled && PluginAdapter.chatHandlersListCount && interactionButtonsVisibility - visible: interactionButtonsVisibility && addMemberVisibility + source: JamiResources.plugins_24dp_svg + toolTipText: JamiStrings.showPlugins - onClicked: addToConversationClicked() - } + normalColor: JamiTheme.chatviewBgColor + imageColor: JamiTheme.chatviewButtonColor - PushButton { - id: selectPluginButton + onClicked: pluginSelector() + } - visible: PluginAdapter.isEnabled && PluginAdapter.chatHandlersListCount && interactionButtonsVisibility + PushButton { + id: sendContactRequestButton - source: JamiResources.plugins_24dp_svg - toolTipText: JamiStrings.showPlugins + visible: CurrentConversation.isTemporary || CurrentConversation.isBanned - normalColor: JamiTheme.chatviewBgColor - imageColor: JamiTheme.chatviewButtonColor + source: JamiResources.add_people_24dp_svg + toolTipText: JamiStrings.addToConversations - onClicked: pluginSelector() - } + normalColor: JamiTheme.chatviewBgColor + imageColor: JamiTheme.chatviewButtonColor - PushButton { - id: sendContactRequestButton + onClicked: CurrentConversation.isBanned ? MessagesAdapter.unbanConversation(CurrentConversation.id) : MessagesAdapter.sendConversationRequest() + } - visible: CurrentConversation.isTemporary || CurrentConversation.isBanned + PushButton { + id: detailsButton - source: JamiResources.add_people_24dp_svg - toolTipText: JamiStrings.addToConversations + visible: interactionButtonsVisibility && (swarmDetailsVisibility || LRCInstance.currentAccountType === Profile.Type.SIP) // TODO if SIP not a request - normalColor: JamiTheme.chatviewBgColor - imageColor: JamiTheme.chatviewButtonColor + source: JamiResources.swarm_details_panel_svg + toolTipText: JamiStrings.details - onClicked: CurrentConversation.isBanned ? MessagesAdapter.unbanConversation(CurrentConversation.id) : MessagesAdapter.sendConversationRequest() - } + normalColor: JamiTheme.chatviewBgColor + imageColor: JamiTheme.chatviewButtonColor - PushButton { - id: detailsButton - - visible: interactionButtonsVisibility && (swarmDetailsVisibility || LRCInstance.currentAccountType === Profile.Type.SIP) // TODO if SIP not a request - - source: JamiResources.swarm_details_panel_svg - toolTipText: JamiStrings.details - - normalColor: JamiTheme.chatviewBgColor - imageColor: JamiTheme.chatviewButtonColor - - onClicked: showDetailsClicked() - } + onClicked: showDetailsClicked() } } diff --git a/src/app/mainview/components/Searchbar.qml b/src/app/mainview/components/Searchbar.qml index 4ed55740..d562d65c 100644 --- a/src/app/mainview/components/Searchbar.qml +++ b/src/app/mainview/components/Searchbar.qml @@ -28,11 +28,15 @@ RowLayout { property string currentConversationId: CurrentConversation.id property bool isOpen: extrasPanel.isOpen(ChatView.MessagesResearchPanel) - onIsOpenChanged: if (isOpen) - textArea.forceActiveFocus() + onIsOpenChanged: { + if (isOpen) + textArea.forceActiveFocus() + } PushButton { id: startSearchMessages + Layout.preferredHeight: 30 + Layout.preferredWidth: 30 source: JamiResources.search_svg normalColor: JamiTheme.chatviewBgColor @@ -60,7 +64,7 @@ RowLayout { } } - Layout.preferredWidth: isOpen ? JamiTheme.searchbarSize : 0 + width: isOpen ? JamiTheme.searchbarSize : 0 Behavior on Layout.preferredWidth { NumberAnimation { duration: 150 diff --git a/src/app/wizardview/components/WelcomePage.qml b/src/app/wizardview/components/WelcomePage.qml index e8942fa9..2789ee6f 100644 --- a/src/app/wizardview/components/WelcomePage.qml +++ b/src/app/wizardview/components/WelcomePage.qml @@ -34,6 +34,7 @@ Rectangle { property bool showTab: false property bool showAlreadyHave: false property bool showAdvanced: false + property int buttonSize: JamiTheme.wizardButtonWidth signal showThisPage @@ -58,6 +59,8 @@ Rectangle { KeyNavigation.up: newAccountButton KeyNavigation.down: KeyNavigation.tab + onWidthChanged: root.buttonSize = Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + ColumnLayout { id: welcomePageColumnLayout @@ -65,7 +68,7 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - width: Math.max(508, root.width - 100) + width: 800 Item { @@ -163,7 +166,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter Layout.topMargin: JamiTheme.wizardViewBlocMarginSize - preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + preferredWidth: root.buttonSize text: JamiStrings.joinJami toolTipText: JamiStrings.createNewJamiAccount @@ -181,7 +184,7 @@ Rectangle { objectName: "alreadyHaveAccount" primary: true - preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + preferredWidth: root.buttonSize Layout.alignment: Qt.AlignCenter @@ -219,7 +222,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter - preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + preferredWidth: root.buttonSize visible: false @@ -244,7 +247,7 @@ Rectangle { visible: false Layout.alignment: Qt.AlignCenter - preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + preferredWidth: root.buttonSize text: JamiStrings.importAccountFromBackup toolTipText: JamiStrings.connectFromBackup @@ -266,7 +269,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter Layout.bottomMargin: newSIPAccountButton.visible ? 0 : JamiTheme.wizardViewPageBackButtonMargins - preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + preferredWidth: root.buttonSize text: JamiStrings.advancedFeatures toolTipText: showAdvanced ? JamiStrings.hideAdvancedFeatures : JamiStrings.showAdvancedFeatures @@ -296,7 +299,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter - preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + preferredWidth: root.buttonSize visible: false text: JamiStrings.createNewRV @@ -319,7 +322,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter - preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + preferredWidth: root.buttonSize visible: false text: JamiStrings.connectJAMSServer @@ -344,7 +347,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter Layout.bottomMargin: JamiTheme.wizardViewPageBackButtonMargins - preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) + preferredWidth: root.buttonSize visible: false text: JamiStrings.addSIPAccount