Changeset 269 in flair-src for trunk/tools/FlairGCS/src/XmlWidget.cpp


Ignore:
Timestamp:
10/04/18 13:53:11 (6 years ago)
Author:
Sanahuja Guillaume
Message:

flairgcs:
speed up processing time when receiving datas from uav
triger watchdog while receiving datas from uav
(avoids connection lost in uav)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/XmlWidget.cpp

    r244 r269  
    8888}
    8989
    90 void XmlWidget::ParseXml(QDomElement to_parse) {
    91 
    92   if (to_parse.isNull())
     90void XmlWidget::ParseXml(QDomElement *to_parse) {
     91
     92  if (to_parse->isNull())
    9393    return;
    9494
    95   QString type = to_parse.tagName();
    96   QString name = to_parse.attribute("name");
     95  QString type = to_parse->tagName();
     96  QString name = to_parse->attribute("name");
    9797
    9898  // fprintf(stderr,"parse %s
     
    108108    // si on a une balise IsEnabled, on ne traite que ca
    109109    if (match->visible_widget != NULL) {
    110       if (to_parse.attribute("IsEnabled") == "0") {
     110      if (to_parse->attribute("IsEnabled") == "0") {
    111111        match->visible_widget->setEnabled(false);
    112112        return;
    113113      }
    114       if (to_parse.attribute("IsEnabled") == "1") {
     114      if (to_parse->attribute("IsEnabled") == "1") {
    115115        match->visible_widget->setEnabled(true);
    116116        return;
     
    119119
    120120    // si on a une balise delete, on ne traite que ca
    121     if (to_parse.attribute("Delete") == "1") {
     121    if (to_parse->attribute("Delete") == "1") {
    122122      // fprintf(stderr,"delete flag\n");
    123123      if (match->isContainer == true && match->childs->count() != 0) {
     
    131131    }
    132132
    133     if (to_parse.firstChild().isNull() == true &&
     133    if (to_parse->firstChild().isNull() == true &&
    134134        match->isExpandable == false) {
    135135      QString new_name;
     
    148148      }
    149149      fprintf(stderr,"new_name %s\n", new_name.toLocal8Bit().constData());
    150       to_parse.setAttribute("name", new_name);
    151       to_parse.setAttribute("old_name", name);
     150      to_parse->setAttribute("name", new_name);
     151      to_parse->setAttribute("old_name", name);
    152152
    153153      XmlEvent(to_parse);
     
    155155      // return -1;//ou retourner le xml a renvoyer pour chager de nom
    156156    } else {
    157       if (to_parse.firstChild().toElement().isNull()) {
     157      if (to_parse->firstChild().toElement().isNull()) {
    158158        match->XmlEvent(to_parse);
    159159        return;
    160160      } else {
    161         match->ParseXml(to_parse.firstChild().toElement());
    162       }
    163     }
    164   }
    165 }
    166 
    167 void XmlWidget::LoadXml(QDomElement to_parse) {
    168   if (to_parse.isNull())
     161        QDomElement dom=to_parse->firstChild().toElement();
     162        match->ParseXml(&dom);
     163      }
     164    }
     165  }
     166}
     167
     168void XmlWidget::LoadXml(QDomElement *to_parse) {
     169  if (to_parse->isNull())
    169170    return;
    170171
    171172  LoadEvent(to_parse);
    172173
    173   QDomElement elem = to_parse.firstChild().toElement();
     174  QDomElement elem = to_parse->firstChild().toElement();
    174175
    175176  while (!elem.isNull()) {
     
    184185    if (match != NULL) {
    185186      // fprintf(stderr,"match\n");
    186       match->LoadXml(elem);
     187      match->LoadXml(&elem);
    187188    }
    188189    elem = elem.nextSibling().toElement();
Note: See TracChangeset for help on using the changeset viewer.