rev = rev.substr(6, rev.length() - 8);
std::string s = "PlaQui Client versión " VERSION " (revisión ";
s += rev + ")";
- lbl_plaqui_version->set_text(Glib::locale_to_utf8(s));
+ try {
+ lbl_plaqui_version->set_text(Glib::locale_to_utf8(s));
+ }
+ catch (...) {
+ lbl_plaqui_version->set_text("PlaQui Client");
+ }
rg->get_widget("anim_frames", anim);
anim->set(anim_frames[current_frame]);
load_xml_dispatch();
} else {
Glib::ustring s;
- s = "<IN>\n"+Glib::locale_to_utf8(body)+"\n</IN>\n";
+ try {
+ s = "<IN>\n"+Glib::locale_to_utf8(body)+"\n</IN>\n";
+ }
+ catch (...) {
+ s = "NO SE PUDO CONVERTIR MENSAJE A UTF8";
+ }
txt_view->get_buffer()->insert(txt_view->get_buffer()->begin(),s);
}
}
mapItems[name] = b;
}
-void Principal::read_status_xml(const std::string &frame)
+void Principal::read_status_xml(const std::string &_frame)
{
std::string item_name;
+ std::string frame = _frame;
xmlDocPtr document;
+
+ // Cambio las , por . para evitar problemas de convercion
+ for(int i=0; i<frame.size(); i++) {
+ if (frame[i] == ',') {
+ frame[i] = '.';
+ }
+ }
document = xmlParseMemory(frame.c_str(),frame.size());
if (document == NULL) {
txt_view->get_buffer()->insert(txt_view->get_buffer()->begin(), "ERROR : No se pudo leer el último frame!\n");
if (xmlStrcmp(items->name, BAD_CAST"float")==0) {
tmp = get_float_from_xml(items->children);
item_name = (char *)xmlGetProp(items, BAD_CAST"name");
+ std::cout << item_name << " " << tmp << std::endl;
mapItems[item_name]->set_actual_flow(tmp);
} else if (xmlStrcmp(items->name, BAD_CAST"exclusa")==0) {
tmp_b = get_bool_from_xml(items->children);
float Principal::get_float_from_xml(xmlNodePtr nodo)
{
float tmp = -1;
+ std::string s;
while (nodo != NULL) {
if (nodo->type == XML_ELEMENT_NODE) {
if (xmlStrcmp(nodo->name, BAD_CAST"actual_flow")==0) {
- tmp = atof( (char *)XML_GET_CONTENT(nodo->children) );
+ s = (char *)XML_GET_CONTENT(nodo->children);
break;
}
}
nodo = nodo->next;
}
+ std::stringstream ss;
+ ss << s;
+ ss >> tmp;
if (tmp == INFINITO) tmp = 0;
+
return tmp;
}