}
// Espera a que termine realmente.
while (conexion) {
- Glib::usleep(10000); // 10 milisegundos
+ Glib::usleep(100000); // 0,1 segundo
}
}
// Conecto las señales
conexion->signal_ok_received().connect( SigC::slot(*this, &Principal::on_conexion_ok) );
+ conexion->signal_error().connect( SigC::slot(*this, &Principal::on_conexion_fatal_error) );
conexion->signal_error_received().connect( SigC::slot(*this, &Principal::on_conexion_error) );
conexion->signal_finished().connect( SigC::slot(*this, &Principal::on_conexion_finished) );
conexion->signal_frame_received().connect(SigC::slot(*this, &Principal::on_conexion_frame));
void Principal::on_mnu_file_exit()
{
+ on_mnu_file_disconnect();
Gtk::Main::quit();
}
+bool Principal::on_delete_event(GdkEventAny *e)
+{
+ on_mnu_file_exit();
+ return false;
+}
+
void Principal::on_btn_activar_clicked()
{
if ((conexion == NULL) || (last_selected == NULL)) return;
}
}
-void Principal::on_conexion_error(unsigned code)
+void Principal::on_conexion_fatal_error(const PlaQui::Server::ControlClient::Error& code, const std::string& desc)
{
std::stringstream a;
std::string s;
a << code;
a >> s;
- txt_view->get_buffer()->insert_at_cursor("El server dice que hay error : ");
+ txt_view->get_buffer()->insert_at_cursor("Error de red nro. ");
txt_view->get_buffer()->insert_at_cursor(s);
+ txt_view->get_buffer()->insert_at_cursor(": ");
+ txt_view->get_buffer()->insert_at_cursor(desc);
+ txt_view->get_buffer()->insert_at_cursor("\n");
+}
+
+void Principal::on_conexion_error(unsigned code, const std::string& desc)
+{
+ std::stringstream a;
+ std::string s;
+ a << code;
+ a >> s;
+ txt_view->get_buffer()->insert_at_cursor("El server dice que hay error nro. ");
+ txt_view->get_buffer()->insert_at_cursor(s);
+ txt_view->get_buffer()->insert_at_cursor(": ");
+ txt_view->get_buffer()->insert_at_cursor(desc);
txt_view->get_buffer()->insert_at_cursor("\n");
}
Gdk::Color Principal::get_rgb_from_xml(xmlNodePtr nodo)
{
- unsigned r,g,b;
+ gushort r,g,b;
while (nodo != NULL) {
if (nodo->type == XML_ELEMENT_NODE) {
if (xmlStrcmp(nodo->name, BAD_CAST"r")==0)
}
nodo = nodo->next;
}
- r = 65535 * r / 255;
- g = 65535 * g / 255;
- b = 65535 * b / 255;
+ r = static_cast<gushort>(65535 * (r / 255.0f));
+ g = static_cast<gushort>(65535 * (g / 255.0f));
+ b = static_cast<gushort>(65535 * (b / 255.0f));
Gdk::Color c;
c.set_rgb(r,g,b);
return c;
}
+
float Principal::get_float_from_xml(xmlNodePtr nodo)
{
float tmp = -1;