mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Simplify profile loading and handling of the loading screen
This commit is contained in:
@@ -159,7 +159,6 @@ private:
|
||||
|
||||
std::unique_ptr<Scene> _scene;
|
||||
std::unique_ptr<AssetManager> _assetManager;
|
||||
bool _shouldAbortLoading = false;
|
||||
std::unique_ptr<LoadingScreen> _loadingScreen;
|
||||
std::unique_ptr<VersionChecker> _versionChecker;
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@ namespace ghoul::opengl {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class AssetManager;
|
||||
class Scene;
|
||||
|
||||
class LoadingScreen {
|
||||
public:
|
||||
BooleanType(ShowMessage);
|
||||
@@ -57,29 +60,11 @@ public:
|
||||
ShowLogMessages showLogMessages);
|
||||
~LoadingScreen();
|
||||
|
||||
void abort();
|
||||
void exec(AssetManager& manager, Scene& scene);
|
||||
|
||||
void render();
|
||||
|
||||
void postMessage(std::string message);
|
||||
void setCatastrophicError(CatastrophicError catastrophicError);
|
||||
|
||||
void finalize();
|
||||
|
||||
enum class Phase {
|
||||
PreStart,
|
||||
Construction,
|
||||
Synchronization,
|
||||
Initialization
|
||||
};
|
||||
void setPhase(Phase phase);
|
||||
|
||||
|
||||
enum class ItemStatus {
|
||||
Started,
|
||||
Initializing,
|
||||
Finished,
|
||||
Failed
|
||||
};
|
||||
|
||||
struct ProgressInfo {
|
||||
float progress = 0.f;
|
||||
|
||||
@@ -87,10 +72,29 @@ public:
|
||||
int64_t totalSize = -1;
|
||||
};
|
||||
|
||||
enum class ItemStatus {
|
||||
Started,
|
||||
Initializing,
|
||||
Finished,
|
||||
Failed
|
||||
};
|
||||
|
||||
void updateItem(const std::string& itemIdentifier, const std::string& itemName,
|
||||
ItemStatus newStatus, ProgressInfo progressInfo);
|
||||
|
||||
private:
|
||||
enum class Phase {
|
||||
PreStart,
|
||||
Construction,
|
||||
Synchronization,
|
||||
Initialization
|
||||
};
|
||||
|
||||
void postMessage(std::string message);
|
||||
void setCatastrophicError(CatastrophicError catastrophicError);
|
||||
|
||||
void finalize();
|
||||
void setPhase(Phase phase);
|
||||
|
||||
void renderLogMessages() const;
|
||||
|
||||
@@ -127,6 +131,8 @@ private:
|
||||
std::vector<Item> _items;
|
||||
std::mutex _itemsMutex;
|
||||
|
||||
bool _shouldAbortLoading = false;
|
||||
|
||||
std::random_device _randomDevice;
|
||||
std::default_random_engine _randomEngine;
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
using CameraType = std::variant<CameraGoToNode, CameraNavState, CameraGoToGeo>;
|
||||
|
||||
Profile() = default;
|
||||
explicit Profile(const std::string& content);
|
||||
explicit Profile(const std::filesystem::path& path);
|
||||
std::string serialize() const;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user