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).
This commit is contained in:
Stenzek
2017-06-26 01:35:24 +10:00
parent 334e117da7
commit 1fccbd5be3
9 changed files with 59 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include <wx/menu.h>
#include <wx/msgdlg.h>
#include <wx/panel.h>
#include <wx/progdlg.h>
#include <wx/sizer.h>
#include <wx/statusbr.h>
#include <wx/textctrl.h>
@ -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<int>(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;
}
}