add upload to cloud menu to copy all the files to the server

This commit is contained in:
2017-11-04 22:48:18 +00:00
parent 2baaff10cc
commit b42fbb197a
5 changed files with 64 additions and 4 deletions

View File

@@ -90,7 +90,7 @@ void App::upload(std::string filename)
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, "http://omigamedev.ddns.net:8080/upload/upl.php");
curl_easy_setopt(curl, CURLOPT_URL, "http://omigamedev.ddns.net:8080/panoview/upl.php");
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &res);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);

View File

@@ -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();
};
};
}
}

View File

@@ -1234,8 +1234,8 @@ void ui::Canvas::project_save_thread(std::string data_path)
fclose(fp);
LOG("project saved to %s", data_path.c_str());
App::I.upload(data_path);
LOG("uploaded");
// App::I.upload(data_path);
// LOG("uploaded");
App::I.async_start();
pb->destroy();

View File

@@ -234,7 +234,8 @@ int main(int argc, char** argv)
WNDCLASS wc;
PIXELFORMATDESCRIPTOR pfd;
App::I.initLog();
if (argc == 1)
App::I.initLog();
SetupExceptionHandler();
BT_SetTerminate();