FullscreenUI: Move loading screen progress callback into namespace

This commit is contained in:
Stenzek
2025-11-02 21:32:24 +10:00
parent 85275a1965
commit b0689d54e6
4 changed files with 19 additions and 18 deletions

View File

@@ -1023,7 +1023,7 @@ bool CDROM::PrecacheMedia()
return false;
}
LoadingScreenProgressCallback callback;
FullscreenUI::LoadingScreenProgressCallback callback;
if (!s_reader.Precache(&callback))
{
Host::AddOSDMessage(TRANSLATE_STR("OSDMessage", "Precaching CD image failed, it may be unreliable."),

View File

@@ -70,8 +70,7 @@ private:
#endif // __ANDROID__
} // namespace FullscreenUI
// NOTE: Not in widgets.h so that clients can use it without pulling in imgui etc.
class LoadingScreenProgressCallback final : public ProgressCallback
{
public:
@@ -105,6 +104,8 @@ private:
std::string m_title;
};
} // namespace FullscreenUI
// Host UI triggers from Big Picture mode.
namespace Host {

View File

@@ -4543,18 +4543,18 @@ void FullscreenUI::DrawLoadingScreen(std::string_view image, std::string_view ti
}
}
LoadingScreenProgressCallback::LoadingScreenProgressCallback()
FullscreenUI::LoadingScreenProgressCallback::LoadingScreenProgressCallback()
: ProgressCallback(), m_open_time(Timer::GetCurrentValue()), m_on_gpu_thread(GPUThread::IsOnThread())
{
m_image = System::GetImageForLoadingScreen(m_on_gpu_thread ? GPUThread::GetGamePath() : System::GetGamePath());
}
LoadingScreenProgressCallback::~LoadingScreenProgressCallback()
FullscreenUI::LoadingScreenProgressCallback::~LoadingScreenProgressCallback()
{
Close();
}
void LoadingScreenProgressCallback::Close()
void FullscreenUI::LoadingScreenProgressCallback::Close()
{
// Did we activate?
if (m_last_progress_percent < 0)
@@ -4573,37 +4573,37 @@ void LoadingScreenProgressCallback::Close()
m_last_progress_percent = -1;
}
void LoadingScreenProgressCallback::PushState()
void FullscreenUI::LoadingScreenProgressCallback::PushState()
{
ProgressCallback::PushState();
}
void LoadingScreenProgressCallback::PopState()
void FullscreenUI::LoadingScreenProgressCallback::PopState()
{
ProgressCallback::PopState();
Redraw(true);
}
void LoadingScreenProgressCallback::SetCancellable(bool cancellable)
void FullscreenUI::LoadingScreenProgressCallback::SetCancellable(bool cancellable)
{
ProgressCallback::SetCancellable(cancellable);
Redraw(true);
}
void LoadingScreenProgressCallback::SetTitle(const std::string_view title)
void FullscreenUI::LoadingScreenProgressCallback::SetTitle(const std::string_view title)
{
ProgressCallback::SetTitle(title);
m_title = title;
Redraw(true);
}
void LoadingScreenProgressCallback::SetStatusText(const std::string_view text)
void FullscreenUI::LoadingScreenProgressCallback::SetStatusText(const std::string_view text)
{
ProgressCallback::SetStatusText(text);
Redraw(true);
}
void LoadingScreenProgressCallback::SetProgressRange(u32 range)
void FullscreenUI::LoadingScreenProgressCallback::SetProgressRange(u32 range)
{
u32 last_range = m_progress_range;
@@ -4613,7 +4613,7 @@ void LoadingScreenProgressCallback::SetProgressRange(u32 range)
Redraw(false);
}
void LoadingScreenProgressCallback::SetProgressValue(u32 value)
void FullscreenUI::LoadingScreenProgressCallback::SetProgressValue(u32 value)
{
u32 lastValue = m_progress_value;
@@ -4623,7 +4623,7 @@ void LoadingScreenProgressCallback::SetProgressValue(u32 value)
Redraw(false);
}
void LoadingScreenProgressCallback::Redraw(bool force)
void FullscreenUI::LoadingScreenProgressCallback::Redraw(bool force)
{
if (m_last_progress_percent < 0 &&
Timer::ConvertValueToSeconds(Timer::GetCurrentValue() - m_open_time) < m_open_delay)
@@ -4656,13 +4656,13 @@ void LoadingScreenProgressCallback::Redraw(bool force)
m_last_progress_percent = percent;
}
void LoadingScreenProgressCallback::ModalError(const std::string_view message)
void FullscreenUI::LoadingScreenProgressCallback::ModalError(const std::string_view message)
{
ERROR_LOG(message);
Host::ReportErrorAsync("Error", message);
}
bool LoadingScreenProgressCallback::ModalConfirmation(const std::string_view message)
bool FullscreenUI::LoadingScreenProgressCallback::ModalConfirmation(const std::string_view message)
{
INFO_LOG(message);
return Host::ConfirmMessage("Confirm", message);

View File

@@ -447,7 +447,7 @@ void PostProcessing::Chain::LoadStages(std::unique_lock<std::mutex>& settings_lo
return;
Error error;
LoadingScreenProgressCallback progress;
FullscreenUI::LoadingScreenProgressCallback progress;
progress.SetTitle("Loading Post-Processing Shaders...");
progress.SetProgressRange(stage_count);
@@ -521,7 +521,7 @@ void PostProcessing::Chain::UpdateSettings(std::unique_lock<std::mutex>& setting
m_stages.resize(stage_count);
LoadingScreenProgressCallback progress;
FullscreenUI::LoadingScreenProgressCallback progress;
progress.SetTitle("Loading Post-Processing Shaders...");
progress.SetProgressRange(stage_count);