Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-client-macos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-client-macos
Commits
98f67cd3
Commit
98f67cd3
authored
9 years ago
by
Alexandre Lision
Browse files
Options
Downloads
Patches
Plain Diff
chat: add sender name and interline space
Refs #76102 Change-Id: I5b89dee637cf98ada09c1c1af3fe403f8559285d
parent
f47a2561
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ChatVC.mm
+21
-3
21 additions, 3 deletions
src/ChatVC.mm
with
21 additions
and
3 deletions
src/ChatVC.mm
+
21
−
3
View file @
98f67cd3
...
...
@@ -77,6 +77,11 @@
[
=
](
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
)
{
[
self
setupChat
];
});
// Override default style to add interline space
NSMutableParagraphStyle
*
paragraphStyle
=
[[
NSMutableParagraphStyle
alloc
]
init
];
paragraphStyle
.
lineSpacing
=
8
;
[
chatView
setDefaultParagraphStyle
:
paragraphStyle
];
}
-
(
void
)
setupChat
...
...
@@ -141,10 +146,23 @@
if
(
!
msgIdx
.
isValid
())
return
;
QVariant
message
=
msgIdx
.
data
();
NSAttributedString
*
attr
=
[[
NSAttributedString
alloc
]
initWithString
:
[
NSString
stringWithFormat
:
@"%@
\n
"
,
message
.
value
<
QString
>
().
toNSString
()]];
NSString
*
message
=
msgIdx
.
data
(
Qt
::
DisplayRole
).
value
<
QString
>
().
toNSString
();
NSString
*
author
=
msgIdx
.
data
((
int
)
Media
::
TextRecording
::
Role
::
AuthorDisplayname
).
value
<
QString
>
().
toNSString
();
NSMutableAttributedString
*
attr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
[
NSString
stringWithFormat
:
@"%@: %@
\n
"
,
author
,
message
]];
// put in bold type author name
[
attr
applyFontTraits
:
NSBoldFontMask
range
:
NSMakeRange
(
0
,
[
author
length
])];
[[
chatView
textStorage
]
appendAttributedString
:
attr
];
// reapply paragraph style on all the text
NSRange
range
=
NSMakeRange
(
0
,[
chatView
textStorage
].
length
);
[[
self
.
chatView
textStorage
]
addAttribute
:
NSParagraphStyleAttributeName
value:
chatView
.
defaultParagraphStyle
range:
range
];
[
chatView
scrollRangeToVisible
:
NSMakeRange
([[
chatView
string
]
length
],
0
)];
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment