macos mm files
This commit is contained in:
parent
0861b2ec59
commit
e0a12342da
@ -169,7 +169,8 @@ if (APPLE)
|
||||
list(APPEND SLIC3R_GUI_SOURCES
|
||||
Utils/RetinaHelperImpl.mm
|
||||
Utils/MacDarkMode.mm
|
||||
GUI/RemovableDriveManager.mm
|
||||
GUI/RemovableDriveManagerMM.mm
|
||||
GUI/RemovableDriveManagerMM.h
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
@ -52,8 +52,9 @@ private:
|
||||
void register_window();
|
||||
//INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
#elif __APPLE__
|
||||
void *m_rdmmm;
|
||||
void register_window();
|
||||
void list_devices();
|
||||
//void list_devices();
|
||||
#else
|
||||
void search_path(const std::string &path, const std::string &parent_path);
|
||||
bool compare_filesystem_id(const std::string &path_a, const std::string &path_b);
|
||||
|
9
src/slic3r/GUI/RemovableDriveManagerMM.h
Normal file
9
src/slic3r/GUI/RemovableDriveManagerMM.h
Normal file
@ -0,0 +1,9 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface RemovableDriveManagerMM : NSObject
|
||||
|
||||
-(instancetype) init;
|
||||
-(void) add_unmount_observer;
|
||||
-(void) on_device_unmount: (NSNotification*) notification;
|
||||
|
||||
@end
|
@ -1,22 +1,39 @@
|
||||
#import "RemovableDriveManager.hpp"
|
||||
|
||||
@implementation RemovableDriveManager
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@implementation RemovableDriveManagerMM
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
void RemovableDriveManager::register_window()
|
||||
-(instancetype) init
|
||||
{
|
||||
//[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector: @selector(volumesChanged:) name:NSWorkspaceDidMountNotification object: nil];
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector: @selector(on_device_unmount:) name:NSWorkspaceDidUnmountNotification object:nil];
|
||||
self = [super init];
|
||||
if(self)
|
||||
{
|
||||
[self add_unmount_observer]
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) on_device_unmount: (NSNotification*) notification
|
||||
{
|
||||
NSLog(@"on device change");
|
||||
RemovableDriveManager::get_instance().update();
|
||||
}
|
||||
-(void) add_unmount_observer
|
||||
{
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector: @selector(on_device_unmount:) name:NSWorkspaceDidUnmountNotification object:nil];
|
||||
}
|
||||
|
||||
void RemovableDriveManager::register_window()
|
||||
{
|
||||
m_rdmmm = nullptr;
|
||||
m_rdmmm = [[RemovableDriveManagerMM alloc] init];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
-(void) RemovableDriveManager::list_devices()
|
||||
{
|
||||
NSLog(@"---");
|
||||
@ -47,5 +64,5 @@ void RemovableDriveManager::register_window()
|
||||
NSLog(@"Result:%i Volume: %@, Removable:%i, W:%i, Unmountable:%i, Desc:%@, type:%@", result, volumePath, isRemovable, isWritable, isUnmountable, description, type);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}}//namespace Slicer::GUI
|
Loading…
Reference in New Issue
Block a user