add message when failed to load thumbs from cloud

This commit is contained in:
2017-11-14 09:31:12 +00:00
parent 0d3431a9de
commit 7564d11570
6 changed files with 76 additions and 4 deletions

View File

@@ -53,6 +53,22 @@ void NodeDialogCloud::load_thumbs_thread()
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
curl_easy_setopt(curl, CURLOPT_URL, "http://omigamedev.ddns.net:8080/panoview/cloud-list.php");
auto err = curl_easy_perform(curl);
if (err != CURLE_OK)
{
async_start();
auto* align = container->add_child<Node>();
align->SetWidthP(100.f);
align->SetHeightP(100.f);
align->SetAlign(YGAlignCenter);
align->SetJustify(YGJustifyCenter);
auto* t = align->add_child<NodeText>();
t->set_font(kFont::Arial_30);
t->set_text("Could not connect to the server");
async_update();
async_end();
return;
}
LOG("CLOUD LIST: %s", res.c_str());
auto names = split(res, ',');
@@ -62,6 +78,8 @@ void NodeDialogCloud::load_thumbs_thread()
std::string url = "http://omigamedev.ddns.net:8080/panoview/cloud-info.php?file=" + n;
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
auto err = curl_easy_perform(curl);
if (err != CURLE_OK)
break; // TODO: handle this error with a message or something
auto info = split(res, ',', 3);
int width = atoi(info[0].c_str());
int height = atoi(info[1].c_str());