1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 14:55:43 +02:00

misc: fix svg icon coloration

Change-Id: Idfe409c6e01f8437cba2659e79234a6083bec04e
This commit is contained in:
Andreas Traczyk 2021-06-03 12:40:48 -04:00 committed by Ming Rui Zhang
parent b3fb4e3aa7
commit 24a8631c34
11 changed files with 59 additions and 90 deletions

View file

@ -62,8 +62,6 @@ ApplicationWindow {
anchors.fill: parent anchors.fill: parent
smooth: true
antialiasing: true
source: "qrc:/images/logo-jami-standard-coul.svg" source: "qrc:/images/logo-jami-standard-coul.svg"
} }

View file

@ -102,22 +102,13 @@ AbstractButton {
return normalImageSource return normalImageSource
} }
layer { color: {
enabled: imageColor || checkedColor if (checked && checkedImageColor)
effect: ColorOverlay { return checkedImageColor
id: overlay else if (imageColor)
color: { return imageColor
if (checked && checkedImageColor) else
return checkedImageColor return JamiTheme.transparentColor
else if (imageColor)
return imageColor
else
return JamiTheme.transparentColor
}
}
// Mipmap does not render correctly on linux
mipmap: false
smooth: true
} }
} }

View file

@ -22,7 +22,7 @@ import QtGraphicalEffects 1.14
import net.jami.Models 1.0 import net.jami.Models 1.0
Image { Item {
id: root id: root
property real containerWidth: 30 property real containerWidth: 30
@ -31,8 +31,8 @@ Image {
property int padding: 0 property int padding: 0
property point offset: Qt.point(0, 0) property point offset: Qt.point(0, 0)
property string normalSource property alias source: image.source
property string checkedSource property alias status: image.status
property string color: "transparent" property string color: "transparent"
property bool isSvg: { property bool isSvg: {
@ -47,29 +47,37 @@ Image {
width: Math.trunc(containerWidth * Math.sqrt(2) * 0.5) + 3 - padding width: Math.trunc(containerWidth * Math.sqrt(2) * 0.5) + 3 - padding
height: Math.trunc(containerHeight * 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
layer {
enabled: true
effect: ColorOverlay { color: root.color }
}
function setSourceSize() {
sourceSize = undefined
if (isSvg)
sourceSize = Qt.size(width, height)
}
Connections { Connections {
target: ScreenInfo target: ScreenInfo
function onDevicePixelRatioChanged() { function onDevicePixelRatioChanged() {
setSourceSize() image.setSourceSize()
} }
} }
Component.onCompleted: setSourceSize() Image {
id: image
anchors.fill: root
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()
}
ColorOverlay {
anchors.fill: image
source: image
color: root.color
}
} }

View file

@ -74,7 +74,6 @@ MenuItem {
visible: status === Image.Ready visible: status === Image.Ready
color: iconColor !== "" ? iconColor : JamiTheme.textColor color: iconColor !== "" ? iconColor : JamiTheme.textColor
smooth: true
opacity: 0.7 opacity: 0.7
} }

View file

@ -66,9 +66,6 @@ ModalPopup {
Layout.preferredWidth: 250 Layout.preferredWidth: 250
Layout.preferredHeight: 88 Layout.preferredHeight: 88
smooth: true
antialiasing: true
source: JamiTheme.darkTheme? source: JamiTheme.darkTheme?
"qrc:/images/logo-jami-standard-coul-white.svg" : "qrc:/images/logo-jami-standard-coul-white.svg" :
"qrc:/images/logo-jami-standard-coul.svg" "qrc:/images/logo-jami-standard-coul.svg"

View file

@ -188,16 +188,12 @@ Label {
ResponsiveImage { ResponsiveImage {
id: arrowDropDown id: arrowDropDown
width: 24
height: 24
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
layer { width: 24
enabled: true height: 24
effect: ColorOverlay {
color: JamiTheme.textColor color: JamiTheme.textColor
}
}
source: !root.popup.opened ? source: !root.popup.opened ?
"qrc:/images/icons/expand_more-24px.svg" : "qrc:/images/icons/expand_more-24px.svg" :

View file

@ -116,7 +116,6 @@ ItemDelegate {
containerHeight: size containerHeight: size
anchors.centerIn: parent anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
source: ItemAction ? ItemAction.icon.source : "" source: ItemAction ? ItemAction.icon.source : ""
color: ItemAction ? ItemAction.icon.color : null color: ItemAction ? ItemAction.icon.color : null
@ -189,7 +188,6 @@ ItemDelegate {
contentItem: ResponsiveImage { contentItem: ResponsiveImage {
source: isVertical ? "qrc:/images/icons/chevron_left_black_24dp.svg" : source: isVertical ? "qrc:/images/icons/chevron_left_black_24dp.svg" :
"qrc:/images/icons/expand_less-24px.svg" "qrc:/images/icons/expand_less-24px.svg"
smooth: true
color: "white" color: "white"
} }
@ -217,7 +215,6 @@ ItemDelegate {
IconSource : (menuItem.ListView.isCurrentItem ? IconSource : (menuItem.ListView.isCurrentItem ?
"qrc:/images/icons/check_box-24px.svg" : "qrc:/images/icons/check_box-24px.svg" :
"qrc:/images/icons/check_box_outline_blank-24px.svg") "qrc:/images/icons/check_box_outline_blank-24px.svg")
smooth: true
color: "white" color: "white"
} }
Text { Text {

View file

@ -63,11 +63,7 @@ Rectangle {
height: 20 height: 20
source: "qrc:/images/icons/ic_baseline-search-24px.svg" source: "qrc:/images/icons/ic_baseline-search-24px.svg"
color: JamiTheme.primaryForegroundColor
layer.enabled: true
layer.effect: ColorOverlay {
color: JamiTheme.primaryForegroundColor
}
} }
TextField { TextField {

View file

@ -129,57 +129,46 @@ Item {
ResponsiveImage { ResponsiveImage {
id: isHostIndicator id: isHostIndicator
visible: participantIsHost
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: 6 Layout.leftMargin: 6
containerHeight: 12 containerHeight: 12
containerWidth: 12 containerWidth: 12
visible: participantIsHost
source: "qrc:/images/icons/star_outline-24px.svg" source: "qrc:/images/icons/star_outline-24px.svg"
layer { color: JamiTheme.whiteColor
enabled: true
effect: ColorOverlay { color: JamiTheme.whiteColor }
mipmap: false
smooth: true
}
} }
ResponsiveImage { ResponsiveImage {
id: isModeratorIndicator id: isModeratorIndicator
visible: participantIsModerator
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: 6 Layout.leftMargin: 6
containerHeight: 12 containerHeight: 12
containerWidth: 12 containerWidth: 12
visible: participantIsModerator
source: "qrc:/images/icons/moderator.svg" source: "qrc:/images/icons/moderator.svg"
layer { color: JamiTheme.whiteColor
enabled: true
effect: ColorOverlay { color: JamiTheme.whiteColor }
mipmap: false
smooth: true
}
} }
ResponsiveImage { ResponsiveImage {
id: isMutedIndicator id: isMutedIndicator
visible: participantIsMuted
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: 6 Layout.leftMargin: 6
containerHeight: 12 containerHeight: 12
containerWidth: 12 containerWidth: 12
visible: participantIsMuted
source: "qrc:/images/icons/mic_off-24px.svg" source: "qrc:/images/icons/mic_off-24px.svg"
layer { color: JamiTheme.whiteColor
enabled: true
effect: ColorOverlay { color: JamiTheme.whiteColor }
mipmap: false
smooth: true
}
} }
} }
} }

View file

@ -54,10 +54,9 @@ Rectangle {
Layout.preferredHeight: Math.min(welcomePageColumnLayout.width / 3, 110) Layout.preferredHeight: Math.min(welcomePageColumnLayout.width / 3, 110)
Layout.bottomMargin: 10 Layout.bottomMargin: 10
smooth: true source: JamiTheme.darkTheme ?
antialiasing: true "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 { Label {

View file

@ -69,10 +69,9 @@ Rectangle {
Layout.preferredWidth: 330 Layout.preferredWidth: 330
Layout.preferredHeight: 110 Layout.preferredHeight: 110
smooth: true source: JamiTheme.darkTheme ?
antialiasing: true "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 { MaterialButton {