Refactoring of RemovableDriveManager:

1) On Windows and Linux, the device enumeration now runs at a background
   thread, while it ran on the UI thread on idle, which may have been
   blocking on some rare Windows setups, see GH    
2) On OSX, the device enumeration now relies on OS callback, no
   polling is required.
3) Refactored for cleaner interface.
This commit is contained in:
bubnikv 2020-03-06 15:10:58 +01:00
parent 85bf78f7e7
commit b3b800de65
11 changed files with 640 additions and 753 deletions
src/slic3r/GUI

View file

@ -155,6 +155,7 @@ GUI_App::GUI_App()
, m_em_unit(10)
, m_imgui(new ImGuiWrapper())
, m_wizard(nullptr)
, m_removable_drive_manager(std::make_unique<RemovableDriveManager>())
{}
GUI_App::~GUI_App()
@ -262,7 +263,6 @@ bool GUI_App::on_init_inner()
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
RemovableDriveManager::get_instance().init();
Bind(wxEVT_IDLE, [this](wxIdleEvent& event)
{
@ -274,10 +274,6 @@ bool GUI_App::on_init_inner()
this->obj_manipul()->update_if_dirty();
#if !__APPLE__
RemovableDriveManager::get_instance().update(wxGetLocalTime(), true);
#endif
// Preset updating & Configwizard are done after the above initializations,
// and after MainFrame is created & shown.
// The extra CallAfter() is needed because of Mac, where this is the only way