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
19e3036c
Commit
19e3036c
authored
5 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Add timestamp
parent
1a62bfb8
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
+18
-7
18 additions, 7 deletions
qml/pages/delegates/TextMessage.qml
src/models/roommodel.cpp
+6
-0
6 additions, 0 deletions
src/models/roommodel.cpp
src/models/roommodel.h
+1
-0
1 addition, 0 deletions
src/models/roommodel.h
with
25 additions
and
7 deletions
qml/pages/delegates/TextMessage.qml
+
18
−
7
View file @
19e3036c
...
...
@@ -2,12 +2,23 @@ import QtQuick 2.0
import
Sailfish
.
Silica
1.0
Rectangle
{
height
:
messageText
.
contentHeight
Text
{
id
:
messageText
text
:
modelData
.
Body
color
:
Theme
.
primaryColor
wrapMode
:
Text
.
Wrap
width
:
chatView
.
width
height
:
col
.
height
Column
{
id
:
col
Text
{
id
:
messageText
text
:
modelData
.
Body
color
:
Theme
.
primaryColor
wrapMode
:
Text
.
Wrap
width
:
chatView
.
width
}
Text
{
anchors.right
:
col
.
right
text
:
modelData
.
Timestamp
.
toLocaleTimeString
()
color
:
Theme
.
highlightColor
font.pixelSize
:
Theme
.
fontSizeTiny
horizontalAlignment
:
Text
.
AlignRight
}
}
}
This diff is collapsed.
Click to expand it.
src/models/roommodel.cpp
+
6
−
0
View file @
19e3036c
...
...
@@ -19,6 +19,8 @@ template <class T> auto eventBody(const mtx::events::RoomEvent<T> &e) -> decltyp
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
;
}
template
<
class
T
>
auto
eventTimestamp
(
const
mtx
::
events
::
Event
<
T
>
&
e
)
->
uint64_t
{
return
0
;
}
template
<
class
T
>
auto
eventTimestamp
(
const
mtx
::
events
::
RoomEvent
<
T
>
&
e
)
->
uint64_t
{
return
e
.
origin_server_ts
;
}
template
<
class
T
>
::
EventType
::
Type
toRoomEventType
(
const
Event
<
T
>
&
e
)
{
using
mtx
::
events
::
EventType
;
...
...
@@ -180,6 +182,7 @@ QHash<int, QByteArray> Room::roleNames() const {
roles
[
Body
]
=
"Body"
;
roles
[
UserId
]
=
"UserId"
;
roles
[
UserName
]
=
"UserName"
;
roles
[
Timestamp
]
=
"Timestamp"
;
return
roles
;
}
...
...
@@ -210,6 +213,9 @@ QVariant Room::data(const QModelIndex &index, int role) const {
}
},
event
.
data
));
case
Timestamp
:
return
QDateTime
::
fromMSecsSinceEpoch
(
boost
::
apply_visitor
([](
const
auto
&
e
)
->
uint64_t
{
return
eventTimestamp
(
e
);
},
event
.
data
));
default
:
return
QVariant
();
}
...
...
This diff is collapsed.
Click to expand it.
src/models/roommodel.h
+
1
−
0
View file @
19e3036c
...
...
@@ -93,6 +93,7 @@ struct Room : public QAbstractListModel {
Body
,
UserId
,
UserName
,
Timestamp
,
};
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
...
...
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