Simplify profile loading and handling of the loading screen

This commit is contained in:
Alexander Bock
2024-02-28 00:19:06 +01:00
parent 0203d723e8
commit 7a2efc66d6
9 changed files with 290 additions and 310 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
/**