mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user