From d90d9f0c401a21c85a525aaca0b97df8f7955db8 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 25 Dec 2014 22:54:14 +0100 Subject: Linux/MacOSX: Implement waiting dialog for lengthy operations in order to have a better user experience. --- src/Main/Forms/MainFrame.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/Main/Forms/MainFrame.cpp') diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp index b48f3718..fbf20537 100644 --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -36,6 +36,10 @@ namespace VeraCrypt { + DEFINE_EVENT_TYPE(wxEVT_COMMAND_UPDATE_VOLUME_LIST) + DEFINE_EVENT_TYPE(wxEVT_COMMAND_PREF_UPDATED) + DEFINE_EVENT_TYPE(wxEVT_COMMAND_OPEN_VOLUME_REQUEST) + MainFrame::MainFrame (wxWindow* parent) : MainFrameBase (parent), ListItemRightClickEventPending (false), SelectedItemIndex (-1), @@ -84,6 +88,11 @@ namespace VeraCrypt Gui->ShowError (e); } } + + Connect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) ); + Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) ); + Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) ); + } MainFrame::~MainFrame () @@ -100,6 +109,9 @@ namespace VeraCrypt } #endif + Disconnect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) ); + Disconnect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) ); + Disconnect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) ); Core->VolumeMountedEvent.Disconnect (this); Core->VolumeDismountedEvent.Disconnect (this); Gui->OpenVolumeSystemRequestEvent.Disconnect (this); @@ -343,7 +355,7 @@ namespace VeraCrypt Core->VolumeMountedEvent.Connect (EventConnector (this, &MainFrame::OnVolumeMounted)); Core->VolumeDismountedEvent.Connect (EventConnector (this, &MainFrame::OnVolumeDismounted)); Gui->OpenVolumeSystemRequestEvent.Connect (EventConnector (this, &MainFrame::OnOpenVolumeSystemRequestEvent)); - Gui->PreferencesUpdatedEvent.Connect (EventConnector (this, &MainFrame::OnPreferencesUpdated)); + Gui->PreferencesUpdatedEvent.Connect (EventConnector (this, &MainFrame::OnPreferencesUpdatedEvent)); // Drag & drop class FileDropTarget : public wxFileDropTarget @@ -1139,7 +1151,22 @@ namespace VeraCrypt dialog.ShowModal(); } - void MainFrame::OnPreferencesUpdated (EventArgs &args) + void MainFrame::OnOpenVolumeSystemRequest (wxCommandEvent& event) + { + wstring* eventPath = (wstring*) event.GetClientData(); + SetVolumePath (*eventPath); + delete eventPath; + } + + void MainFrame::OnOpenVolumeSystemRequestEvent (EventArgs &args) + { + wstring* eventPath = new wstring (dynamic_cast (args).mVolumePath); + wxCommandEvent* pEvent = new wxCommandEvent( wxEVT_COMMAND_OPEN_VOLUME_REQUEST,0); + pEvent->SetClientData(eventPath); + wxQueueEvent (this, pEvent); + } + + void MainFrame::OnPreferencesUpdated (wxCommandEvent& event) { const UserPreferences &prefs = GetPreferences(); -- cgit v1.2.3