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
8f1fa2ae
Unverified
Commit
8f1fa2ae
authored
3 years ago
by
Nicolas Werner
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #712 from Thulinma/improvedProfiles
Improvements to user profiles
parents
40cfa7ae
e7564396
No related branches found
No related tags found
No related merge requests found
Pipeline
#1747
passed
3 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
resources/qml/UserProfile.qml
+50
-8
50 additions, 8 deletions
resources/qml/UserProfile.qml
src/ui/UserProfile.cpp
+9
-1
9 additions, 1 deletion
src/ui/UserProfile.cpp
src/ui/UserProfile.h
+1
-0
1 addition, 0 deletions
src/ui/UserProfile.h
with
60 additions
and
9 deletions
resources/qml/UserProfile.qml
+
50
−
8
View file @
8f1fa2ae
...
@@ -20,6 +20,7 @@ ApplicationWindow {
...
@@ -20,6 +20,7 @@ ApplicationWindow {
height
:
650
height
:
650
width
:
420
width
:
420
minimumWidth
:
150
minimumHeight
:
420
minimumHeight
:
420
palette
:
Nheko
.
colors
palette
:
Nheko
.
colors
color
:
Nheko
.
colors
.
window
color
:
Nheko
.
colors
.
window
...
@@ -45,9 +46,23 @@ ApplicationWindow {
...
@@ -45,9 +46,23 @@ ApplicationWindow {
height
:
130
height
:
130
width
:
130
width
:
130
displayName
:
profile
.
displayName
displayName
:
profile
.
displayName
id
:
displayAvatar
userid
:
profile
.
userid
userid
:
profile
.
userid
Layout.alignment
:
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignHCenter
onClicked
:
profile
.
isSelf
?
profile
.
changeAvatar
()
:
TimelineManager
.
openImageOverlay
(
profile
.
avatarUrl
,
""
)
onClicked
:
TimelineManager
.
openImageOverlay
(
profile
.
avatarUrl
,
""
)
ImageButton
{
hoverEnabled
:
true
ToolTip.visible
:
hovered
ToolTip.text
:
profile
.
isGlobalUserProfile
?
qsTr
(
"
Change avatar globally.
"
)
:
qsTr
(
"
Change avatar. Will only apply to this room.
"
)
anchors.left
:
displayAvatar
.
left
anchors.top
:
displayAvatar
.
top
anchors.leftMargin
:
Nheko
.
paddingMedium
anchors.topMargin
:
Nheko
.
paddingMedium
visible
:
profile
.
isSelf
image
:
"
:/icons/icons/ui/edit.png
"
onClicked
:
profile
.
changeAvatar
()
}
}
}
Spinner
{
Spinner
{
...
@@ -113,9 +128,12 @@ ApplicationWindow {
...
@@ -113,9 +128,12 @@ ApplicationWindow {
ImageButton
{
ImageButton
{
visible
:
profile
.
isSelf
visible
:
profile
.
isSelf
anchors.leftMargin
:
5
anchors.leftMargin
:
Nheko
.
paddingSmall
anchors.left
:
displayUsername
.
right
anchors.left
:
displayUsername
.
right
anchors.verticalCenter
:
displayUsername
.
verticalCenter
anchors.verticalCenter
:
displayUsername
.
verticalCenter
hoverEnabled
:
true
ToolTip.visible
:
hovered
ToolTip.text
:
profile
.
isGlobalUserProfile
?
qsTr
(
"
Change display name globally.
"
)
:
qsTr
(
"
Change display name. Will only apply to this room.
"
)
image
:
displayUsername
.
isUsernameEditingAllowed
?
"
:/icons/icons/ui/checkmark.png
"
:
"
:/icons/icons/ui/edit.png
"
image
:
displayUsername
.
isUsernameEditingAllowed
?
"
:/icons/icons/ui/checkmark.png
"
:
"
:/icons/icons/ui/edit.png
"
onClicked
:
{
onClicked
:
{
if
(
displayUsername
.
isUsernameEditingAllowed
)
{
if
(
displayUsername
.
isUsernameEditingAllowed
)
{
...
@@ -137,6 +155,30 @@ ApplicationWindow {
...
@@ -137,6 +155,30 @@ ApplicationWindow {
Layout.alignment
:
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignHCenter
}
}
MatrixText
{
id
:
displayRoomname
text
:
qsTr
(
"
Room: %1
"
).
arg
(
profile
.
room
.
roomName
)
Layout.alignment
:
Qt
.
AlignHCenter
visible
:
!
profile
.
isGlobalUserProfile
ToolTip.text
:
qsTr
(
"
This is a room-specific profile. The user's name and avatar may be different from their global versions.
"
)
ToolTip.visible
:
ma
.
hovered
HoverHandler
{
id
:
ma
}
ImageButton
{
anchors.leftMargin
:
Nheko
.
paddingSmall
anchors.left
:
displayRoomname
.
right
anchors.verticalCenter
:
displayRoomname
.
verticalCenter
image
:
"
:/icons/icons/ui/world.png
"
hoverEnabled
:
true
ToolTip.visible
:
hovered
ToolTip.text
:
qsTr
(
"
Open the global profile for this user.
"
)
onClicked
:
profile
.
openGlobalProfile
()
visible
:
!
profile
.
isGlobalUserProfile
}
}
Button
{
Button
{
id
:
verifyUserButton
id
:
verifyUserButton
...
@@ -163,7 +205,7 @@ ApplicationWindow {
...
@@ -163,7 +205,7 @@ ApplicationWindow {
// right: 5
// right: 5
// }
// }
// ToolTip.visible: hovered
// ToolTip.visible: hovered
// ToolTip.text: qsTr("Ignore messages from this user")
// ToolTip.text: qsTr("Ignore messages from this user
.
")
// onClicked : {
// onClicked : {
// profile.ignoreUser()
// profile.ignoreUser()
// }
// }
...
@@ -176,7 +218,7 @@ ApplicationWindow {
...
@@ -176,7 +218,7 @@ ApplicationWindow {
image
:
"
:/icons/icons/ui/black-bubble-speech.png
"
image
:
"
:/icons/icons/ui/black-bubble-speech.png
"
hoverEnabled
:
true
hoverEnabled
:
true
ToolTip.visible
:
hovered
ToolTip.visible
:
hovered
ToolTip.text
:
qsTr
(
"
Start a private chat
"
)
ToolTip.text
:
qsTr
(
"
Start a private chat
.
"
)
onClicked
:
profile
.
startChat
()
onClicked
:
profile
.
startChat
()
}
}
...
@@ -184,18 +226,18 @@ ApplicationWindow {
...
@@ -184,18 +226,18 @@ ApplicationWindow {
image
:
"
:/icons/icons/ui/round-remove-button.png
"
image
:
"
:/icons/icons/ui/round-remove-button.png
"
hoverEnabled
:
true
hoverEnabled
:
true
ToolTip.visible
:
hovered
ToolTip.visible
:
hovered
ToolTip.text
:
qsTr
(
"
Kick the user
"
)
ToolTip.text
:
qsTr
(
"
Kick the user
.
"
)
onClicked
:
profile
.
kickUser
()
onClicked
:
profile
.
kickUser
()
visible
:
profile
.
room
?
profile
.
room
.
permissions
.
canKick
()
:
false
visible
:
!
profile
.
isGlobalUserProfile
&&
profile
.
room
.
permissions
.
canKick
()
}
}
ImageButton
{
ImageButton
{
image
:
"
:/icons/icons/ui/do-not-disturb-rounded-sign.png
"
image
:
"
:/icons/icons/ui/do-not-disturb-rounded-sign.png
"
hoverEnabled
:
true
hoverEnabled
:
true
ToolTip.visible
:
hovered
ToolTip.visible
:
hovered
ToolTip.text
:
qsTr
(
"
Ban the user
"
)
ToolTip.text
:
qsTr
(
"
Ban the user
.
"
)
onClicked
:
profile
.
banUser
()
onClicked
:
profile
.
banUser
()
visible
:
profile
.
room
?
profile
.
room
.
permissions
.
canBan
()
:
false
visible
:
!
profile
.
isGlobalUserProfile
&&
profile
.
room
.
permissions
.
canBan
()
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/ui/UserProfile.cpp
+
9
−
1
View file @
8f1fa2ae
...
@@ -409,7 +409,8 @@ UserProfile::getGlobalProfileData()
...
@@ -409,7 +409,8 @@ UserProfile::getGlobalProfileData()
userid_
.
toStdString
(),
userid_
.
toStdString
(),
[
this
](
const
mtx
::
responses
::
Profile
&
res
,
mtx
::
http
::
RequestErr
err
)
{
[
this
](
const
mtx
::
responses
::
Profile
&
res
,
mtx
::
http
::
RequestErr
err
)
{
if
(
err
)
{
if
(
err
)
{
nhlog
::
net
()
->
warn
(
"failed to retrieve own profile info"
);
nhlog
::
net
()
->
warn
(
"failed to retrieve profile info for {}"
,
userid_
.
toStdString
());
return
;
return
;
}
}
...
@@ -418,3 +419,10 @@ UserProfile::getGlobalProfileData()
...
@@ -418,3 +419,10 @@ UserProfile::getGlobalProfileData()
emit
avatarUrlChanged
();
emit
avatarUrlChanged
();
});
});
}
}
void
UserProfile
::
openGlobalProfile
()
{
UserProfile
*
userProfile
=
new
UserProfile
(
""
,
userid_
,
manager
,
model
);
emit
manager
->
openProfile
(
userProfile
);
}
This diff is collapsed.
Click to expand it.
src/ui/UserProfile.h
+
1
−
0
View file @
8f1fa2ae
...
@@ -125,6 +125,7 @@ public:
...
@@ -125,6 +125,7 @@ public:
Q_INVOKABLE
void
startChat
();
Q_INVOKABLE
void
startChat
();
Q_INVOKABLE
void
changeUsername
(
QString
username
);
Q_INVOKABLE
void
changeUsername
(
QString
username
);
Q_INVOKABLE
void
changeAvatar
();
Q_INVOKABLE
void
changeAvatar
();
Q_INVOKABLE
void
openGlobalProfile
();
signals
:
signals
:
void
userStatusChanged
();
void
userStatusChanged
();
...
...
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