api: Refactored providers to allow for loading interfaces and config views

This commit is contained in:
WerWolv
2021-12-12 00:41:44 +01:00
parent 2e90abd2c5
commit 3e736b36b6
23 changed files with 272 additions and 145 deletions

View File

@@ -713,8 +713,13 @@ namespace hex::plugin::builtin {
hex::prv::Provider *provider = nullptr;
EventManager::post<RequestCreateProvider>("hex.builtin.provider.file", &provider);
if (auto fileProvider = dynamic_cast<prv::FileProvider*>(provider))
fileProvider->open(path);
if (auto fileProvider = dynamic_cast<prv::FileProvider*>(provider)) {
fileProvider->setPath(path);
if (!fileProvider->open()) {
View::showErrorPopup("hex.builtin.view.hexeditor.error.open"_lang);
return;
}
}
if (!provider->isWritable()) {
this->m_memoryEditor.ReadOnly = true;