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
a3c4fece
Commit
a3c4fece
authored
4 years ago
by
Jussi Kuokkanen
Committed by
Nicolas Werner
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add per-room user model
parent
07259b9c
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
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
src/UsersModel.cpp
+28
-0
28 additions, 0 deletions
src/UsersModel.cpp
src/UsersModel.h
+24
-0
24 additions, 0 deletions
src/UsersModel.h
with
53 additions
and
0 deletions
CMakeLists.txt
+
1
−
0
View file @
a3c4fece
...
...
@@ -303,6 +303,7 @@ set(SRC_FILES
src/TrayIcon.cpp
src/UserInfoWidget.cpp
src/UserSettingsPage.cpp
src/UsersModel.cpp
src/Utils.cpp
src/WebRTCSession.cpp
src/WelcomePage.cpp
...
...
This diff is collapsed.
Click to expand it.
src/UsersModel.cpp
0 → 100644
+
28
−
0
View file @
a3c4fece
#include
"UsersModel.h"
#include
"Cache.h"
#include
"CompletionModelRoles.h"
#include
<QPixmap>
UsersModel
::
UsersModel
(
const
std
::
string
&
roomId
,
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{
roomMembers_
=
cache
::
getMembers
(
roomId
,
0
,
9999
);
}
QVariant
UsersModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
hasIndex
(
index
.
row
(),
index
.
column
(),
index
.
parent
()))
{
switch
(
role
)
{
case
CompletionModel
::
CompletionRole
:
case
CompletionModel
::
SearchRole
:
case
Qt
::
DisplayRole
:
return
roomMembers_
[
index
.
row
()].
display_name
;
case
Avatar
:
return
roomMembers_
[
index
.
row
()].
avatar
;
}
}
return
{};
}
This diff is collapsed.
Click to expand it.
src/UsersModel.h
0 → 100644
+
24
−
0
View file @
a3c4fece
#pragma once
#include
<QAbstractListModel>
class
RoomMember
;
class
UsersModel
:
public
QAbstractListModel
{
public:
enum
Roles
{
Avatar
=
Qt
::
UserRole
// QImage avatar
};
UsersModel
(
const
std
::
string
&
roomId
,
QObject
*
parent
=
nullptr
);
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
override
{
return
(
parent
==
QModelIndex
())
?
roomMembers_
.
size
()
:
0
;
}
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
override
;
private
:
std
::
vector
<
RoomMember
>
roomMembers_
;
};
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