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:
iTrooz
2023-06-21 20:07:36 +02:00
committed by GitHub
parent 3fe6cd057b
commit b7d8e46288
13 changed files with 363 additions and 182 deletions

View File

@@ -0,0 +1,10 @@
#pragma once
#include <content/popups/popup_notification.hpp>
namespace hex::plugin::builtin {
void showError(const std::string& message);
void showWarning(const std::string& message);
}

View File

@@ -1,6 +1,9 @@
#pragma once
#include <hex/ui/popup.hpp>
#include <hex/api/localization.hpp>
#include <hex/api/imhex_api.hpp>
#include <functional>
#include <string>
@@ -53,6 +56,14 @@ namespace hex::plugin::builtin {
}) { }
};
class PopupWarning : public impl::PopupNotification<PopupWarning> {
public:
explicit PopupWarning(std::string message)
: PopupNotification("hex.builtin.common.warning", std::move(message), [this]() {
Popup::close();
}) { }
};
class PopupError : public impl::PopupNotification<PopupError> {
public:
explicit PopupError(std::string message)