Extract app document session decisions
This commit is contained in:
11
src/app.cpp
11
src/app.cpp
@@ -6,6 +6,7 @@
|
||||
#include "node_progress_bar.h"
|
||||
#include "mp4enc.h"
|
||||
#include "app_core/document_route.h"
|
||||
#include "app_core/document_session.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -238,7 +239,8 @@ void App::open_document(std::string path)
|
||||
});
|
||||
ActionManager::clear();
|
||||
};
|
||||
if (!Canvas::I->m_unsaved)
|
||||
const auto open_decision = pp::app::plan_project_open(Canvas::I->m_unsaved);
|
||||
if (open_decision == pp::app::ProjectOpenDecision::open_now)
|
||||
{
|
||||
open_action();
|
||||
}
|
||||
@@ -256,9 +258,12 @@ void App::open_document(std::string path)
|
||||
bool App::request_close()
|
||||
{
|
||||
static bool dialog_already_opened = false;
|
||||
if (!Canvas::I->m_unsaved)
|
||||
const auto close_decision = pp::app::plan_close_request(
|
||||
Canvas::I->m_unsaved,
|
||||
dialog_already_opened);
|
||||
if (close_decision == pp::app::CloseRequestDecision::close_now)
|
||||
return true;
|
||||
if (!dialog_already_opened)
|
||||
if (close_decision == pp::app::CloseRequestDecision::show_unsaved_prompt)
|
||||
{
|
||||
auto* m = layout[main_id]->add_child<NodeMessageBox>();
|
||||
m->m_title->set_text("Unsaved document");
|
||||
|
||||
Reference in New Issue
Block a user