| | |
| | |
| |
|
| | #pragma once |
| |
|
| | #include <chrono> |
| | #include <memory> |
| | #include <QString> |
| | #include <QWidget> |
| | #include <QtGlobal> |
| |
|
| | #if !QT_CONFIG(movie) |
| | #define YUZU_QT_MOVIE_MISSING 1 |
| | #endif |
| |
|
| | namespace Loader { |
| | class AppLoader; |
| | } |
| |
|
| | 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 |
| |
|
| | public: |
| | explicit LoadingScreen(QWidget* parent = nullptr); |
| |
|
| | ~LoadingScreen(); |
| |
|
| | |
| | |
| | void Prepare(Loader::AppLoader& loader); |
| |
|
| | |
| | |
| | void Clear(); |
| |
|
| | |
| | void OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total); |
| |
|
| | |
| | void OnLoadComplete(); |
| |
|
| | |
| | |
| | void paintEvent(QPaintEvent* event) override; |
| |
|
| | signals: |
| | void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total); |
| | |
| | |
| | void Hidden(); |
| |
|
| | private: |
| | #ifndef YUZU_QT_MOVIE_MISSING |
| | std::unique_ptr<QMovie> animation; |
| | std::unique_ptr<QBuffer> backing_buf; |
| | std::unique_ptr<QByteArray> backing_mem; |
| | #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; |
| |
|
| | |
| | std::unordered_map<VideoCore::LoadCallbackStage, const char*> progressbar_style; |
| | std::unordered_map<VideoCore::LoadCallbackStage, QString> stage_translations; |
| |
|
| | |
| | |
| | |
| | bool slow_shader_compile_start = false; |
| | std::chrono::steady_clock::time_point slow_shader_start; |
| | std::chrono::steady_clock::time_point previous_time; |
| | std::size_t slow_shader_first_value = 0; |
| | }; |
| |
|
| | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) |
| | Q_DECLARE_METATYPE(VideoCore::LoadCallbackStage); |
| | #endif |
| |
|