From f1f6003048d2611d3993eb0afe56036847a3d7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Sun, 5 Feb 2023 16:26:56 -0500 Subject: [PATCH] swarmdetailspanel: add scrollbar to settings Change-Id: I46e3ef0d00b3db97f4908d84e7b251ee67a861c7 --- .../mainview/components/SwarmDetailsPanel.qml | 417 +++++++++--------- 1 file changed, 213 insertions(+), 204 deletions(-) diff --git a/src/app/mainview/components/SwarmDetailsPanel.qml b/src/app/mainview/components/SwarmDetailsPanel.qml index e13a2e7af..d788fa101 100644 --- a/src/app/mainview/components/SwarmDetailsPanel.qml +++ b/src/app/mainview/components/SwarmDetailsPanel.qml @@ -293,78 +293,54 @@ Rectangle { Layout.preferredHeight: root.height - header.height - JamiTheme.preferredMarginSize color: JamiTheme.secondaryBackgroundColor - ColumnLayout { - id: aboutSwarm - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: JamiTheme.settingsMarginSize - visible: tabBar.currentIndex === 0 - Layout.alignment: Qt.AlignTop - - SwarmDetailsItem { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - ToggleSwitch { - id: ignoreSwarm + JamiFlickable { + id: settingsScrollView + property ScrollBar vScrollBar: ScrollBar.vertical + anchors.fill: parent - anchors.fill: parent - anchors.leftMargin: JamiTheme.preferredMarginSize + contentHeight: aboutSwarm.height + JamiTheme.preferredMarginSize - checked: CurrentConversation.ignoreNotifications + ColumnLayout { + id: aboutSwarm + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: JamiTheme.settingsMarginSize + visible: tabBar.currentIndex === 0 + Layout.alignment: Qt.AlignTop - labelText: JamiStrings.muteConversation - fontPointSize: JamiTheme.settingsFontSize + SwarmDetailsItem { + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - tooltipText: JamiStrings.ignoreNotificationsTooltip + ToggleSwitch { + id: ignoreSwarm - onSwitchToggled: { - CurrentConversation.setPreference("ignoreNotifications", checked ? "true" : "false") - } - } - } + anchors.fill: parent + anchors.leftMargin: JamiTheme.preferredMarginSize - SwarmDetailsItem { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - - Text { - anchors.left: parent.left - anchors.top: parent.top - anchors.margins: JamiTheme.preferredMarginSize - text: JamiStrings.leaveConversation - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - - color: JamiTheme.textColor - } + checked: CurrentConversation.ignoreNotifications + + labelText: JamiStrings.muteConversation + fontPointSize: JamiTheme.settingsFontSize + + tooltipText: JamiStrings.ignoreNotificationsTooltip - TapHandler { - target: parent - enabled: parent.visible - onTapped: function onTapped(eventPoint) { - rmDialog.open() + onSwitchToggled: { + CurrentConversation.setPreference("ignoreNotifications", checked ? "true" : "false") + } } } - } - SwarmDetailsItem { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - - RowLayout { - anchors.fill: parent - anchors.leftMargin: JamiTheme.preferredMarginSize + SwarmDetailsItem { + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 Text { - Layout.fillWidth: true - Layout.preferredHeight: 30 - Layout.rightMargin: JamiTheme.preferredMarginSize - - text: JamiStrings.chooseAColor + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: JamiTheme.preferredMarginSize + text: JamiStrings.leaveConversation font.pointSize: JamiTheme.settingsFontSize font.kerning: true elide: Text.ElideRight @@ -374,198 +350,231 @@ Rectangle { color: JamiTheme.textColor } - Rectangle { - id: chooseAColorBtn - - Layout.alignment: Qt.AlignRight - - width: JamiTheme.aboutBtnSize - height: JamiTheme.aboutBtnSize - radius: JamiTheme.aboutBtnSize / 2 - - color: CurrentConversation.color + TapHandler { + target: parent + enabled: parent.visible + onTapped: function onTapped(eventPoint) { + rmDialog.open() + } } } - TapHandler { - target: parent - enabled: parent.visible - onTapped: function onTapped(eventPoint) { - colorDialog.open() - } - } - } + SwarmDetailsItem { + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - SwarmDetailsItem { - id: settingsSwarmItem - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 + RowLayout { + anchors.fill: parent + anchors.leftMargin: JamiTheme.preferredMarginSize + + Text { + Layout.fillWidth: true + Layout.preferredHeight: 30 + Layout.rightMargin: JamiTheme.preferredMarginSize + + text: JamiStrings.chooseAColor + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + + color: JamiTheme.textColor + } - RowLayout { - anchors.fill: parent - anchors.leftMargin: JamiTheme.preferredMarginSize + Rectangle { + id: chooseAColorBtn - Text { - id: settingsSwarmText - Layout.fillWidth: true - Layout.preferredHeight: 30 - Layout.rightMargin: JamiTheme.preferredMarginSize - Layout.maximumWidth: settingsSwarmItem.width / 2 + Layout.alignment: Qt.AlignRight - text: JamiStrings.defaultCallHost - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter + width: JamiTheme.aboutBtnSize + height: JamiTheme.aboutBtnSize + radius: JamiTheme.aboutBtnSize / 2 - color: JamiTheme.textColor + color: CurrentConversation.color + } } + TapHandler { + target: parent + enabled: parent.visible + onTapped: function onTapped(eventPoint) { + colorDialog.open() + } + } + } + + SwarmDetailsItem { + id: settingsSwarmItem + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 RowLayout { - id: swarmRdvPref - spacing: 10 - Layout.alignment: Qt.AlignRight - Layout.maximumWidth: settingsSwarmItem.width / 2 + anchors.fill: parent + anchors.leftMargin: JamiTheme.preferredMarginSize + + Text { + id: settingsSwarmText + Layout.fillWidth: true + Layout.preferredHeight: 30 + Layout.rightMargin: JamiTheme.preferredMarginSize + Layout.maximumWidth: settingsSwarmItem.width / 2 + + text: JamiStrings.defaultCallHost + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + + color: JamiTheme.textColor + } + - Connections { - target: CurrentConversation + RowLayout { + id: swarmRdvPref + spacing: 10 + Layout.alignment: Qt.AlignRight + Layout.maximumWidth: settingsSwarmItem.width / 2 - function onRdvAccountChanged() { - // This avoid incorrect avatar by always modifying the mode before the imageId - avatar.mode = CurrentConversation.rdvAccount === CurrentAccount.uri ? Avatar.Mode.Account : Avatar.Mode.Contact - avatar.imageId = CurrentConversation.rdvAccount === CurrentAccount.uri ? CurrentAccount.id : CurrentConversation.rdvAccount + Connections { + target: CurrentConversation + + function onRdvAccountChanged() { + // This avoid incorrect avatar by always modifying the mode before the imageId + avatar.mode = CurrentConversation.rdvAccount === CurrentAccount.uri ? Avatar.Mode.Account : Avatar.Mode.Contact + avatar.imageId = CurrentConversation.rdvAccount === CurrentAccount.uri ? CurrentAccount.id : CurrentConversation.rdvAccount + } } - } - Avatar { - id: avatar - width: JamiTheme.contactMessageAvatarSize - height: JamiTheme.contactMessageAvatarSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.topMargin: JamiTheme.preferredMarginSize / 2 - visible: CurrentConversation.rdvAccount !== "" - - imageId: "" - showPresenceIndicator: false - mode: Avatar.Mode.Account - } + Avatar { + id: avatar + width: JamiTheme.contactMessageAvatarSize + height: JamiTheme.contactMessageAvatarSize + Layout.leftMargin: JamiTheme.preferredMarginSize + Layout.topMargin: JamiTheme.preferredMarginSize / 2 + visible: CurrentConversation.rdvAccount !== "" + + imageId: "" + showPresenceIndicator: false + mode: Avatar.Mode.Account + } - ColumnLayout { - spacing: 0 - Layout.alignment: Qt.AlignVCenter + ColumnLayout { + spacing: 0 + Layout.alignment: Qt.AlignVCenter - ElidedTextLabel { - id: bestName + ElidedTextLabel { + id: bestName - eText: { - if (CurrentConversation.rdvAccount === "") - return JamiStrings.none - else if (CurrentConversation.rdvAccount === CurrentAccount.uri) - return CurrentAccount.bestName - else - return UtilsAdapter.getBestNameForUri(CurrentAccount.id, CurrentConversation.rdvAccount) - } - maxWidth: JamiTheme.preferredFieldWidth + eText: { + if (CurrentConversation.rdvAccount === "") + return JamiStrings.none + else if (CurrentConversation.rdvAccount === CurrentAccount.uri) + return CurrentAccount.bestName + else + return UtilsAdapter.getBestNameForUri(CurrentAccount.id, CurrentConversation.rdvAccount) + } + maxWidth: JamiTheme.preferredFieldWidth - font.pointSize: JamiTheme.participantFontSize - color: JamiTheme.primaryForegroundColor - font.kerning: true + font.pointSize: JamiTheme.participantFontSize + color: JamiTheme.primaryForegroundColor + font.kerning: true - verticalAlignment: Text.AlignVCenter - } + verticalAlignment: Text.AlignVCenter + } - ElidedTextLabel { - id: deviceId + ElidedTextLabel { + id: deviceId - eText: CurrentConversation.rdvDevice === "" ? JamiStrings.none : CurrentConversation.rdvDevice - visible: CurrentConversation.rdvDevice !== "" - maxWidth: JamiTheme.preferredFieldWidth + eText: CurrentConversation.rdvDevice === "" ? JamiStrings.none : CurrentConversation.rdvDevice + visible: CurrentConversation.rdvDevice !== "" + maxWidth: JamiTheme.preferredFieldWidth - font.pointSize: JamiTheme.participantFontSize - color: JamiTheme.textColorHovered - font.kerning: true + font.pointSize: JamiTheme.participantFontSize + color: JamiTheme.textColorHovered + font.kerning: true - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + } } } } - } - TapHandler { - target: parent + TapHandler { + target: parent - enabled: parent.visible && root.isAdmin - onTapped: function onTapped(eventPoint) { - devicesListPopup.open() + enabled: parent.visible && root.isAdmin + onTapped: function onTapped(eventPoint) { + devicesListPopup.open() + } } } - } - RowLayout { - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 + RowLayout { + Layout.leftMargin: JamiTheme.preferredMarginSize + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - Text { - Layout.fillWidth: true - Layout.preferredHeight: 30 - Layout.rightMargin: JamiTheme.preferredMarginSize + Text { + Layout.fillWidth: true + Layout.preferredHeight: 30 + Layout.rightMargin: JamiTheme.preferredMarginSize - text: JamiStrings.typeOfSwarm - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter + text: JamiStrings.typeOfSwarm + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter - color: JamiTheme.textColor - } + color: JamiTheme.textColor + } - Label { - id: typeOfSwarmLabel + Label { + id: typeOfSwarmLabel - Layout.alignment: Qt.AlignRight + Layout.alignment: Qt.AlignRight - color: JamiTheme.textColor + color: JamiTheme.textColor - text: CurrentConversation.modeString + text: CurrentConversation.modeString + } } - } - RowLayout { - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - Layout.maximumWidth: parent.width - visible: LRCInstance.debugMode() - - Text { - id: idLabel - Layout.preferredHeight: 30 - Layout.rightMargin: JamiTheme.preferredMarginSize - Layout.maximumWidth: parent.width / 2 - - text: JamiStrings.identifier - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - - color: JamiTheme.textColor - } + RowLayout { + Layout.leftMargin: JamiTheme.preferredMarginSize + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 + Layout.maximumWidth: parent.width + visible: LRCInstance.debugMode() + + Text { + id: idLabel + Layout.preferredHeight: 30 + Layout.rightMargin: JamiTheme.preferredMarginSize + Layout.maximumWidth: parent.width / 2 + + text: JamiStrings.identifier + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter - Text { - Layout.alignment: Qt.AlignRight - Layout.maximumWidth: parent.width / 2 + color: JamiTheme.textColor + } - color: JamiTheme.textColor + Text { + Layout.alignment: Qt.AlignRight + Layout.maximumWidth: parent.width / 2 + + color: JamiTheme.textColor - text: CurrentConversation.id - elide: Text.ElideRight + text: CurrentConversation.id + elide: Text.ElideRight + } } } } -- GitLab