upload progresso bar
This commit is contained in:
@@ -25,8 +25,21 @@ void App::cloud_upload()
|
||||
std::thread([this] {
|
||||
std::string path = data_path + "/" + doc_name + ".pano";
|
||||
Canvas::I->project_save_thread(path);
|
||||
upload(path);
|
||||
|
||||
async_start();
|
||||
auto pb = show_progress("Uploading");
|
||||
async_redraw();
|
||||
async_end();
|
||||
|
||||
upload(path, doc_name, [this,pb](float p){
|
||||
async_start();
|
||||
pb->m_progress->SetWidthP(p * 100.f);
|
||||
async_redraw();
|
||||
async_end();
|
||||
});
|
||||
|
||||
async_start();
|
||||
pb->destroy();
|
||||
auto msgbox = new NodeMessageBox();
|
||||
msgbox->m_manager = &layout;
|
||||
msgbox->init();
|
||||
@@ -34,6 +47,7 @@ void App::cloud_upload()
|
||||
msgbox->m_message->set_text("This document has been succesfully uploaded.");
|
||||
layout[main_id]->add_child(msgbox);
|
||||
layout[main_id]->update();
|
||||
async_redraw();
|
||||
async_end();
|
||||
}).detach();
|
||||
}
|
||||
@@ -41,24 +55,17 @@ void App::cloud_upload()
|
||||
|
||||
void App::cloud_upload_all()
|
||||
{
|
||||
std::thread([] {
|
||||
auto names = Asset::list_files(App::I.data_path, false, ".*\\.pano");
|
||||
std::thread([this] {
|
||||
auto names = Asset::list_files(data_path, false, ".*\\.pano");
|
||||
|
||||
gl_state gl;
|
||||
std::shared_ptr<NodeProgressBar> pb;
|
||||
if (App::I.layout.m_loaded)
|
||||
if (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();
|
||||
async_start();
|
||||
pb = show_progress("Export Pano Image");
|
||||
async_redraw();
|
||||
async_end();
|
||||
}
|
||||
|
||||
int progress = 0;
|
||||
@@ -66,30 +73,30 @@ void App::cloud_upload_all()
|
||||
|
||||
for (const auto& n : names)
|
||||
{
|
||||
std::string path = App::I.data_path + "/" + n;
|
||||
App::I.upload(path);
|
||||
std::string path = data_path + "/" + n;
|
||||
upload(path);
|
||||
|
||||
progress++;
|
||||
float p = (float)progress / total * 100.f;
|
||||
LOG("progress: %f", p);
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
if (layout.m_loaded)
|
||||
{
|
||||
App::I.async_start();
|
||||
async_start();
|
||||
pb->m_progress->SetWidthP(p);
|
||||
gl.save();
|
||||
App::I.async_update();
|
||||
async_redraw();
|
||||
gl.restore();
|
||||
App::I.async_end();
|
||||
async_end();
|
||||
}
|
||||
}
|
||||
|
||||
if (App::I.layout.m_loaded)
|
||||
if (layout.m_loaded)
|
||||
{
|
||||
App::I.async_start();
|
||||
async_start();
|
||||
pb->destroy();
|
||||
App::I.async_update();
|
||||
App::I.async_end();
|
||||
async_redraw();
|
||||
async_end();
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user