impr: Refactor and modularize data information view

This commit is contained in:
WerWolv
2024-02-21 00:06:52 +01:00
parent a2ffac9424
commit 56e7c15064
25 changed files with 852 additions and 628 deletions

View File

@@ -1,6 +1,7 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/project_file_manager.hpp>
#include <toasts/toast_notification.hpp>
namespace hex::plugin::builtin {
@@ -18,6 +19,17 @@ namespace hex::plugin::builtin {
return false;
});
ContentRegistry::FileHandler::add({ ".mgc" }, [](const auto &path) {
for (const auto &destPath : fs::getDefaultPaths(fs::ImHexPath::Magic)) {
if (wolv::io::fs::copyFile(path, destPath / path.filename(), std::fs::copy_options::overwrite_existing)) {
ui::ToastInfo::open("hex.builtin.view.information.magic_db_added"_lang);
return true;
}
}
return false;
});
}
}