93 lines
2.5 KiB
C++
93 lines
2.5 KiB
C++
#include "pch.h"
|
|
#include "app.h"
|
|
#include "util.h"
|
|
#include "node_progress_bar.h"
|
|
#include "node_dialog_cloud.h"
|
|
|
|
using namespace ui;
|
|
|
|
void App::cloud_upload_all()
|
|
{
|
|
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();
|
|
}
|
|
|
|
void App::cloud_browse()
|
|
{
|
|
if (!canvas)
|
|
return;
|
|
|
|
// load thumbnail test
|
|
auto dialog = std::make_shared<NodeDialogCloud>();
|
|
dialog->m_manager = &layout;
|
|
dialog->data_path = data_path;
|
|
dialog->init();
|
|
dialog->create();
|
|
dialog->loaded();
|
|
|
|
layout[main_id]->add_child(dialog);
|
|
layout[main_id]->update();
|
|
|
|
dialog->btn_ok->on_click = [this, dialog](Node*)
|
|
{
|
|
// canvas->reset_camera();
|
|
// layers->clear();
|
|
// canvas->m_canvas->project_open(dialog->selected_path);
|
|
// doc_name = dialog->selected_name;
|
|
// if (auto docname = layout[main_id]->find<NodeText>("txt-docname"))
|
|
// docname->set_text(("Panodoc: " + doc_name).c_str());
|
|
// for (auto& i : canvas->m_canvas->m_order)
|
|
// layers->add_layer(canvas->m_canvas->m_layers[i].m_name.c_str());
|
|
dialog->destroy();
|
|
ActionManager::clear();
|
|
};
|
|
} |