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
b0c3fd5a
Commit
b0c3fd5a
authored
4 years ago
by
Loren Burkholder
Browse files
Options
Downloads
Patches
Plain Diff
Remove UserItem class
parent
2132863a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#367
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/popups/PopupItem.cpp
+0
-62
0 additions, 62 deletions
src/popups/PopupItem.cpp
src/popups/PopupItem.h
+0
-20
0 additions, 20 deletions
src/popups/PopupItem.h
with
0 additions
and
82 deletions
src/popups/PopupItem.cpp
+
0
−
62
View file @
b0c3fd5a
...
...
@@ -37,68 +37,6 @@ PopupItem::paintEvent(QPaintEvent *)
p
.
fillRect
(
rect
(),
hoverColor_
);
}
UserItem
::
UserItem
(
QWidget
*
parent
)
:
PopupItem
(
parent
)
{
userName_
=
new
QLabel
(
"Placeholder"
,
this
);
avatar_
->
setLetter
(
"P"
);
topLayout_
->
addWidget
(
avatar_
);
topLayout_
->
addWidget
(
userName_
,
1
);
}
UserItem
::
UserItem
(
QWidget
*
parent
,
const
QString
&
user_id
)
:
PopupItem
(
parent
)
,
userId_
{
user_id
}
{
auto
displayName
=
cache
::
displayName
(
ChatPage
::
instance
()
->
currentRoom
(),
userId_
);
avatar_
->
setLetter
(
utils
::
firstChar
(
displayName
));
// If it's a matrix id we use the second letter.
if
(
displayName
.
size
()
>
1
&&
displayName
.
at
(
0
)
==
'@'
)
avatar_
->
setLetter
(
QChar
(
displayName
.
at
(
1
)));
userName_
=
new
QLabel
(
displayName
,
this
);
topLayout_
->
addWidget
(
avatar_
);
topLayout_
->
addWidget
(
userName_
,
1
);
resolveAvatar
(
user_id
);
}
void
UserItem
::
updateItem
(
const
QString
&
user_id
)
{
userId_
=
user_id
;
auto
displayName
=
cache
::
displayName
(
ChatPage
::
instance
()
->
currentRoom
(),
userId_
);
// If it's a matrix id we use the second letter.
if
(
displayName
.
size
()
>
1
&&
displayName
.
at
(
0
)
==
'@'
)
avatar_
->
setLetter
(
QChar
(
displayName
.
at
(
1
)));
else
avatar_
->
setLetter
(
utils
::
firstChar
(
displayName
));
userName_
->
setText
(
displayName
);
resolveAvatar
(
user_id
);
}
void
UserItem
::
resolveAvatar
(
const
QString
&
user_id
)
{
avatar_
->
setImage
(
ChatPage
::
instance
()
->
currentRoom
(),
user_id
);
}
void
UserItem
::
mousePressEvent
(
QMouseEvent
*
event
)
{
if
(
event
->
buttons
()
!=
Qt
::
RightButton
)
emit
clicked
(
cache
::
displayName
(
ChatPage
::
instance
()
->
currentRoom
(),
selectedText
()));
QWidget
::
mousePressEvent
(
event
);
}
RoomItem
::
RoomItem
(
QWidget
*
parent
,
const
RoomSearchResult
&
res
)
:
PopupItem
(
parent
)
,
roomId_
{
QString
::
fromStdString
(
res
.
room_id
)}
...
...
This diff is collapsed.
Click to expand it.
src/popups/PopupItem.h
+
0
−
20
View file @
b0c3fd5a
...
...
@@ -43,26 +43,6 @@ protected:
bool
hovering_
;
};
class
UserItem
:
public
PopupItem
{
Q_OBJECT
public:
UserItem
(
QWidget
*
parent
);
UserItem
(
QWidget
*
parent
,
const
QString
&
user_id
);
QString
selectedText
()
const
{
return
userId_
;
}
void
updateItem
(
const
QString
&
user_id
);
protected
:
void
mousePressEvent
(
QMouseEvent
*
event
)
override
;
private
:
void
resolveAvatar
(
const
QString
&
user_id
);
QLabel
*
userName_
;
QString
userId_
;
};
class
RoomItem
:
public
PopupItem
{
Q_OBJECT
...
...
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