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
922ab786
Commit
922ab786
authored
Nov 09, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Utils): add `imagesHeight`/`imagesWidth` options to `encodeUrisToQmlFormat`
parent
737c52aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
Message.qml
tests/ui/modules/Linphone/Chat/Message.qml
+5
-2
ChatStyle.qml
tests/ui/modules/Linphone/Styles/ChatStyle.qml
+1
-0
utils.js
tests/ui/scripts/Utils/utils.js
+14
-3
No files found.
tests/ui/modules/Linphone/Chat/Message.qml
View file @
922ab786
...
...
@@ -39,12 +39,15 @@ Item {
padding
:
ChatStyle
.
entry
.
message
.
padding
readOnly
:
true
selectByMouse
:
true
text
:
Utils
.
encodeUrisToQmlFormat
(
$content
)
text
:
Utils
.
encodeUrisToQmlFormat
(
$content
,
{
imagesHeight
:
ChatStyle
.
entry
.
message
.
imagesHeight
,
imagesWidth
:
'
auto
'
})
wrapMode
:
Text
.
Wrap
// See http://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop
// and http://doc.qt.io/qt-5/richtext-html-subset.html
textFormat
:
Text
.
RichText
textFormat
:
Text
.
RichText
// To supports links and imgs.
onLinkActivated
:
Qt
.
openUrlExternally
(
link
)
...
...
tests/ui/modules/Linphone/Styles/ChatStyle.qml
View file @
922ab786
...
...
@@ -47,6 +47,7 @@ QtObject {
}
property
QtObject
message
:
QtObject
{
property
int
imagesHeight
:
48
property
int
padding
:
8
property
int
radius
:
4
...
...
tests/ui/scripts/Utils/utils.js
View file @
922ab786
...
...
@@ -142,9 +142,13 @@ function qmlTypeof (object, className) {
// -------------------------------------------------------------------
function
encodeUrisToQmlFormat
(
text
)
{
function
encodeUrisToQmlFormat
(
text
,
options
)
{
var
images
=
''
if
(
options
==
null
)
{
options
=
{}
}
text
=
text
.
replace
(
/</g
,
'
\
u2063<
'
)
.
replace
(
/>/g
,
'
\
u2063>
'
)
...
...
@@ -156,8 +160,15 @@ function encodeUrisToQmlFormat (text) {
var
ext
=
getExtension
(
match
)
if
(
includes
([
'
jpg
'
,
'
jpeg
'
,
'
gif
'
,
'
png
'
,
'
svg
'
],
ext
))
{
images
+=
'
<a href="
'
+
match
+
'
"><img width="auto" height="48" src="
'
+
match
+
'
" /></a>
'
images
+=
'
<a href="
'
+
match
+
'
"><img
'
+
(
options
.
imageWidth
!=
null
?
'
width="
'
+
options
.
imagesWidth
+
'
"
'
:
''
)
+
(
options
.
imageHeight
!=
null
?
'
height="
'
+
options
.
imagesHeight
+
'
"
'
:
''
)
+
'
src="
'
+
match
+
'
" /></a>
'
}
return
'
<a href="
'
+
match
+
'
">
'
+
match
+
'
</a>
'
...
...
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