add upload to cloud menu to copy all the files to the server
This commit is contained in:
@@ -375,6 +375,61 @@ void App::init_menu_file()
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
};
|
||||
popup->find<NodeButtonCustom>("file-upload")->on_click = [this](Node*) {
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
std::thread([] {
|
||||
auto names = Asset::list_files(App::I.data_path, false, ".*\\.pano");
|
||||
|
||||
gl_state gl;
|
||||
std::shared_ptr<NodeProgressBar> pb;
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
App::I.async_start();
|
||||
pb = std::make_shared<NodeProgressBar>();
|
||||
pb->m_manager = &App::I.layout;
|
||||
pb->init();
|
||||
pb->create();
|
||||
pb->loaded();
|
||||
pb->m_progress->SetWidthP(0);
|
||||
pb->m_title->set_text("Export Pano Image");
|
||||
App::I.layout[App::I.main_id]->add_child(pb);
|
||||
App::I.async_update();
|
||||
App::I.async_end();
|
||||
}
|
||||
|
||||
int progress = 0;
|
||||
int total = names.size();
|
||||
|
||||
for (const auto& n : names)
|
||||
{
|
||||
std::string path = App::I.data_path + "/" + n;
|
||||
App::I.upload(path);
|
||||
|
||||
progress++;
|
||||
float p = (float)progress / total * 100.f;
|
||||
LOG("progress: %f", p);
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
App::I.async_start();
|
||||
pb->m_progress->SetWidthP(p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
}
|
||||
}
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
{
|
||||
App::I.async_start();
|
||||
pb->destroy();
|
||||
App::I.async_update();
|
||||
App::I.async_end();
|
||||
}
|
||||
}).detach();
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user