add export message box
This commit is contained in:
@@ -125,6 +125,7 @@ public:
|
||||
bool key_up(kKey key);
|
||||
bool key_char(char key);
|
||||
void toggle_ui();
|
||||
void message_box(const std::string& title, const std::string& text);
|
||||
|
||||
void rec_clear();
|
||||
void rec_loop();
|
||||
|
||||
@@ -20,6 +20,19 @@ std::shared_ptr<NodeProgressBar> App::show_progress(const std::string& title)
|
||||
return pb;
|
||||
}
|
||||
|
||||
void App::message_box(const std::string &title, const std::string& text)
|
||||
{
|
||||
async_start();
|
||||
auto* m = layout[main_id]->add_child<NodeMessageBox>();
|
||||
m->m_title->set_text(title.c_str());
|
||||
m->m_message->set_text(text.c_str());
|
||||
m->btn_ok->m_text->set_text("Ok");
|
||||
m->btn_cancel->destroy();
|
||||
layout[main_id]->update();
|
||||
async_redraw();
|
||||
async_end();
|
||||
}
|
||||
|
||||
void App::dialog_usermanual()
|
||||
{
|
||||
auto dialog = std::make_shared<NodeUserManual>();
|
||||
@@ -364,7 +377,15 @@ void App::dialog_export()
|
||||
{
|
||||
if (canvas)
|
||||
{
|
||||
canvas->m_canvas->export_equirectangular(data_path + "/" + doc_name + ".jpg");
|
||||
canvas->m_canvas->export_equirectangular(data_path + "/" + doc_name + ".jpg", [this]{
|
||||
#if defined(__IOS__)
|
||||
message_box("Export JPG", "Image exported to Photos");
|
||||
#elif defined(__OSX__)
|
||||
message_box("Export JPG", "Image exported to Pictures/PanoPainter folder");
|
||||
#elif defined(_WIN32)
|
||||
message_box("Export JPG", "Image exported to Images/PanoPainter folder");
|
||||
#endif
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@ void App::init_toolbar_main()
|
||||
button->on_click = [this, button](Node*) {
|
||||
if (canvas)
|
||||
{
|
||||
canvas->m_canvas->export_equirectangular(data_path);
|
||||
canvas->m_canvas->export_equirectangular(data_path, [this]{
|
||||
message_box("Export", "blabl");
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1051,12 +1051,17 @@ void ui::Canvas::import_equirectangular_thread(std::string file_path)
|
||||
App::I.async_end();
|
||||
}
|
||||
|
||||
void ui::Canvas::export_equirectangular(std::string file_path)
|
||||
void ui::Canvas::export_equirectangular(std::string file_path, std::function<void()> on_complete)
|
||||
{
|
||||
if (!App::I.check_license())
|
||||
return;
|
||||
std::thread t(&ui::Canvas::export_equirectangular_thread, this, file_path);
|
||||
t.detach();
|
||||
if (App::I.check_license())
|
||||
{
|
||||
std::thread t([=] {
|
||||
export_equirectangular_thread(App::I.data_path + "/" + App::I.doc_name + ".ppi");
|
||||
if (on_complete)
|
||||
on_complete();
|
||||
});
|
||||
t.detach();
|
||||
}
|
||||
}
|
||||
|
||||
void ui::Canvas::export_equirectangular_thread(std::string file_path)
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
void clear_context();
|
||||
void import_equirectangular(std::string file_path);
|
||||
void import_equirectangular_thread(std::string file_path);
|
||||
void export_equirectangular(std::string file_path);
|
||||
void export_equirectangular(std::string file_path, std::function<void()> on_complete = nullptr);
|
||||
void export_equirectangular_thread(std::string file_path);
|
||||
void export_anim(std::string data_path);
|
||||
void export_cubes(std::string data_path);
|
||||
|
||||
Reference in New Issue
Block a user