From 1fccbd5be3cc3c938a325d0f9401cc1a56e68e29 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 26 Jun 2017 01:35:24 +1000 Subject: DolphinWX: Add a progress dialog host command Allows feedback from backends to be communicated to the user when long-running operation are performed (e.g. shader compilation). --- Source/Core/DolphinWX/Frame.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'Source/Core/DolphinWX/Frame.cpp') diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 28e25b4806..08bbcc4a52 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -817,6 +818,37 @@ void CFrame::OnHostMessage(wxCommandEvent& event) case IDM_STOPPED: OnStopped(); break; + + case IDM_UPDATE_PROGRESS_DIALOG: + { + int current = event.GetInt(); + int total = static_cast(event.GetExtraLong()); + if (total < 0 || current >= total) + { + if (m_progress_dialog) + { + delete m_progress_dialog; + m_progress_dialog = nullptr; + } + } + else if (total > 0 && current < total) + { + if (!m_progress_dialog) + { + m_progress_dialog = new wxProgressDialog( + _("Operation in progress..."), event.GetString(), total, m_render_frame, + wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH | wxPD_REMAINING_TIME); + m_progress_dialog->Show(); + } + else + { + if (m_progress_dialog->GetRange() != total) + m_progress_dialog->SetRange(total); + m_progress_dialog->Update(current, event.GetString()); + } + } + } + break; } } -- cgit v1.2.3