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
9c06ba5d
Commit
9c06ba5d
authored
6 years ago
by
Konstantinos Sideris
Browse files
Options
Downloads
Patches
Plain Diff
Open user profile on matrix.to links
parent
e9ee2997
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
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
src/timeline/TimelineItem.cpp
+41
-0
41 additions, 0 deletions
src/timeline/TimelineItem.cpp
src/timeline/TimelineItem.h
+10
-0
10 additions, 0 deletions
src/timeline/TimelineItem.h
with
53 additions
and
0 deletions
CHANGELOG.md
+
2
−
0
View file @
9c06ba5d
...
...
@@ -3,6 +3,8 @@
## [Unreleased]
### Features
-
Support for sending & receiving markdown formatted messages. (#283)
-
Context menu option to show the raw text message of an event. (#437)
-
Clicking on a user pill link will open the user profile.
### Improvements
-
Update Polish translation (#430)
...
...
This diff is collapsed.
Click to expand it.
src/timeline/TimelineItem.cpp
+
41
−
0
View file @
9c06ba5d
...
...
@@ -16,6 +16,7 @@
*/
#include
<QContextMenuEvent>
#include
<QDesktopServices>
#include
<QFontDatabase>
#include
<QMenu>
#include
<QTimer>
...
...
@@ -35,6 +36,7 @@
#include
"timeline/widgets/VideoItem.h"
#include
"dialogs/RawMessage.h"
#include
"mtx/identifiers.hpp"
constexpr
int
MSG_RIGHT_MARGIN
=
7
;
constexpr
int
MSG_PADDING
=
20
;
...
...
@@ -61,8 +63,47 @@ TextLabel::TextLabel(const QString &text, QWidget *parent)
&
TextLabel
::
adjustHeight
);
document
()
->
setDocumentMargin
(
0
);
setFocusPolicy
(
Qt
::
NoFocus
);
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Fixed
);
setFixedHeight
(
0
);
connect
(
this
,
&
TextLabel
::
linkActivated
,
this
,
[](
const
QUrl
&
url
)
{
auto
parts
=
url
.
toString
().
split
(
'/'
);
auto
defaultHandler
=
[](
const
QUrl
&
url
)
{
QDesktopServices
::
openUrl
(
url
);
};
if
(
url
.
host
()
!=
"matrix.to"
||
parts
.
isEmpty
())
return
defaultHandler
(
url
);
try
{
using
namespace
mtx
::
identifiers
;
parse
<
User
>
(
parts
.
last
().
toStdString
());
}
catch
(
const
std
::
exception
&
)
{
return
defaultHandler
(
url
);
}
auto
user_id
=
parts
.
last
();
auto
room_id
=
ChatPage
::
instance
()
->
currentRoom
();
MainWindow
::
instance
()
->
openUserProfile
(
user_id
,
room_id
);
});
}
void
TextLabel
::
mousePressEvent
(
QMouseEvent
*
e
)
{
link_
=
(
e
->
button
()
&
Qt
::
LeftButton
)
?
anchorAt
(
e
->
pos
())
:
QString
();
QTextBrowser
::
mousePressEvent
(
e
);
}
void
TextLabel
::
mouseReleaseEvent
(
QMouseEvent
*
e
)
{
if
(
e
->
button
()
&
Qt
::
LeftButton
&&
!
link_
.
isEmpty
()
&&
anchorAt
(
e
->
pos
())
==
link_
)
{
emit
linkActivated
(
link_
);
return
;
}
QTextBrowser
::
mouseReleaseEvent
(
e
);
}
StatusIndicator
::
StatusIndicator
(
QWidget
*
parent
)
...
...
This diff is collapsed.
Click to expand it.
src/timeline/TimelineItem.h
+
10
−
0
View file @
9c06ba5d
...
...
@@ -105,8 +105,18 @@ public:
void
wheelEvent
(
QWheelEvent
*
event
)
override
{
event
->
ignore
();
}
protected
:
void
mousePressEvent
(
QMouseEvent
*
e
)
override
;
void
mouseReleaseEvent
(
QMouseEvent
*
e
)
override
;
private
slots
:
void
adjustHeight
(
const
QSizeF
&
size
)
{
setFixedHeight
(
size
.
height
());
}
signals
:
void
linkActivated
(
const
QUrl
&
link
);
private
:
QString
link_
;
};
class
UserProfileFilter
:
public
QObject
...
...
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