macos better wrapper
This commit is contained in:
parent
5872598679
commit
cd1d49b015
2 changed files with 25 additions and 25 deletions
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
class RDMMMWrapper;
|
||||||
|
#if __APPLE__
|
||||||
|
|
||||||
|
|
||||||
struct DriveData
|
struct DriveData
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -57,23 +61,22 @@ private:
|
||||||
//INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
//INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
#else
|
#else
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
RemovableDriveManagerMM * m_rdmmm;
|
RDMMMWrapper * m_rdmmm;
|
||||||
#endif
|
#endif
|
||||||
void search_path(const std::string &path, const std::string &parent_path);
|
void search_path(const std::string &path, const std::string &parent_path);
|
||||||
void inspect_file(const std::string &path, const std::string &parent_path);
|
void inspect_file(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);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#if __APPLE__
|
class RDMMMWrapper
|
||||||
class RemovableDriveManagerMM
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RemovableDriveManagerMM();
|
RDMMMWrapper();
|
||||||
~RemovableDriveManagerMM();
|
~RDMMMWrapper();
|
||||||
register_window();
|
void register_window();
|
||||||
list_devices();
|
void list_devices();
|
||||||
private:
|
private:
|
||||||
RemovableDriveManagerMMImpl *m_imp;
|
void *m_imp;
|
||||||
friend void RemovableDriveManager::inspect_file(const std::string &path, const std::string &parent_path);
|
friend void RemovableDriveManager::inspect_file(const std::string &path, const std::string &parent_path);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,31 +36,28 @@
|
||||||
}
|
}
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
struct RemovableDriveManagerMMImpl{
|
RDMMMWrapper::RDMMMWrapper():m_imp(nullptr){
|
||||||
RemovableDriveManagerMM * wrap;
|
m_imp = [[RemovableDriveManagerMM alloc] init];
|
||||||
}
|
}
|
||||||
RemovableDriveManagerMM():impl(new RemovableDriveManagerMMImpl){
|
RDMMMWrapper::~RDMMMWrapper()
|
||||||
impl->wrap = [[RemovableDriveManagerMM alloc] init];
|
|
||||||
}
|
|
||||||
RemovableDriveManagerMM::~RemovableDriveManagerMM()
|
|
||||||
{
|
{
|
||||||
if(impl)
|
if(m_imp)
|
||||||
{
|
{
|
||||||
[impl->wrap release];
|
[m_imp release];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void RDMMMWrapper::register_window()
|
void RDMMMWrapper::register_window()
|
||||||
{
|
{
|
||||||
if(impl->wrap)
|
if(m_imp)
|
||||||
{
|
{
|
||||||
[impl->wrap add_unmount_observer];
|
[m_imp add_unmount_observer];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void RDMMMWrapper::list_devices()
|
void RDMMMWrapper::list_devices()
|
||||||
{
|
{
|
||||||
if(impl->wrap)
|
if(m_imp)
|
||||||
{
|
{
|
||||||
NSArray* devices = [impl->wrap list_dev];
|
NSArray* devices = [m_imp list_dev];
|
||||||
for (NSString* volumePath in devices)
|
for (NSString* volumePath in devices)
|
||||||
{
|
{
|
||||||
NSLog(@"%@", volumePath);
|
NSLog(@"%@", volumePath);
|
||||||
|
|
Loading…
Add table
Reference in a new issue