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
64dd10a6
Verified
Commit
64dd10a6
authored
4 years ago
by
Loren Burkholder
Committed by
Nicolas Werner
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Only try to display images if they exist
parent
82bbdfb9
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/notifications/Manager.cpp
+6
-5
6 additions, 5 deletions
src/notifications/Manager.cpp
src/notifications/ManagerLinux.cpp
+7
-1
7 additions, 1 deletion
src/notifications/ManagerLinux.cpp
src/notifications/ManagerMac.cpp
+1
-1
1 addition, 1 deletion
src/notifications/ManagerMac.cpp
with
14 additions
and
7 deletions
src/notifications/Manager.cpp
+
6
−
5
View file @
64dd10a6
...
...
@@ -24,7 +24,7 @@ NotificationsManager::cacheImage(const mtx::events::collections::TimelineEvents
http
::
client
()
->
download
(
url
,
[
path
,
url
,
encryptionInfo
](
const
std
::
string
&
data
,
[
&
path
,
url
,
encryptionInfo
](
const
std
::
string
&
data
,
const
std
::
string
&
,
const
std
::
string
&
,
mtx
::
http
::
RequestErr
err
)
{
...
...
@@ -53,10 +53,11 @@ NotificationsManager::cacheImage(const mtx::events::collections::TimelineEvents
// resize the image
QImage
img
{
utils
::
readImage
(
QByteArray
{
temp
.
data
()})};
// make sure to save as PNG (because Plasma doesn't do JPEG in
// notifications)
// if (!file.fileName().endsWith(".png"))
// file.rename(file.fileName() + ".png");
if
(
img
.
isNull
())
{
path
.
clear
();
return
;
}
#ifdef NHEKO_DBUS_SYS // the images in D-Bus notifications are to be 200x100 max
img
.
scaled
(
200
,
100
,
Qt
::
KeepAspectRatio
,
Qt
::
SmoothTransformation
)
...
...
This diff is collapsed.
Click to expand it.
src/notifications/ManagerLinux.cpp
+
7
−
1
View file @
64dd10a6
...
...
@@ -216,12 +216,18 @@ NotificationsManager::formatNotification(const mtx::responses::Notification ¬
if
(
hasMarkup_
)
{
if
(
hasImages_
&&
mtx
::
accessors
::
msg_type
(
notification
.
event
)
==
mtx
::
events
::
MessageType
::
Image
)
{
QString
imgPath
=
cacheImage
(
notification
.
event
);
if
(
imgPath
.
isNull
())
return
mtx
::
accessors
::
formattedBodyWithFallback
(
notification
.
event
).
prepend
(
messageLeadIn
);
else
return
QString
(
"<img src=
\"
file:///"
+
cacheImage
(
notification
.
event
)
+
"<img src=
\"
file:///"
+
imgPath
+
"
\"
alt=
\"
"
+
mtx
::
accessors
::
formattedBodyWithFallback
(
notification
.
event
)
+
"
\"
>"
)
.
prepend
(
messageLeadIn
);
}
return
mtx
::
accessors
::
formattedBodyWithFallback
(
notification
.
event
)
.
prepend
(
messageLeadIn
)
...
...
This diff is collapsed.
Click to expand it.
src/notifications/ManagerMac.cpp
+
1
−
1
View file @
64dd10a6
...
...
@@ -58,6 +58,6 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
const
QString
messageInfo
=
(
isReply
?
tr
(
"%1 replied to a message"
)
:
tr
(
"%1 sent a message"
)).
arg
(
sender
);
objCxxPostNotification
(
room_name
,
messageInfo
,
formatNotification
(
notification
),
image
);
room_name
,
messageInfo
,
formatNotification
(
notification
),
(
image
!=
nullptr
&&
!
image
->
isNull
())
?
image
:
nullptr
);
}
}
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