2019-01-17 07:01:00 +00:00
|
|
|
// Copyright 2019 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <QWidget>
|
|
|
|
|
2019-01-18 17:02:27 +00:00
|
|
|
#if !QT_CONFIG(movie)
|
|
|
|
#define YUZU_QT_MOVIE_MISSING 1
|
|
|
|
#endif
|
|
|
|
|
2019-01-17 07:01:00 +00:00
|
|
|
namespace Loader {
|
|
|
|
class AppLoader;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class LoadingScreen;
|
|
|
|
}
|
|
|
|
|
|
|
|
class QBuffer;
|
|
|
|
class QByteArray;
|
|
|
|
class QMovie;
|
|
|
|
|
|
|
|
class LoadingScreen : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit LoadingScreen(QWidget* parent = nullptr);
|
|
|
|
|
|
|
|
~LoadingScreen();
|
|
|
|
|
|
|
|
/// Call before showing the loading screen to load the widgets with the logo and banner for the
|
|
|
|
/// currently loaded application.
|
|
|
|
void Prepare(Loader::AppLoader& loader);
|
|
|
|
|
|
|
|
/// After the loading screen is hidden, the owner of this class can call this to clean up any
|
|
|
|
/// used resources such as the logo and banner.
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
private:
|
2019-01-18 17:02:27 +00:00
|
|
|
#ifndef YUZU_QT_MOVIE_MISSING
|
2019-01-17 07:01:00 +00:00
|
|
|
std::unique_ptr<QMovie> animation;
|
|
|
|
std::unique_ptr<QBuffer> backing_buf;
|
|
|
|
std::unique_ptr<QByteArray> backing_mem;
|
2019-01-18 17:02:27 +00:00
|
|
|
#endif
|
2019-01-17 07:01:00 +00:00
|
|
|
std::unique_ptr<Ui::LoadingScreen> ui;
|
|
|
|
std::size_t previous_total = 0;
|
|
|
|
};
|