Refactoring Session saving

use Session::save static method to save a session from a thread (same mechanism as Session::load). It calls Action::takeSnapshot if saving version is required. Mixer is busy during saving, pops up info when done.
This commit is contained in:
Bruno Herbelin
2022-01-17 00:38:48 +01:00
parent e96444671e
commit 81e8d6d99c
7 changed files with 161 additions and 130 deletions

View File

@@ -760,8 +760,7 @@ void UserInterface::NewFrame()
if (DialogToolkit::FileDialog::busy()){
if (!ImGui::IsPopupOpen("Busy"))
ImGui::OpenPopup("Busy");
if (ImGui::BeginPopupModal("Busy", NULL, ImGuiWindowFlags_AlwaysAutoResize))
{
if (ImGui::BeginPopupModal("Busy", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("Close file dialog box to resume.");
ImGui::EndPopup();
}
@@ -798,17 +797,13 @@ void UserInterface::NewFrame()
if (close_and_exit){
if (!ImGui::IsPopupOpen("Closing"))
ImGui::OpenPopup("Closing");
if (ImGui::BeginPopupModal("Closing", NULL, ImGuiWindowFlags_AlwaysAutoResize))
{
if (ImGui::BeginPopupModal("Closing", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("Please wait...");
if (FrameGrabbing::manager().busy())
ImGui::Text(" - Stop recordings.");
if (Settings::application.recentSessions.save_on_exit)
ImGui::Text(" - Save session.");
ImGui::EndPopup();
}
// exit only after everything is closed
if (!FrameGrabbing::manager().busy() && !Mixer::manager().session()->locked()) {
if (!FrameGrabbing::manager().busy() && !Mixer::manager().busy()) {
Rendering::manager().close();
}
}