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
41737ac2
Verified
Commit
41737ac2
authored
4 years ago
by
Loren Burkholder
Committed by
Nicolas Werner
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Simplify image loading
parent
95a26eda
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.h
+1
-3
1 addition, 3 deletions
src/notifications/Manager.h
src/notifications/ManagerMac.cpp
+2
-10
2 additions, 10 deletions
src/notifications/ManagerMac.cpp
src/notifications/ManagerMac.mm
+3
-3
3 additions, 3 deletions
src/notifications/ManagerMac.mm
with
6 additions
and
16 deletions
src/notifications/Manager.h
+
1
−
3
View file @
41737ac2
...
...
@@ -79,9 +79,7 @@ private:
void
objCxxPostNotification
(
const
QString
&
title
,
const
QString
&
subtitle
,
const
QString
&
informativeText
,
const
QImage
*
bodyImage
);
QImage
*
getImgOrNullptr
(
const
QString
&
path
);
const
QImage
&
bodyImage
);
#endif
#if defined(Q_OS_WINDOWS)
...
...
This diff is collapsed.
Click to expand it.
src/notifications/ManagerMac.cpp
+
2
−
10
View file @
41737ac2
...
...
@@ -39,9 +39,9 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
cache
::
displayName
(
QString
::
fromStdString
(
notification
.
room_id
),
QString
::
fromStdString
(
mtx
::
accessors
::
sender
(
notification
.
event
)));
QImage
*
image
=
nullptr
;
QImage
image
;
if
(
mtx
::
accessors
::
msg_type
(
notification
.
event
)
==
mtx
::
events
::
MessageType
::
Image
)
image
=
getImgOrNullptr
(
cacheImage
(
notification
.
event
)
)
;
image
=
QImage
{
cacheImage
(
notification
.
event
)
}
;
const
auto
isEncrypted
=
std
::
get_if
<
mtx
::
events
::
EncryptedEvent
<
mtx
::
events
::
msg
::
Encrypted
>>
(
...
...
@@ -61,11 +61,3 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
room_name
,
messageInfo
,
formatNotification
(
notification
),
image
);
}
}
QImage
*
NotificationsManager
::
getImgOrNullptr
(
const
QString
&
path
)
{
if
(
QFile
::
exists
(
path
))
return
nullptr
;
return
new
QImage
{
path
};
}
This diff is collapsed.
Click to expand it.
src/notifications/ManagerMac.mm
+
3
−
3
View file @
41737ac2
...
...
@@ -19,7 +19,7 @@ void
NotificationsManager
::
objCxxPostNotification
(
const
QString
&
title
,
const
QString
&
subtitle
,
const
QString
&
informativeText
,
const
QImage
*
bodyImage
)
const
QImage
&
bodyImage
)
{
NSUserNotification
*
notif
=
[[
NSUserNotification
alloc
]
init
];
...
...
@@ -29,8 +29,8 @@ NotificationsManager::objCxxPostNotification(const QString &title,
notif
.
informativeText
=
informativeText
.
toNSString
();
notif
.
soundName
=
NSUserNotificationDefaultSoundName
;
if
(
bodyImage
!=
nullptr
)
notif
.
contentImage
=
[[
NSImage
alloc
]
initWithCGImage
:
bodyImage
->
toCGImage
()
size
:
NSZeroSize
];
if
(
!
bodyImage
.
isNull
()
)
notif
.
contentImage
=
[[
NSImage
alloc
]
initWithCGImage
:
bodyImage
.
toCGImage
()
size
:
NSZeroSize
];
[[
NSUserNotificationCenter
defaultUserNotificationCenter
]
deliverNotification
:
notif
];
[
notif
autorelease
];
...
...
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