From 303639fe27d93900abe8ee2df991ec394efbe28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 1 Mar 2022 16:45:06 -0500 Subject: [PATCH] misc: graphical adjustments + Adapt primary color via the luma of the background + Adapt font size + Adapt some margins + Add highlight on avatars + Fix selected UID when creating swarms GitLab: #670 Change-Id: I219acd5a1726298050a1ca908dbf38929bab171a --- .../ContactMessageDelegate.qml | 1 - src/commoncomponents/TextMessageDelegate.qml | 7 +--- .../components/FilesToSendDelegate.qml | 1 + src/mainview/components/SwarmDetailsPanel.qml | 35 ++++++++++--------- src/utilsadapter.cpp | 3 +- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/commoncomponents/ContactMessageDelegate.qml b/src/commoncomponents/ContactMessageDelegate.qml index 700dbef18..b79cf28e8 100644 --- a/src/commoncomponents/ContactMessageDelegate.qml +++ b/src/commoncomponents/ContactMessageDelegate.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts diff --git a/src/commoncomponents/TextMessageDelegate.qml b/src/commoncomponents/TextMessageDelegate.qml index 1dca5666d..b8ed17741 100644 --- a/src/commoncomponents/TextMessageDelegate.qml +++ b/src/commoncomponents/TextMessageDelegate.qml @@ -61,15 +61,10 @@ SBSMessageBase { onLinkHovered: root.hoveredLink = hoveredLink onLinkActivated: Qt.openUrlExternally(hoveredLink) readOnly: true - color: { - var luma = 0.2126 * bubble.color.r + 0.7152 * bubble.color.g + 0.0722 * bubble.color.b // ITU-R BT.709 - - return luma < 0.60 ? + color: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark - } - TapHandler { acceptedButtons: Qt.RightButton onTapped: function onTapped(eventPoint) { diff --git a/src/mainview/components/FilesToSendDelegate.qml b/src/mainview/components/FilesToSendDelegate.qml index dca6fdb6a..426bad560 100644 --- a/src/mainview/components/FilesToSendDelegate.qml +++ b/src/mainview/components/FilesToSendDelegate.qml @@ -20,6 +20,7 @@ import QtQuick import QtQuick.Layouts import Qt5Compat.GraphicalEffects +import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 diff --git a/src/mainview/components/SwarmDetailsPanel.qml b/src/mainview/components/SwarmDetailsPanel.qml index 95dbab059..b28a32a26 100644 --- a/src/mainview/components/SwarmDetailsPanel.qml +++ b/src/mainview/components/SwarmDetailsPanel.qml @@ -179,7 +179,7 @@ Rectangle { ColorDialog { id: colorDialog - title: JamiTheme.chooseAColor + title: JamiStrings.chooseAColor onAccepted: { console.warn("TODO SAVE preference") CurrentConversation.color = colorDialog.color @@ -220,14 +220,14 @@ Rectangle { } } - RowLayout { - Layout.leftMargin: JamiTheme.preferredMarginSize + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 Text { - Layout.fillWidth: true - Layout.preferredHeight: 30 - Layout.rightMargin: JamiTheme.preferredMarginSize - + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: JamiTheme.preferredMarginSize text: JamiStrings.leaveTheSwarm font.pointSize: JamiTheme.settingsFontSize font.kerning: true @@ -238,17 +238,20 @@ Rectangle { color: JamiTheme.textColor } - PushButton { - id: leaveTheSwarmBtn - - anchors.verticalCenter: parent.verticalCenter - source: JamiResources.round_close_24dp_svg + color: "transparent" - normalColor: JamiTheme.backgroundColor - imageColor: JamiTheme.textColor - toolTipText: JamiStrings.leave + HoverHandler { + target: parent + enabled: parent.visible + onHoveredChanged: { + parent.color = hovered ? Qt.darker(JamiTheme.selectedColor, 1.05) : "transparent" + } + } - onClicked: { + TapHandler { + target: parent + enabled: parent.visible + onTapped: function onTapped(eventPoint) { MessagesAdapter.removeConversation(LRCInstance.selectedConvUid) } } diff --git a/src/utilsadapter.cpp b/src/utilsadapter.cpp index 449fd1e1b..8a239ec88 100644 --- a/src/utilsadapter.cpp +++ b/src/utilsadapter.cpp @@ -571,5 +571,6 @@ UtilsAdapter::getParticipantRole(const QString& accountId, const QString& convId bool UtilsAdapter::luma(const QColor& color) const { - return (0.2126 * color.red() + 0.7152 * color.green() + 0.0722 * color.blue()) > .6; + return (0.2126 * color.red() + 0.7152 * color.green() + 0.0722 * color.blue()) + < 153 /* .6 * 256 */; } -- GitLab