Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Konheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review 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
Show more breadcrumbs
Nheko Reborn
Konheko
Commits
f54ed448
Commit
f54ed448
authored
5 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Html format messages, where supported
parent
19e3036c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
qml/pages/delegates/TextMessage.qml
+1
-1
1 addition, 1 deletion
qml/pages/delegates/TextMessage.qml
src/models/roommodel.cpp
+12
-1
12 additions, 1 deletion
src/models/roommodel.cpp
src/models/roommodel.h
+1
-0
1 addition, 0 deletions
src/models/roommodel.h
with
14 additions
and
2 deletions
qml/pages/delegates/TextMessage.qml
+
1
−
1
View file @
f54ed448
...
...
@@ -8,7 +8,7 @@ Rectangle {
Text
{
id
:
messageText
text
:
modelData
.
Body
text
:
modelData
.
Formatted
Body
color
:
Theme
.
primaryColor
wrapMode
:
Text
.
Wrap
width
:
chatView
.
width
...
...
This diff is collapsed.
Click to expand it.
src/models/roommodel.cpp
+
12
−
1
View file @
f54ed448
...
...
@@ -12,10 +12,17 @@ Q_DECLARE_METATYPE(QSharedPointer<Room>);
using
mtx
::
events
::
Event
;
template
<
class
T
>
std
::
string
eventBody
(
const
Event
<
T
>
&
)
{
return
""
;
}
template
<
class
T
>
auto
eventBody
(
const
mtx
::
events
::
RoomEvent
<
T
>
&
e
)
->
decltype
(
e
.
content
.
body
)
{
return
e
.
content
.
body
;
}
template
<
class
T
>
std
::
string
eventFormattedBody
(
const
Event
<
T
>
&
)
{
return
""
;
}
template
<
class
T
>
auto
eventFormattedBody
(
const
mtx
::
events
::
RoomEvent
<
T
>
&
e
)
->
decltype
(
e
.
content
.
formatted_body
)
{
auto
temp
=
e
.
content
.
formatted_body
;
if
(
!
temp
.
empty
())
return
temp
;
else
return
e
.
content
.
body
;
}
template
<
class
T
>
auto
eventUserId
(
const
mtx
::
events
::
Event
<
T
>
&
e
)
->
std
::
string
{
return
""
;
}
template
<
class
T
>
auto
eventUserId
(
const
mtx
::
events
::
RoomEvent
<
T
>
&
e
)
->
std
::
string
{
return
e
.
sender
;
}
...
...
@@ -180,6 +187,7 @@ QHash<int, QByteArray> Room::roleNames() const {
QHash
<
int
,
QByteArray
>
roles
;
roles
[
Type
]
=
"Type"
;
roles
[
Body
]
=
"Body"
;
roles
[
FormattedBody
]
=
"FormattedBody"
;
roles
[
UserId
]
=
"UserId"
;
roles
[
UserName
]
=
"UserName"
;
roles
[
Timestamp
]
=
"Timestamp"
;
...
...
@@ -200,6 +208,9 @@ QVariant Room::data(const QModelIndex &index, int role) const {
case
Body
:
return
QString
::
fromStdString
(
boost
::
apply_visitor
([](
const
auto
&
e
)
->
std
::
string
{
return
eventBody
(
e
);
},
event
.
data
));
case
FormattedBody
:
return
QString
::
fromStdString
(
boost
::
apply_visitor
([](
const
auto
&
e
)
->
std
::
string
{
return
eventFormattedBody
(
e
);
},
event
.
data
));
case
UserId
:
return
QString
::
fromStdString
(
boost
::
apply_visitor
([](
const
auto
&
e
)
->
std
::
string
{
return
eventUserId
(
e
);
},
event
.
data
));
...
...
This diff is collapsed.
Click to expand it.
src/models/roommodel.h
+
1
−
0
View file @
f54ed448
...
...
@@ -91,6 +91,7 @@ struct Room : public QAbstractListModel {
enum
Roles
{
Type
,
Body
,
FormattedBody
,
UserId
,
UserName
,
Timestamp
,
...
...
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