| | |
| | |
| | |
| |
|
| | #pragma once |
| |
|
| | #include <chrono> |
| | #include <memory> |
| | #include <QWidget> |
| |
|
| | namespace Loader { |
| | class AppLoader; |
| | } |
| |
|
| | namespace Ui { |
| | class LoadingScreen; |
| | } |
| |
|
| | namespace VideoCore { |
| | enum class LoadCallbackStage; |
| | } |
| |
|
| | class QGraphicsOpacityEffect; |
| | 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: |
| | 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; |
| |
|
| | |
| | |
| | |
| | |
| | static constexpr std::chrono::seconds ETABreakPoint = std::chrono::seconds{10}; |
| | static constexpr std::size_t NumberOfDataPoints = 25; |
| | std::chrono::high_resolution_clock::time_point previous_time; |
| | std::chrono::duration<double> rolling_average = {}; |
| | bool eta_shown = false; |
| | }; |
| |
|