Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
c3c64c75
Commit
c3c64c75
authored
Dec 01, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Linphone/Contact/Avatar): uses the `RoundedImage` component
parent
80a19c1d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
36 deletions
+22
-36
RoundedImage.qml
tests/ui/modules/Common/Image/RoundedImage.qml
+11
-6
Avatar.qml
tests/ui/modules/Linphone/Contact/Avatar.qml
+9
-25
AvatarStyle.qml
tests/ui/modules/Linphone/Styles/Contact/AvatarStyle.qml
+2
-5
No files found.
tests/ui/modules/Common/Image/RoundedImage.qml
View file @
c3c64c75
...
...
@@ -3,8 +3,11 @@ import QtQuick 2.7
// ===================================================================
Item
{
id
:
item
property
alias
source
:
image
.
source
property
color
colorMask
:
'
#00000000
'
property
color
backgroundColor
:
'
#00000000
'
property
color
foregroundColor
:
'
#00000000
'
// vec4(0.812, 0.843, 0.866, 1.0) 0.9
Item
{
...
...
@@ -27,23 +30,25 @@ Item {
layer
{
effect
:
ShaderEffect
{
property
color
backgroundColor
:
item
.
backgroundColor
property
color
foregroundColor
:
item
.
foregroundColor
property
var
image
:
imageContainer
property
var
color
:
colorMask
fragmentShader
:
'
uniform lowp sampler2D image;
uniform lowp sampler2D mask;
uniform lowp vec4 color;
uniform lowp vec4 backgroundColor;
uniform lowp vec4 foregroundColor;
uniform lowp float qt_Opacity;
varying highp vec2 qt_TexCoord0;
void main () {
vec4 tex = texture2D(image, qt_TexCoord0);
vec4 interpolation = mix(backgroundColor, vec4(tex.rgb, 1.0), tex.a);
interpolation = mix(interpolation, vec4(foregroundColor.rgb, 1.0), foregroundColor.a);
gl_FragColor = mix(tex, vec4(color.rgb, 1.0), color.a) *
texture2D(mask, qt_TexCoord0) *
qt_Opacity;
gl_FragColor = interpolation * texture2D(mask, qt_TexCoord0) * qt_Opacity;
}
'
}
...
...
tests/ui/modules/Linphone/Contact/Avatar.qml
View file @
c3c64c75
import
QtQuick
2.7
import
QtGraphicalEffects
1.0
import
Common
1.0
import
Linphone
1.0
import
Linphone
.
Styles
1.0
import
Utils
1.0
...
...
@@ -8,12 +9,14 @@ import Utils 1.0
// ===================================================================
Item
{
property
alias
image
:
imageToFilter
.
source
property
alias
image
:
roundedImage
.
source
property
alias
presenceLevel
:
presenceLevel
.
level
property
string
username
property
var
_initialsRegex
:
/^
\s
*
([^\s\.]
+
)(?:[\s\.]
+
([^\s\.]
+
))?
/
// -----------------------------------------------------------------
function
_computeInitials
()
{
var
result
=
username
.
match
(
_initialsRegex
)
...
...
@@ -29,16 +32,8 @@ Item {
)
}
// Image mask. (Circle)
Rectangle
{
id
:
mask
anchors.fill
:
parent
color
:
AvatarStyle
.
mask
.
color
radius
:
AvatarStyle
.
mask
.
radius
}
// -----------------------------------------------------------------
// Initials.
Text
{
anchors.centerIn
:
parent
color
:
AvatarStyle
.
initials
.
color
...
...
@@ -55,24 +50,13 @@ Item {
text
:
_computeInitials
()
}
Image
{
anchors.fill
:
parent
id
:
imageToFilter
fillMode
:
Image
.
PreserveAspectFit
// Image must be invisible.
// The only visible image is the OpacityMask!
visible
:
false
}
RoundedImage
{
id
:
roundedImage
// Avatar.
OpacityMask
{
anchors.fill
:
imageToFilter
maskSource
:
mask
source
:
imageToFilter
anchors.fill
:
parent
backgroundColor
:
AvatarStyle
.
backgroundColor
}
// Presence.
PresenceLevel
{
id
:
presenceLevel
...
...
tests/ui/modules/Linphone/Styles/Contact/AvatarStyle.qml
View file @
c3c64c75
...
...
@@ -6,14 +6,11 @@ import Common 1.0
// ===================================================================
QtObject
{
property
color
backgroundColor
:
Colors
.
r
property
QtObject
initials
:
QtObject
{
property
color
color
:
Colors
.
k
property
int
fontSize
:
10
property
int
ratio
:
30
}
property
QtObject
mask
:
QtObject
{
property
color
color
:
Colors
.
r
property
int
radius
:
500
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment