mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 01:15:53 +08:00
WIP post system notification
This commit is contained in:
parent
88c701888d
commit
82ed33ea26
@ -245,6 +245,7 @@ if (APPLE)
|
||||
GUI/Mouse3DHandlerMac.mm
|
||||
GUI/InstanceCheckMac.mm
|
||||
GUI/InstanceCheckMac.h
|
||||
GUI/SystemNotification.mm
|
||||
)
|
||||
FIND_LIBRARY(DISKARBITRATION_LIBRARY DiskArbitration)
|
||||
|
||||
|
@ -368,7 +368,11 @@ public:
|
||||
void init_notification_manager();
|
||||
|
||||
void bring_instance_forward();
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
void post_mac_notifiacation(const std::string& title, const std::string& message);
|
||||
#endif //__APPLE__
|
||||
|
||||
// ROII wrapper for suppressing the Undo / Redo snapshot to be taken.
|
||||
class SuppressSnapshots
|
||||
{
|
||||
|
14
src/slic3r/GUI/SystemNotification.mm
Normal file
14
src/slic3r/GUI/SystemNotification.mm
Normal file
@ -0,0 +1,14 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "Plater.hpp"
|
||||
|
||||
void Plater::post_mac_notifiacation(const std::string &title, const std::string &message)
|
||||
{
|
||||
NSString * ttl_nss = [NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]];
|
||||
NSString * msg_nss = [NSString stringWithCString:message.c_str() encoding:[NSString defaultCStringEncoding]];
|
||||
NSUserNotification* notification = [[NSUserNotification alloc] init];
|
||||
notification.title = ttl_nss;
|
||||
notification.informativeText = msg_nss;
|
||||
notification.soundName = NSUserNotificationDefaultSoundName; //Will play a default sound
|
||||
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: notification];
|
||||
[notification autorelease];
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user