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
1882198e
Commit
1882198e
authored
6 years ago
by
Joe Donofry
Browse files
Options
Downloads
Patches
Plain Diff
Make the author text slightly large.
Add author color generated based on user id.
parent
10095b87
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
src/Utils.cpp
+17
-0
17 additions, 0 deletions
src/Utils.cpp
src/Utils.h
+4
-0
4 additions, 0 deletions
src/Utils.h
src/timeline/TimelineItem.cpp
+6
-2
6 additions, 2 deletions
src/timeline/TimelineItem.cpp
with
27 additions
and
2 deletions
src/Utils.cpp
+
17
−
0
View file @
1882198e
...
...
@@ -382,6 +382,23 @@ utils::linkColor()
return
QPalette
().
color
(
QPalette
::
Link
).
name
();
}
QString
utils
::
generateHexColor
(
const
QString
&
input
)
{
auto
hash
=
0
;
for
(
int
i
=
0
;
i
<
input
.
length
();
i
++
)
{
hash
=
input
.
at
(
i
).
digitValue
()
+
((
hash
<<
5
)
-
hash
);
}
hash
*=
13
;
QString
colour
(
"#"
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
int
value
=
(
hash
>>
(
i
*
8
))
&
0xFF
;
colour
.
append
((
"00"
+
QString
::
number
(
value
,
16
)).
right
(
2
));
}
return
colour
;
}
void
utils
::
centerWidget
(
QWidget
*
widget
,
QWidget
*
parent
)
{
...
...
This diff is collapsed.
Click to expand it.
src/Utils.h
+
4
−
0
View file @
1882198e
...
...
@@ -227,6 +227,10 @@ markdownToHtml(const QString &text);
QString
linkColor
();
//! Given an input string, create a color string
QString
generateHexColor
(
const
QString
&
string
);
//! Center a widget in relation to another widget.
void
centerWidget
(
QWidget
*
widget
,
QWidget
*
parent
);
...
...
This diff is collapsed.
Click to expand it.
src/timeline/TimelineItem.cpp
+
6
−
2
View file @
1882198e
...
...
@@ -622,8 +622,10 @@ TimelineItem::generateUserName(const QString &user_id, const QString &displaynam
sender
=
displayname
.
split
(
":"
)[
0
].
split
(
"@"
)[
1
];
}
auto
userColor
=
utils
::
generateHexColor
(
user_id
);
QFont
usernameFont
;
usernameFont
.
setPointSizeF
(
usernameFont
.
pointSizeF
());
usernameFont
.
setPointSizeF
(
usernameFont
.
pointSizeF
()
*
1.1
);
usernameFont
.
setWeight
(
QFont
::
Medium
);
QFontMetrics
fm
(
usernameFont
);
...
...
@@ -637,6 +639,8 @@ TimelineItem::generateUserName(const QString &user_id, const QString &displaynam
userName_
->
setAlignment
(
Qt
::
AlignLeft
|
Qt
::
AlignTop
);
userName_
->
setFixedWidth
(
QFontMetrics
(
userName_
->
font
()).
width
(
userName_
->
text
()));
userName_
->
setStyleSheet
(
"QLabel { color : "
+
userColor
+
"; }"
);
auto
filter
=
new
UserProfileFilter
(
user_id
,
userName_
);
userName_
->
installEventFilter
(
filter
);
userName_
->
setCursor
(
Qt
::
PointingHandCursor
);
...
...
@@ -837,4 +841,4 @@ TimelineItem::openRawMessageViewer() const
"failed to serialize event ({}, {})"
,
room_id
,
event_id
);
}
});
}
}
\ No newline at end of file
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