confirm dialog when opening from shell

This commit is contained in:
2019-09-23 12:29:25 +02:00
parent c0b57b6662
commit 3f28fd9229
3 changed files with 52 additions and 24 deletions

View File

@@ -57,10 +57,23 @@ void App::open_document(std::string path)
if (str_iequals(m[3].str(), "abr")) if (str_iequals(m[3].str(), "abr"))
{ {
auto mb = message_box("Import ABR", "Would you like to import the brushes?", true);
mb->on_submit = [this, path] (Node* target) {
std::thread(&NodePanelBrushPreset::import_abr, presets, path).detach(); std::thread(&NodePanelBrushPreset::import_abr, presets, path).detach();
target->destroy();
};
}
else if (str_iequals(m[3].str(), "ppbr"))
{
auto mb = message_box("Import PPBR", "Would you like to import the brushes?", true);
mb->on_submit = [this, path] (Node* target) {
std::thread(&NodePanelBrushPreset::import_ppbr, presets, path).detach();
target->destroy();
};
} }
else else
{ {
auto open_action = [this, path, m] {
doc_name = m[2].str(); doc_name = m[2].str();
doc_dir = m[1].str(); doc_dir = m[1].str();
doc_path = path; doc_path = path;
@@ -85,6 +98,19 @@ void App::open_document(std::string path)
} }
}); });
ActionManager::clear(); ActionManager::clear();
};
if (!Canvas::I->m_unsaved)
{
open_action();
}
else
{
auto mb = message_box("Unsaved document", "Do you want to close the unsaved document before opening the file?", true);
mb->on_submit = [this, open_action] (Node* target) {
open_action();
target->destroy();
};
}
} }
} }

View File

@@ -606,6 +606,7 @@ void App::dialog_ppbr_export()
info.email = dialog->txt_email->m_text; info.email = dialog->txt_email->m_text;
info.descr = dialog->txt_descr->m_text; info.descr = dialog->txt_descr->m_text;
info.header_image = dialog->m_header_image; info.header_image = dialog->m_header_image;
if (dialog->export_check)
info.export_data = dialog->export_check->checked; info.export_data = dialog->export_check->checked;
#if __IOS__ #if __IOS__
App::I->pick_file_save("ppbr", App::I->pick_file_save("ppbr",

View File

@@ -3,6 +3,7 @@
#ifdef __APPLE__ #ifdef __APPLE__
#define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); } #define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); }
#define LOGW
#elif __ANDROID__ #elif __ANDROID__
#define LOG(...) { ((void)__android_log_print(ANDROID_LOG_INFO, "PanoPainterCPP", __VA_ARGS__)); LogRemote::I.log(__VA_ARGS__); } #define LOG(...) { ((void)__android_log_print(ANDROID_LOG_INFO, "PanoPainterCPP", __VA_ARGS__)); LogRemote::I.log(__VA_ARGS__); }
#define LOGW #define LOGW