1
0
mirror of synced 2024-11-24 15:50:16 +01:00

fix: Provider load interface not opening

This commit is contained in:
WerWolv 2023-11-27 15:34:05 +01:00
parent af77b8dfc4
commit 494223fff6
5 changed files with 15 additions and 8 deletions

View File

@ -171,7 +171,7 @@ namespace hex {
if (this->getWindowOpenState())
ImGui::OpenPopup(View::toWindowName(this->getUnlocalizedName()).c_str());
if (ImGui::BeginPopupModal(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | this->getWindowFlags())) {
if (ImGui::BeginPopupModal(View::toWindowName(this->getUnlocalizedName()).c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | this->getWindowFlags())) {
this->drawContent();
ImGui::EndPopup();

View File

@ -469,6 +469,7 @@ namespace hex {
ImGui::SetNextWindowSize(ImVec2(width, dockSpaceSize.y + 11_scaled - footerHeight));
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1);
ImGui::PushStyleColor(ImGuiCol_WindowShadow, 0x00000000);
if (ImGui::Begin("SideBarWindow", &open, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
if (ImGui::BeginTable("##Table", 2)) {
ImGui::TableSetupColumn("Main", ImGuiTableColumnFlags_WidthStretch, 1.0F);
@ -510,6 +511,7 @@ namespace hex {
}
ImGui::End();
ImGui::PopStyleVar();
ImGui::PopStyleColor();
}
ImGui::NewLine();

View File

@ -156,9 +156,7 @@ namespace hex::plugin::builtin {
EventManager::post<EventProviderOpened>(provider);
}
else if (provider->hasLoadInterface())
EventManager::post<RequestOpenPopup>(View::toWindowName("hex.builtin.view.provider_settings.load_popup"));
else {
else if (!provider->hasLoadInterface()) {
if (!provider->open() || !provider->isAvailable()) {
PopupError::open(hex::format("hex.builtin.provider.error.open"_lang, provider->getErrorMessage()));
TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); });

View File

@ -6,9 +6,9 @@
namespace hex::plugin::builtin {
ViewProviderSettings::ViewProviderSettings() : View::Modal("hex.builtin.view.provider_settings.name") {
EventManager::subscribe<EventProviderCreated>(this, [](const hex::prv::Provider *provider) {
EventManager::subscribe<EventProviderCreated>(this, [this](const hex::prv::Provider *provider) {
if (provider->hasLoadInterface() && !provider->shouldSkipLoadInterface())
EventManager::post<RequestOpenPopup>(View::toWindowName("hex.builtin.view.provider_settings.load_popup"));
this->getWindowOpenState() = true;
});
ContentRegistry::Interface::addSidebarItem(ICON_VS_SERVER_PROCESS, [] {
@ -40,9 +40,12 @@ namespace hex::plugin::builtin {
if (ImGui::Button("hex.builtin.common.open"_lang)) {
if (provider->open()) {
EventManager::post<EventProviderOpened>(provider);
this->getWindowOpenState() = false;
ImGui::CloseCurrentPopup();
}
else {
this->getWindowOpenState() = false;
ImGui::CloseCurrentPopup();
auto errorMessage = provider->getErrorMessage();
if (errorMessage.empty()) {
@ -59,6 +62,7 @@ namespace hex::plugin::builtin {
if (ImGui::Button("hex.builtin.common.cancel"_lang)) {
ImGui::CloseCurrentPopup();
this->getWindowOpenState() = false;
TaskManager::doLater([=] { ImHexApi::Provider::remove(provider); });
}
}

View File

@ -37,6 +37,9 @@ namespace hex::plugin::windows {
[[nodiscard]] std::string getName() const override { return hex::format("hex.windows.provider.process_memory.name"_lang, this->m_selectedProcess != nullptr ? this->m_selectedProcess->name : ""); }
[[nodiscard]] std::vector<Description> getDataDescription() const override {
if (this->m_selectedProcess == nullptr)
return {};
else
return {
{ "hex.windows.provider.process_memory.process_name"_lang, this->m_selectedProcess->name },
{ "hex.windows.provider.process_memory.process_id"_lang, std::to_string(this->m_selectedProcess->id) }