small fixes

This commit is contained in:
2018-09-20 18:24:57 +02:00
parent 5a3ba0eea3
commit 3a81d337d4
6 changed files with 29 additions and 10 deletions

View File

@@ -672,7 +672,7 @@
-->
<button-custom id="file-cloud-upload" text="Menu" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
<icon icon="weather_clouds" width="20"/>
<text text="Cloud Upload" grow="1" margin="0 0 0 5" font-face="arial" font-size="11"/>
<text text="Cloud Publish" grow="1" margin="0 0 0 5" font-face="arial" font-size="11"/>
</button-custom>
<button-custom id="file-cloud-browse" text="Menu" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
<icon icon="weather_clouds" width="20"/>

View File

@@ -22,7 +22,7 @@ void App::cloud_upload()
}
else
{
std::thread([this] {
auto upload_thread = [this] {
std::string path = data_path + "/" + doc_name + ".ppi";
if (ui::Canvas::I->m_unsaved)
{
@@ -52,7 +52,25 @@ void App::cloud_upload()
layout[main_id]->update();
async_redraw();
async_end();
}).detach();
};
auto m = layout[main_id]->add_child<NodeMessageBox>();
m->m_title->set_text("Publish document");
m->m_message->set_text("Would you like to upload this document to the public domain?");
m->btn_ok->m_text->set_text("Yes");
m->btn_cancel->m_text->set_text("No");
m->btn_ok->on_click = [this, m, upload_thread](Node*) {
std::thread(upload_thread).detach();
async_start();
m->destroy();
async_end();
};
m->btn_cancel->on_click = [this, m, upload_thread](Node*) {
async_start();
m->destroy();
async_end();
};
}
}

View File

@@ -1613,13 +1613,14 @@ void ui::Canvas::project_save_thread(std::string file_path)
// App::I.upload(data_path);
// LOG("uploaded");
m_unsaved = false;
m_newdoc = false;
App::I.async_start();
pb->destroy();
App::I.title_update();
App::I.async_update();
App::I.async_end();
m_unsaved = false;
m_newdoc = false;
}
void ui::Canvas::project_open(std::string file_path, std::function<void()> on_complete)
@@ -1756,6 +1757,8 @@ void ui::Canvas::project_open_thread(std::string file_path)
fclose(fp);
LOG("project restore from %s", file_path.c_str());
m_unsaved = false;
m_newdoc = false;
if (App::I.layout.m_loaded)
{
App::I.async_start();
@@ -1766,8 +1769,6 @@ void ui::Canvas::project_open_thread(std::string file_path)
App::I.title_update();
App::I.async_end();
}
m_unsaved = false;
m_newdoc = false;
}
ui::Image ui::Canvas::thumbnail_generate(int w, int h)

View File

@@ -83,7 +83,7 @@ void NodeDialogBrowse::init_controls()
return;
selected_path = target->m_path;
selected_file = target->m_file_name;
selected_name = selected_file.substr(0, selected_file.length() - 5);
selected_name = selected_file.substr(0, selected_file.length() - strlen(".ppi"));
if (current)
current->m_selected = false;
current = target;

View File

@@ -105,7 +105,7 @@ void NodeDialogCloud::load_thumbs_thread()
return;
selected_path = target->m_path;
selected_file = target->m_file_name;
selected_name = selected_file.substr(0, selected_file.length() - 5);
selected_name = selected_file.substr(0, selected_file.length() - strlen(".ppi"));
if (current)
current->m_selected = false;
current = target;

View File

@@ -87,7 +87,7 @@ void NodeDialogOpen::init_controls()
image_tex->tex.create(thumb);
selected_path = target->m_path;
selected_file = target->m_file_name;
selected_name = selected_file.substr(0, selected_file.length() - 5);
selected_name = selected_file.substr(0, selected_file.length() - strlen(".ppi"));
if (current)
current->m_selected = false;
current = target;