implement cloud browser

This commit is contained in:
2017-11-05 22:54:04 +00:00
parent ae7a8948b7
commit 11c26555a4
19 changed files with 434 additions and 73 deletions

View File

@@ -424,60 +424,15 @@ void App::init_menu_file()
popup->mouse_release();
popup->destroy();
};
popup->find<NodeButtonCustom>("file-upload")->on_click = [this](Node*) {
popup->find<NodeButtonCustom>("file-cloud-upload")->on_click = [this](Node*) {
cloud_upload_all();
popup->mouse_release();
popup->destroy();
};
popup->find<NodeButtonCustom>("file-cloud-browse")->on_click = [this](Node*) {
cloud_browse();
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();
};
};
}