diff options
| author | bunnei <bunneidev@gmail.com> | 2019-01-21 14:12:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-21 14:12:47 -0500 |
| commit | 125599c2d51fba0bb9466d92382631ed7f34bed9 (patch) | |
| tree | a0fc21fcf2d49ff81938f0463cf3a5da4dcd3184 /src/yuzu/loading_screen.h | |
| parent | 1c733bf175253bbe3f2f7747fe5344e654eff6e0 (diff) | |
| parent | 3049ea45d3f1621e48714022a195f6a2971dce56 (diff) | |
Merge pull request #2038 from jroweboy/loading-progress-bar
Loading progress bar upgrades
Diffstat (limited to 'src/yuzu/loading_screen.h')
| -rw-r--r-- | src/yuzu/loading_screen.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/yuzu/loading_screen.h b/src/yuzu/loading_screen.h index 2a6cf1142..801d08e1a 100644 --- a/src/yuzu/loading_screen.h +++ b/src/yuzu/loading_screen.h @@ -4,7 +4,9 @@ #pragma once +#include <chrono> #include <memory> +#include <QString> #include <QWidget> #if !QT_CONFIG(movie) @@ -19,9 +21,15 @@ namespace Ui { class LoadingScreen; } +namespace VideoCore { +enum class LoadCallbackStage; +} + class QBuffer; class QByteArray; +class QGraphicsOpacityEffect; class QMovie; +class QPropertyAnimation; class LoadingScreen : public QWidget { Q_OBJECT @@ -39,11 +47,21 @@ public: /// used resources such as the logo and banner. void Clear(); + /// Slot used to update the status of the progress bar + void OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total); + + /// Hides the LoadingScreen with a fade out effect + void OnLoadComplete(); + // 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); + /// Signals that this widget is completely hidden now and should be replaced with the other + /// widget + void Hidden(); private: #ifndef YUZU_QT_MOVIE_MISSING @@ -53,4 +71,22 @@ private: #endif std::unique_ptr<Ui::LoadingScreen> ui; std::size_t previous_total = 0; + VideoCore::LoadCallbackStage previous_stage; + + QGraphicsOpacityEffect* opacity_effect = nullptr; + std::unique_ptr<QPropertyAnimation> fadeout_animation; + + // Definitions for the differences in text and styling for each stage + std::unordered_map<VideoCore::LoadCallbackStage, const char*> progressbar_style; + std::unordered_map<VideoCore::LoadCallbackStage, QString> 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); |
