diff --git a/plugins/builtin/romfs/lang/en_US.json b/plugins/builtin/romfs/lang/en_US.json index f6f336202..fcf77a508 100644 --- a/plugins/builtin/romfs/lang/en_US.json +++ b/plugins/builtin/romfs/lang/en_US.json @@ -439,6 +439,7 @@ "hex.builtin.provider.mem_file.rename": "Rename File", "hex.builtin.provider.motorola_srec": "Motorola SREC File", "hex.builtin.provider.motorola_srec.name": "Motorola SREC {0}", + "hex.builtin.provider.opening": "Opening Provider...", "hex.builtin.provider.process_memory": "Process Memory", "hex.builtin.provider.process_memory.enumeration_failed": "Failed to enumerate processes", "hex.builtin.provider.process_memory.macos_limitations": "macOS doesn't properly allow reading memory from other processes, even when running as root. If System Integrity Protection (SIP) is enabled, it only works for applications that are unsigned or have the 'Get Task Allow' entitlement which generally only applies to applications compiled by yourself.", diff --git a/plugins/builtin/source/content/events.cpp b/plugins/builtin/source/content/events.cpp index 464aa6f51..4f33e21cf 100644 --- a/plugins/builtin/source/content/events.cpp +++ b/plugins/builtin/source/content/events.cpp @@ -190,20 +190,23 @@ namespace hex::plugin::builtin { TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); return; } - if (!provider->open()) { - ui::ToastError::open(hex::format("hex.builtin.provider.error.open"_lang, provider->getErrorMessage())); - TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); - return; - } + + TaskManager::createBlockingTask("hex.builtin.provider.opening", TaskManager::NoProgress, [provider]() { + if (!provider->open()) { + ui::ToastError::open(hex::format("hex.builtin.provider.error.open"_lang, provider->getErrorMessage())); + TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); + } + }); EventProviderOpened::post(provider); } else if (!provider->hasLoadInterface()) { - if (!provider->open() || !provider->isAvailable()) { - ui::ToastError::open(hex::format("hex.builtin.provider.error.open"_lang, provider->getErrorMessage())); - TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); - return; - } + TaskManager::createBlockingTask("hex.builtin.provider.opening", TaskManager::NoProgress, [provider]() { + if (!provider->open() || !provider->isAvailable()) { + ui::ToastError::open(hex::format("hex.builtin.provider.error.open"_lang, provider->getErrorMessage())); + TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); + } + }); EventProviderOpened::post(provider); } diff --git a/plugins/builtin/source/content/recent.cpp b/plugins/builtin/source/content/recent.cpp index fda3c24c4..a4d0d409f 100644 --- a/plugins/builtin/source/content/recent.cpp +++ b/plugins/builtin/source/content/recent.cpp @@ -238,15 +238,17 @@ namespace hex::plugin::builtin::recent { } return; } + auto *provider = ImHexApi::Provider::createProvider(recentEntry.type, true); if (provider != nullptr) { provider->loadSettings(recentEntry.data); - if (!provider->open() || !provider->isAvailable()) { - ui::ToastError::open(hex::format("hex.builtin.provider.error.open"_lang, provider->getErrorMessage())); - TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); - return; - } + TaskManager::createBlockingTask("hex.builtin.provider.opening", TaskManager::NoProgress, [provider]() { + if (!provider->open() || !provider->isAvailable()) { + ui::ToastError::open(hex::format("hex.builtin.provider.error.open"_lang, provider->getErrorMessage())); + TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); }); + } + }); EventProviderOpened::post(provider); diff --git a/plugins/builtin/source/content/views/view_data_processor.cpp b/plugins/builtin/source/content/views/view_data_processor.cpp index 743f49586..daba17cb9 100644 --- a/plugins/builtin/source/content/views/view_data_processor.cpp +++ b/plugins/builtin/source/content/views/view_data_processor.cpp @@ -376,7 +376,7 @@ namespace hex::plugin::builtin { } }); - EventProviderCreated::subscribe(this, [this](auto *provider) { + EventProviderOpened::subscribe(this, [this](auto *provider) { m_mainWorkspace.get(provider) = { }; m_workspaceStack.get(provider).push_back(&m_mainWorkspace.get(provider)); }); @@ -429,7 +429,7 @@ namespace hex::plugin::builtin { } ViewDataProcessor::~ViewDataProcessor() { - EventProviderCreated::unsubscribe(this); + EventProviderOpened::unsubscribe(this); EventProviderChanged::unsubscribe(this); RequestChangeTheme::unsubscribe(this); EventFileLoaded::unsubscribe(this); diff --git a/plugins/builtin/source/content/views/view_highlight_rules.cpp b/plugins/builtin/source/content/views/view_highlight_rules.cpp index d8177582b..c63307e35 100644 --- a/plugins/builtin/source/content/views/view_highlight_rules.cpp +++ b/plugins/builtin/source/content/views/view_highlight_rules.cpp @@ -168,7 +168,7 @@ namespace hex::plugin::builtin { // Initialize the selected rule iterators to point to the end of the rules lists m_selectedRule = m_rules->end(); - EventProviderCreated::subscribe([this](prv::Provider *provider) { + EventProviderOpened::subscribe([this](prv::Provider *provider) { m_selectedRule.get(provider) = m_rules.get(provider).end(); }); } diff --git a/plugins/builtin/source/content/views/view_provider_settings.cpp b/plugins/builtin/source/content/views/view_provider_settings.cpp index ea4665987..d2e0fb12a 100644 --- a/plugins/builtin/source/content/views/view_provider_settings.cpp +++ b/plugins/builtin/source/content/views/view_provider_settings.cpp @@ -9,7 +9,7 @@ namespace hex::plugin::builtin { ViewProviderSettings::ViewProviderSettings() : View::Modal("hex.builtin.view.provider_settings.name") { - EventProviderCreated::subscribe(this, [this](const hex::prv::Provider *provider) { + EventProviderOpened::subscribe(this, [this](const hex::prv::Provider *provider) { if (provider->hasLoadInterface() && !provider->shouldSkipLoadInterface()) this->getWindowOpenState() = true; }); @@ -28,7 +28,7 @@ namespace hex::plugin::builtin { } ViewProviderSettings::~ViewProviderSettings() { - EventProviderCreated::unsubscribe(this); + EventProviderOpened::unsubscribe(this); } void ViewProviderSettings::drawContent() {