mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
feat: Display detailed error message when loading of project fails (#1135)
In order to do this I add to make some other additions : - Add a warning popup (TODO, maybe add some icons to differentiate error/warning popups in a future PR ?) - create showError() and showWarning() functions, as helpers to show a message both to the logs and as a popup
This commit is contained in:
@@ -12,15 +12,15 @@
|
||||
#include <hex/helpers/concepts.hpp>
|
||||
#include <hex/helpers/tar.hpp>
|
||||
|
||||
/**
|
||||
* @brief Project file manager
|
||||
*
|
||||
* The project file manager is used to load and store project files. It is used by all features of ImHex
|
||||
* that want to store any data to a Project File.
|
||||
*
|
||||
*/
|
||||
namespace hex {
|
||||
|
||||
/**
|
||||
* @brief Project file manager
|
||||
*
|
||||
* The project file manager is used to load and store project files. It is used by all features of ImHex
|
||||
* that want to store any data to a Project File.
|
||||
*
|
||||
*/
|
||||
class ProjectFile {
|
||||
public:
|
||||
struct Handler {
|
||||
@@ -39,6 +39,17 @@ namespace hex {
|
||||
Function load, store; //< Functions to load and store data
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Set implementations for loading and restoring a project
|
||||
*
|
||||
* @param loadFun function to use to load a project in ImHex
|
||||
* @param storeFun function to use to store a project to disk
|
||||
*/
|
||||
static void setProjectFunctions(
|
||||
const std::function<bool(const std::fs::path&)> &loadFun,
|
||||
const std::function<bool(std::optional<std::fs::path>)> &storeFun
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Load a project file
|
||||
*
|
||||
@@ -119,6 +130,9 @@ namespace hex {
|
||||
private:
|
||||
ProjectFile() = default;
|
||||
|
||||
static std::function<bool(const std::fs::path&)> s_loadProjectFunction;
|
||||
static std::function<bool(std::optional<std::fs::path>)> s_storeProjectFunction;
|
||||
|
||||
static std::fs::path s_currProjectPath;
|
||||
static std::vector<Handler> s_handlers;
|
||||
static std::vector<ProviderHandler> s_providerHandlers;
|
||||
|
||||
Reference in New Issue
Block a user