mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-18 01:46:48 +08:00
macos list devices
This commit is contained in:
parent
c3653589f6
commit
c37128ad63
@ -218,11 +218,11 @@ INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
|||||||
#else
|
#else
|
||||||
void RemovableDriveManager::search_for_drives()
|
void RemovableDriveManager::search_for_drives()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
list_devices();
|
list_devices();
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
m_current_drives.clear();
|
m_current_drives.clear();
|
||||||
m_current_drives.reserve(26);
|
m_current_drives.reserve(26);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
void reset_last_save_path();
|
void reset_last_save_path();
|
||||||
void print();
|
void print();
|
||||||
private:
|
private:
|
||||||
RemovableDriveManager():m_drives_count(0),m_last_update(0),m_last_save_path(""){}
|
RemovableDriveManager():m_drives_count(0),m_last_update(0),m_last_save_path(""),m_rdmmm(nullptr){}
|
||||||
void search_for_drives();
|
void search_for_drives();
|
||||||
void check_and_notify();
|
void check_and_notify();
|
||||||
std::string get_drive_from_path(const std::string& path);//returns drive path (same as path in DriveData) if exists otherwise empty string ""
|
std::string get_drive_from_path(const std::string& path);//returns drive path (same as path in DriveData) if exists otherwise empty string ""
|
||||||
@ -54,7 +54,7 @@ private:
|
|||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
void *m_rdmmm;
|
void *m_rdmmm;
|
||||||
void register_window();
|
void register_window();
|
||||||
//void list_devices();
|
void list_devices();
|
||||||
void search_path(const std::string &path, const std::string &parent_path);
|
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);
|
bool compare_filesystem_id(const std::string &path_a, const std::string &path_b);
|
||||||
#else
|
#else
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
-(instancetype) init;
|
-(instancetype) init;
|
||||||
-(void) add_unmount_observer;
|
-(void) add_unmount_observer;
|
||||||
-(void) on_device_unmount: (NSNotification*) notification;
|
-(void) on_device_unmount: (NSNotification*) notification;
|
||||||
|
-(void) list_dev;
|
||||||
@end
|
@end
|
@ -25,21 +25,11 @@
|
|||||||
NSLog(@"add unmount observer");
|
NSLog(@"add unmount observer");
|
||||||
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector: @selector(on_device_unmount:) name:NSWorkspaceDidUnmountNotification object:nil];
|
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector: @selector(on_device_unmount:) name:NSWorkspaceDidUnmountNotification object:nil];
|
||||||
}
|
}
|
||||||
namespace Slic3r {
|
-(void) list_dev
|
||||||
namespace GUI {
|
|
||||||
void RemovableDriveManager::register_window()
|
|
||||||
{
|
|
||||||
m_rdmmm = nullptr;
|
|
||||||
m_rdmmm = [[RemovableDriveManagerMM alloc] init];
|
|
||||||
}
|
|
||||||
}}//namespace Slicer::GUI
|
|
||||||
|
|
||||||
/*
|
|
||||||
-(void) RemovableDriveManager::list_devices()
|
|
||||||
{
|
{
|
||||||
NSLog(@"---");
|
NSLog(@"---");
|
||||||
NSArray* devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
|
NSArray* devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
|
||||||
for (NSString* volumePath in listOfMedia)
|
for (NSString* volumePath in devices)
|
||||||
{
|
{
|
||||||
NSLog(@"@", volumePath);
|
NSLog(@"@", volumePath);
|
||||||
}
|
}
|
||||||
@ -65,6 +55,23 @@ void RemovableDriveManager::register_window()
|
|||||||
NSLog(@"Result:%i Volume: %@, Removable:%i, W:%i, Unmountable:%i, Desc:%@, type:%@", result, volumePath, isRemovable, isWritable, isUnmountable, description, type);
|
NSLog(@"Result:%i Volume: %@, Removable:%i, W:%i, Unmountable:%i, Desc:%@, type:%@", result, volumePath, isRemovable, isWritable, isUnmountable, description, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
namespace Slic3r {
|
||||||
|
namespace GUI {
|
||||||
|
void RemovableDriveManager::register_window()
|
||||||
|
{
|
||||||
|
m_rdmmm = nullptr;
|
||||||
|
m_rdmmm = [[RemovableDriveManagerMM alloc] init];
|
||||||
|
}
|
||||||
|
void RemovableDriveManager::list_devices()
|
||||||
|
{
|
||||||
|
if(m_rdmmm == nullptr)
|
||||||
|
return;
|
||||||
|
[m_rdmmm list_dev];
|
||||||
|
}
|
||||||
|
}}//namespace Slicer::GUI
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user