add more checks on unsaved documents

This commit is contained in:
2018-07-31 22:46:07 +02:00
parent 1a7677a727
commit 5c2264ba8b
3 changed files with 120 additions and 15 deletions

View File

@@ -1357,17 +1357,40 @@ void ui::Canvas::export_cubes(std::string data_path)
#endif
}
void ui::Canvas::project_save(std::string file_path)
void ui::Canvas::project_save(std::function<void()> on_complete)
{
if (!App::I.check_license())
return;
std::thread t(&ui::Canvas::project_save_thread, this, file_path);
t.detach();
if (App::I.check_license())
{
std::thread t([=] {
project_save_thread(App::I.data_path + "/" + App::I.doc_name + ".pano");
if (on_complete)
on_complete();
});
t.detach();
}
}
void ui::Canvas::project_save(std::string file_path, std::function<void()> on_complete)
{
if (App::I.check_license())
{
std::thread t([=] {
project_save_thread(file_path);
if (on_complete)
on_complete();
});
t.detach();
}
}
void ui::Canvas::project_save_thread(std::string file_path)
{
gl_state gl;
// already saved, nothing to do
if (!m_unsaved)
return;
// static char name[128];
// sprintf(name, "%s/latlong.pano", data_path.c_str());
FILE* fp = fopen(file_path.c_str(), "wb");