From 24a8631c34228ae7e05138b66f43aff39ceccf54 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Thu, 3 Jun 2021 12:40:48 -0400 Subject: [PATCH] misc: fix svg icon coloration Change-Id: Idfe409c6e01f8437cba2659e79234a6083bec04e --- src/DaemonReconnectWindow.qml | 2 - src/commoncomponents/PushButton.qml | 23 +++------ src/commoncomponents/ResponsiveImage.qml | 48 +++++++++++-------- .../contextmenu/GeneralMenuItem.qml | 1 - src/mainview/components/AboutPopUp.qml | 3 -- src/mainview/components/AccountComboBox.qml | 10 ++-- .../components/CallButtonDelegate.qml | 3 -- src/mainview/components/ContactSearchBar.qml | 6 +-- .../components/ParticipantOverlay.qml | 35 +++++--------- src/mainview/components/WelcomePage.qml | 7 ++- src/wizardview/components/WelcomePage.qml | 7 ++- 11 files changed, 57 insertions(+), 88 deletions(-) diff --git a/src/DaemonReconnectWindow.qml b/src/DaemonReconnectWindow.qml index ad6fd0564..8d7a64755 100644 --- a/src/DaemonReconnectWindow.qml +++ b/src/DaemonReconnectWindow.qml @@ -62,8 +62,6 @@ ApplicationWindow { anchors.fill: parent - smooth: true - antialiasing: true source: "qrc:/images/logo-jami-standard-coul.svg" } diff --git a/src/commoncomponents/PushButton.qml b/src/commoncomponents/PushButton.qml index 5d9710aa1..0cd0bdb68 100644 --- a/src/commoncomponents/PushButton.qml +++ b/src/commoncomponents/PushButton.qml @@ -102,22 +102,13 @@ AbstractButton { return normalImageSource } - layer { - enabled: imageColor || checkedColor - effect: ColorOverlay { - id: overlay - color: { - if (checked && checkedImageColor) - return checkedImageColor - else if (imageColor) - return imageColor - else - return JamiTheme.transparentColor - } - } - // Mipmap does not render correctly on linux - mipmap: false - smooth: true + color: { + if (checked && checkedImageColor) + return checkedImageColor + else if (imageColor) + return imageColor + else + return JamiTheme.transparentColor } } diff --git a/src/commoncomponents/ResponsiveImage.qml b/src/commoncomponents/ResponsiveImage.qml index 639505824..ee8135965 100644 --- a/src/commoncomponents/ResponsiveImage.qml +++ b/src/commoncomponents/ResponsiveImage.qml @@ -22,7 +22,7 @@ import QtGraphicalEffects 1.14 import net.jami.Models 1.0 -Image { +Item { id: root property real containerWidth: 30 @@ -31,8 +31,8 @@ Image { property int padding: 0 property point offset: Qt.point(0, 0) - property string normalSource - property string checkedSource + property alias source: image.source + property alias status: image.status property string color: "transparent" property bool isSvg: { @@ -47,29 +47,37 @@ Image { width: Math.trunc(containerWidth * Math.sqrt(2) * 0.5) + 3 - padding height: Math.trunc(containerHeight * Math.sqrt(2) * 0.5) + 3 - padding - fillMode: Image.PreserveAspectFit - smooth: false - antialiasing: false - asynchronous: true + Connections { + target: ScreenInfo - layer { - enabled: true - effect: ColorOverlay { color: root.color } + function onDevicePixelRatioChanged() { + image.setSourceSize() + } } - function setSourceSize() { - sourceSize = undefined - if (isSvg) - sourceSize = Qt.size(width, height) - } + Image { + id: image - Connections { - target: ScreenInfo + anchors.fill: root - function onDevicePixelRatioChanged() { - setSourceSize() + fillMode: Image.PreserveAspectFit + smooth: true + antialiasing: true + asynchronous: true + visible: false + + function setSourceSize() { + sourceSize = undefined + if (isSvg) + sourceSize = Qt.size(width, height) } + + Component.onCompleted: setSourceSize() } - Component.onCompleted: setSourceSize() + ColorOverlay { + anchors.fill: image + source: image + color: root.color + } } diff --git a/src/commoncomponents/contextmenu/GeneralMenuItem.qml b/src/commoncomponents/contextmenu/GeneralMenuItem.qml index 6aa3edc7e..e72dd6160 100644 --- a/src/commoncomponents/contextmenu/GeneralMenuItem.qml +++ b/src/commoncomponents/contextmenu/GeneralMenuItem.qml @@ -74,7 +74,6 @@ MenuItem { visible: status === Image.Ready color: iconColor !== "" ? iconColor : JamiTheme.textColor - smooth: true opacity: 0.7 } diff --git a/src/mainview/components/AboutPopUp.qml b/src/mainview/components/AboutPopUp.qml index 57e60590b..95353319e 100644 --- a/src/mainview/components/AboutPopUp.qml +++ b/src/mainview/components/AboutPopUp.qml @@ -66,9 +66,6 @@ ModalPopup { Layout.preferredWidth: 250 Layout.preferredHeight: 88 - smooth: true - antialiasing: true - source: JamiTheme.darkTheme? "qrc:/images/logo-jami-standard-coul-white.svg" : "qrc:/images/logo-jami-standard-coul.svg" diff --git a/src/mainview/components/AccountComboBox.qml b/src/mainview/components/AccountComboBox.qml index 36a4eb2a1..74ac5f320 100644 --- a/src/mainview/components/AccountComboBox.qml +++ b/src/mainview/components/AccountComboBox.qml @@ -188,16 +188,12 @@ Label { ResponsiveImage { id: arrowDropDown + anchors.verticalCenter: parent.verticalCenter + width: 24 height: 24 - anchors.verticalCenter: parent.verticalCenter - layer { - enabled: true - effect: ColorOverlay { - color: JamiTheme.textColor - } - } + color: JamiTheme.textColor source: !root.popup.opened ? "qrc:/images/icons/expand_more-24px.svg" : diff --git a/src/mainview/components/CallButtonDelegate.qml b/src/mainview/components/CallButtonDelegate.qml index 786f7e344..c636b5165 100644 --- a/src/mainview/components/CallButtonDelegate.qml +++ b/src/mainview/components/CallButtonDelegate.qml @@ -116,7 +116,6 @@ ItemDelegate { containerHeight: size anchors.centerIn: parent - horizontalAlignment: Text.AlignHCenter source: ItemAction ? ItemAction.icon.source : "" color: ItemAction ? ItemAction.icon.color : null @@ -189,7 +188,6 @@ ItemDelegate { contentItem: ResponsiveImage { source: isVertical ? "qrc:/images/icons/chevron_left_black_24dp.svg" : "qrc:/images/icons/expand_less-24px.svg" - smooth: true color: "white" } @@ -217,7 +215,6 @@ ItemDelegate { IconSource : (menuItem.ListView.isCurrentItem ? "qrc:/images/icons/check_box-24px.svg" : "qrc:/images/icons/check_box_outline_blank-24px.svg") - smooth: true color: "white" } Text { diff --git a/src/mainview/components/ContactSearchBar.qml b/src/mainview/components/ContactSearchBar.qml index ef817b4bb..37eb3f292 100644 --- a/src/mainview/components/ContactSearchBar.qml +++ b/src/mainview/components/ContactSearchBar.qml @@ -63,11 +63,7 @@ Rectangle { height: 20 source: "qrc:/images/icons/ic_baseline-search-24px.svg" - - layer.enabled: true - layer.effect: ColorOverlay { - color: JamiTheme.primaryForegroundColor - } + color: JamiTheme.primaryForegroundColor } TextField { diff --git a/src/mainview/components/ParticipantOverlay.qml b/src/mainview/components/ParticipantOverlay.qml index cb64ddd70..7aa24d2c1 100644 --- a/src/mainview/components/ParticipantOverlay.qml +++ b/src/mainview/components/ParticipantOverlay.qml @@ -129,57 +129,46 @@ Item { ResponsiveImage { id: isHostIndicator - visible: participantIsHost - Layout.alignment: Qt.AlignVCenter Layout.leftMargin: 6 + containerHeight: 12 containerWidth: 12 + visible: participantIsHost + source: "qrc:/images/icons/star_outline-24px.svg" - layer { - enabled: true - effect: ColorOverlay { color: JamiTheme.whiteColor } - mipmap: false - smooth: true - } + color: JamiTheme.whiteColor } ResponsiveImage { id: isModeratorIndicator - visible: participantIsModerator - Layout.alignment: Qt.AlignVCenter Layout.leftMargin: 6 + containerHeight: 12 containerWidth: 12 + visible: participantIsModerator + source: "qrc:/images/icons/moderator.svg" - layer { - enabled: true - effect: ColorOverlay { color: JamiTheme.whiteColor } - mipmap: false - smooth: true - } + color: JamiTheme.whiteColor } ResponsiveImage { id: isMutedIndicator - visible: participantIsMuted Layout.alignment: Qt.AlignVCenter Layout.leftMargin: 6 + containerHeight: 12 containerWidth: 12 + visible: participantIsMuted + source: "qrc:/images/icons/mic_off-24px.svg" - layer { - enabled: true - effect: ColorOverlay { color: JamiTheme.whiteColor } - mipmap: false - smooth: true - } + color: JamiTheme.whiteColor } } } diff --git a/src/mainview/components/WelcomePage.qml b/src/mainview/components/WelcomePage.qml index 279b9dbc8..23c07095a 100644 --- a/src/mainview/components/WelcomePage.qml +++ b/src/mainview/components/WelcomePage.qml @@ -54,10 +54,9 @@ Rectangle { Layout.preferredHeight: Math.min(welcomePageColumnLayout.width / 3, 110) Layout.bottomMargin: 10 - smooth: true - antialiasing: true - - source: JamiTheme.darkTheme? "qrc:/images/logo-jami-standard-coul-white.svg" : "qrc:/images/logo-jami-standard-coul.svg" + source: JamiTheme.darkTheme ? + "qrc:/images/logo-jami-standard-coul-white.svg" : + "qrc:/images/logo-jami-standard-coul.svg" } Label { diff --git a/src/wizardview/components/WelcomePage.qml b/src/wizardview/components/WelcomePage.qml index 48ba545b5..482d94d4b 100644 --- a/src/wizardview/components/WelcomePage.qml +++ b/src/wizardview/components/WelcomePage.qml @@ -69,10 +69,9 @@ Rectangle { Layout.preferredWidth: 330 Layout.preferredHeight: 110 - smooth: true - antialiasing: true - - source: JamiTheme.darkTheme ? "qrc:/images/logo-jami-standard-coul-white.svg" : "qrc:/images/logo-jami-standard-coul.svg" + source: JamiTheme.darkTheme ? + "qrc:/images/logo-jami-standard-coul-white.svg" : + "qrc:/images/logo-jami-standard-coul.svg" } MaterialButton { -- GitLab