add upload to cloud menu to copy all the files to the server
This commit is contained in:
@@ -464,6 +464,10 @@
|
|||||||
<icon icon="disk" width="20"/>
|
<icon icon="disk" width="20"/>
|
||||||
<text text="Export PNG" margin="0 0 0 5" font-face="arial" font-size="11"/>
|
<text text="Export PNG" margin="0 0 0 5" font-face="arial" font-size="11"/>
|
||||||
</button-custom>
|
</button-custom>
|
||||||
|
<button-custom id="file-upload" text="Menu" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
||||||
|
<icon icon="weather_clouds" width="20"/>
|
||||||
|
<text text="Upload to Cloud" margin="0 0 0 5" font-face="arial" font-size="11"/>
|
||||||
|
</button-custom>
|
||||||
<button-custom text="Menu" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
<button-custom text="Menu" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
||||||
<icon width="20"/>
|
<icon width="20"/>
|
||||||
<text text="Quit" margin="0 0 0 5" font-face="arial" font-size="11"/>
|
<text text="Quit" margin="0 0 0 5" font-face="arial" font-size="11"/>
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void App::upload(std::string filename)
|
|||||||
|
|
||||||
if (curl)
|
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_HTTPPOST, formpost);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &res);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &res);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
|
||||||
|
|||||||
@@ -375,6 +375,61 @@ void App::init_menu_file()
|
|||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
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();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1234,8 +1234,8 @@ void ui::Canvas::project_save_thread(std::string data_path)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
LOG("project saved to %s", data_path.c_str());
|
LOG("project saved to %s", data_path.c_str());
|
||||||
|
|
||||||
App::I.upload(data_path);
|
// App::I.upload(data_path);
|
||||||
LOG("uploaded");
|
// LOG("uploaded");
|
||||||
|
|
||||||
App::I.async_start();
|
App::I.async_start();
|
||||||
pb->destroy();
|
pb->destroy();
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ int main(int argc, char** argv)
|
|||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
|
||||||
|
if (argc == 1)
|
||||||
App::I.initLog();
|
App::I.initLog();
|
||||||
|
|
||||||
SetupExceptionHandler();
|
SetupExceptionHandler();
|
||||||
|
|||||||
Reference in New Issue
Block a user