Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
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
Container 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
nheko
Commits
56e27ced
Commit
56e27ced
authored
5 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Format date (close to) the old way in qml timeline
parent
ccedbde3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
resources/qml/TimelineView.qml
+1
-1
1 addition, 1 deletion
resources/qml/TimelineView.qml
src/timeline2/TimelineModel.cpp
+17
-0
17 additions, 0 deletions
src/timeline2/TimelineModel.cpp
src/timeline2/TimelineModel.h
+2
-0
2 additions, 0 deletions
src/timeline2/TimelineModel.h
with
20 additions
and
1 deletion
resources/qml/TimelineView.qml
+
1
−
1
View file @
56e27ced
...
...
@@ -104,7 +104,7 @@ Rectangle {
id
:
dateBubble
anchors.horizontalCenter
:
parent
.
horizontalCenter
visible
:
section
.
includes
(
"
"
)
text
:
Qt
.
formatDate
(
new
Date
(
Number
(
section
.
split
(
"
"
)[
1
])))
text
:
chat
.
model
.
formatDate
Separator
(
new
Date
(
Number
(
section
.
split
(
"
"
)[
1
])))
height
:
contentHeight
*
1.2
width
:
contentWidth
*
1.2
horizontalAlignment
:
Text
.
AlignHCenter
...
...
This diff is collapsed.
Click to expand it.
src/timeline2/TimelineModel.cpp
+
17
−
0
View file @
56e27ced
#include
"TimelineModel.h"
#include
<QRegularExpression>
#include
"Logging.h"
#include
"Utils.h"
...
...
@@ -196,3 +198,18 @@ TimelineModel::displayName(QString id) const
{
return
Cache
::
displayName
(
room_id_
,
id
);
}
QString
TimelineModel
::
formatDateSeparator
(
QDate
date
)
const
{
auto
now
=
QDateTime
::
currentDateTime
();
QString
fmt
=
QLocale
::
system
().
dateFormat
(
QLocale
::
LongFormat
);
if
(
now
.
date
().
year
()
==
date
.
year
())
{
QRegularExpression
rx
(
"[^a-zA-Z]*y+[^a-zA-Z]*"
);
fmt
=
fmt
.
remove
(
rx
);
}
return
date
.
toString
(
fmt
);
}
This diff is collapsed.
Click to expand it.
src/timeline2/TimelineModel.h
+
2
−
0
View file @
56e27ced
...
...
@@ -2,6 +2,7 @@
#include
<QAbstractListModel>
#include
<QColor>
#include
<QDate>
#include
<QHash>
#include
<mtx/responses.hpp>
...
...
@@ -30,6 +31,7 @@ public:
Q_INVOKABLE
QColor
userColor
(
QString
id
,
QColor
background
);
Q_INVOKABLE
QString
displayName
(
QString
id
)
const
;
Q_INVOKABLE
QString
formatDateSeparator
(
QDate
date
)
const
;
void
addEvents
(
const
mtx
::
responses
::
Timeline
&
events
);
...
...
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