mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 17:25:51 +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/Mouse3DHandlerMac.mm
|
||||||
GUI/InstanceCheckMac.mm
|
GUI/InstanceCheckMac.mm
|
||||||
GUI/InstanceCheckMac.h
|
GUI/InstanceCheckMac.h
|
||||||
|
GUI/SystemNotification.mm
|
||||||
)
|
)
|
||||||
FIND_LIBRARY(DISKARBITRATION_LIBRARY DiskArbitration)
|
FIND_LIBRARY(DISKARBITRATION_LIBRARY DiskArbitration)
|
||||||
|
|
||||||
|
@ -369,6 +369,10 @@ public:
|
|||||||
|
|
||||||
void bring_instance_forward();
|
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.
|
// ROII wrapper for suppressing the Undo / Redo snapshot to be taken.
|
||||||
class SuppressSnapshots
|
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