From e8bd6b1fcc5abd4813cda08b4921c94ada89509d Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sat, 19 Jan 2019 21:03:26 -0700 Subject: QT: Upgrade the Loading Bar to look much better --- src/yuzu/loading_screen.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/yuzu/loading_screen.h') diff --git a/src/yuzu/loading_screen.h b/src/yuzu/loading_screen.h index 2a6cf1142..9370ede69 100644 --- a/src/yuzu/loading_screen.h +++ b/src/yuzu/loading_screen.h @@ -4,7 +4,9 @@ #pragma once +#include #include +#include #include #if !QT_CONFIG(movie) @@ -19,6 +21,10 @@ namespace Ui { class LoadingScreen; } +namespace VideoCore { +enum class LoadCallbackStage; +} + class QBuffer; class QByteArray; class QMovie; @@ -39,11 +45,14 @@ public: /// used resources such as the logo and banner. void Clear(); + void OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total); + // In order to use a custom widget with a stylesheet, you need to override the paintEvent // See https://wiki.qt.io/How_to_Change_the_Background_Color_of_QWidget void paintEvent(QPaintEvent* event) override; - void OnLoadProgress(std::size_t value, std::size_t total); +signals: + void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total); private: #ifndef YUZU_QT_MOVIE_MISSING @@ -53,4 +62,19 @@ private: #endif std::unique_ptr ui; std::size_t previous_total = 0; + VideoCore::LoadCallbackStage previous_stage; + + // Definitions for the differences in text and styling for each stage + std::unordered_map progressbar_style; + std::unordered_map stage_translations; + + // newly generated shaders are added to the end of the file, so when loading and compiling + // shaders, it will start quickly but end slow if new shaders were added since previous launch. + // These variables are used to detect the change in speed so we can generate an ETA + bool slow_shader_compile_start = false; + std::chrono::high_resolution_clock::time_point slow_shader_start; + std::chrono::high_resolution_clock::time_point previous_time; + std::size_t slow_shader_first_value = 0; }; + +Q_DECLARE_METATYPE(VideoCore::LoadCallbackStage); -- cgit v1.2.3