sys: Added a info popup when closing ImHex while tasks are still running
This commit is contained in:
parent
9b80486285
commit
6799263317
@ -325,7 +325,7 @@
|
||||
"hex.builtin.popup.close_provider.title": "Close Provider?",
|
||||
"hex.builtin.popup.error.create": "Failed to create new file!",
|
||||
"hex.builtin.popup.error.file_dialog.common": "An error occurred while opening the file browser!",
|
||||
"hex.builtin.popup.error.file_dialog.portal": "There was an error while opening the file browser. This might be caused by your system not having a xdg-desktop-portal backend installed correctly.\n\nOn KDE, it's xdg-desktop-portal-kde.\nOn Gnome it's xdg-desktop-portal-gnome.\nOn wlroots it's xdg-desktop-portal-wlr.\nOtherwise, you can try to use xdg-desktop-portal-gtk.\n\nReboot your system after installing it.\n\nIf the file browser still doesn't work after this, submit an issue at https://github.com/WerWolv/ImHex/issues\n\nIn the meantime files can still be opened by dragging them onto the ImHex window!",
|
||||
"hex.builtin.popup.error.file_dialog.portal": "There was an error while opening the file browser.\nThis might be caused by your system not having a xdg-desktop-portal backend installed correctly.\n\nOn KDE, it's xdg-desktop-portal-kde.\nOn Gnome it's xdg-desktop-portal-gnome.\nOn wlroots it's xdg-desktop-portal-wlr.\nOtherwise, you can try to use xdg-desktop-portal-gtk.\n\nReboot your system after installing it.\n\nIf the file browser still doesn't work after this, submit an issue at https://github.com/WerWolv/ImHex/issues\n\nIn the meantime files can still be opened by dragging them onto the ImHex window!",
|
||||
"hex.builtin.popup.error.open": "Failed to open file!",
|
||||
"hex.builtin.popup.error.project.load": "Failed to load project!",
|
||||
"hex.builtin.popup.error.project.save": "Failed to save project!",
|
||||
@ -333,6 +333,8 @@
|
||||
"hex.builtin.popup.error.task_exception": "Exception thrown in Task '{}':\n\n{}",
|
||||
"hex.builtin.popup.exit_application.desc": "You have unsaved changes made to your Project.\nAre you sure you want to exit?",
|
||||
"hex.builtin.popup.exit_application.title": "Exit Application?",
|
||||
"hex.builtin.popup.waiting_for_tasks.title": "Waiting for Tasks",
|
||||
"hex.builtin.popup.waiting_for_tasks.desc": "There are still tasks running in the background.\nImHex will close after they are finished.",
|
||||
"hex.builtin.provider.disk": "Raw Disk Provider",
|
||||
"hex.builtin.provider.disk.disk_size": "Disk Size",
|
||||
"hex.builtin.provider.disk.reload": "Reload",
|
||||
|
@ -32,6 +32,13 @@ namespace hex::plugin::builtin {
|
||||
if (ImHexApi::Provider::isDirty()) {
|
||||
glfwSetWindowShouldClose(window, GLFW_FALSE);
|
||||
TaskManager::doLater([] { ImGui::OpenPopup("hex.builtin.popup.exit_application.title"_lang); });
|
||||
} else if (TaskManager::getRunningTaskCount() > 0 || TaskManager::getRunningBackgroundTaskCount() > 0) {
|
||||
glfwSetWindowShouldClose(window, GLFW_FALSE);
|
||||
TaskManager::doLater([] {
|
||||
for (auto &task : TaskManager::getRunningTasks())
|
||||
task->interrupt();
|
||||
ImGui::OpenPopup("hex.builtin.popup.waiting_for_tasks.title"_lang);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -31,9 +31,12 @@ namespace hex::plugin::builtin {
|
||||
ImGui::NewLine();
|
||||
|
||||
View::confirmButtons("hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang,
|
||||
[] { ImHexApi::Common::closeImHex(true); },
|
||||
[] { ImGui::CloseCurrentPopup(); }
|
||||
);
|
||||
[] {
|
||||
ImHexApi::Provider::resetDirty();
|
||||
ImHexApi::Common::closeImHex();
|
||||
},
|
||||
[] { ImGui::CloseCurrentPopup(); }
|
||||
);
|
||||
|
||||
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||
ImGui::CloseCurrentPopup();
|
||||
@ -58,6 +61,23 @@ namespace hex::plugin::builtin {
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (ImGui::BeginPopupModal("hex.builtin.popup.waiting_for_tasks.title"_lang, nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove)) {
|
||||
ImGui::TextUnformatted("hex.builtin.popup.waiting_for_tasks.desc"_lang);
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize("[-]").x) / 2);
|
||||
ImGui::TextSpinner("");
|
||||
ImGui::NewLine();
|
||||
|
||||
if (TaskManager::getRunningTaskCount() == 0 && TaskManager::getRunningBackgroundTaskCount() == 0) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
ImHexApi::Common::closeImHex();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
auto windowSize = ImHexApi::System::getMainWindowSize();
|
||||
|
||||
// Info popup
|
||||
|
Loading…
Reference in New Issue
Block a user